[Bioperl-l] how to get ID and parent from GFF

gvj geovjames at gmail.com
Thu Dec 2 08:03:52 UTC 2010


Hi,
This is something simple but I m nt able to figure it out whats going wrong.
I have a gff like this:
2       test    gene    2876    3540    0.38    +       .       ID=g1
2       test    transcript      2876    3540    0.38    +       .      
ID=g1.t1;Parent=g1
2       test    transcription_start_site        2876    2876    .       +      
.       Parent=g1.t1
2       test    exon    2876    3118    .       +       .       Parent=g1.t1
2       test    start_codon     3004    3006    .       +       0      
Parent=g1.t1
2       test    intron  3119    3225    1       +       .       Parent=g1.t1
2       test    CDS     3004    3118    1       +       0      
ID=g1.t1.cds;Parent=g1.t1
2       test    CDS     3226    3329    1       +       2      
ID=g1.t1.cds;Parent=g1.t1
2       test    exon    3226    3540    .       +       .       Parent=g1.t1
2       test    stop_codon      3327    3329    .       +       0      
Parent=g1.t1
2       test    transcription_end_site  3540    3540    .       +       .      
Parent=g1.t1

but when I am tring to get the ID value as follow:

my $gff = Bio::DB::GFF->new( -adaptor => "memory",
                             -gff    => $ARGV[0]);

for my $gff_gene ($gff->features("transcript")) {
print " YES the parent is there "  if( $gff_gene->has_tag('Parent') ) ;  #
nothing is printing , That means no Parent tag :(

 my ($tmp) = $gff_gene->get_tag_values("Parent=g1");
  my ($attr) = $gff_gene->attributes("ID");
  my @tags = $gff_gene->get_all_tags();
        my $from_id = $gff_gene->id;


        print "the keys are:". $attr. " or $tmp the tags are :@tags the ID
from : $from_id ";
}


~~~output~~~~~~~~
keys are: or  the tags are :Parent=g1 the ID from : 26

So it seems like that only Parent tag is found and that also along with its
value. Is it something to deal with my gff structure?? 
-- 
View this message in context: http://old.nabble.com/how-to-get-ID-and-parent-from-GFF-tp30356493p30356493.html
Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.




More information about the Bioperl-l mailing list