|Do you know where your variables are?|
Re: Trying to get intergenic sequences using BioPerlby biohisham (Priest)
|on Jul 27, 2015 at 14:12 UTC||Need Help??|
What is the relevance of my @two = shift @features;?. Since shift shortens @features by one through removing the first element held therein you might end mis-assigning feature tags to variables since you can't be sure that all features in a genbank file are consistent for every annotation.
Have you printed out the value of $pt to verify that it is either "CDS" , "rRNA" or "tRNA" ?
Within the same if block you're pushing into and shifting out of @two inside the foreach loop. A practice that can make it harder for you to track current elements within @two
If we define intergenic regions as any region upstream of the next gene and downstream of the first gene and since genes can be in the forward or the backward strands; right next to each other spaced apart by a random number of nucleotides then extracting the intergenic region might be very tricky since you have to consider the orientation of the genes flanking the region and their start and end (start>end for forward strand genes and start<end for backward strand)
From my experience, dealing with Genbank or any other format besides gff is suboptimal due to inconsistent and erroneous annotations. However, try FeatureExtract.py with the -i flag. Be very vigilant for inconsistencies in extracted regions and consider that the output of FeatureExtract might need further cleaning up.
My approach is to parse a GFF file myself and get the coordinates for the features I want to extract then use sfetch to extract the sequences from the corresponding genbank file by passing these coordinates for the features (genes, CDs, RNA, tRNA ..etc). The sfetch utility appropriately takes care of the orientation for you in that if you pass it a "from" position that is larger than a "to" position then it'd extract and reverse translate the negative strand.
In the case of intergenic regions this can simply be reading between the lines of the gff file. I am passing you my one-liners for this activity which you could modify to your content. I put appropriate comments there to get you started.
Something or the other, a monk since 2009