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

Chris Fields cjfields at illinois.edu
Thu Dec 2 14:53:47 UTC 2010


I'm not sure how this is done via Bio::DB::GFF, but try using Bio::DB::SeqFeature instead (which has parent-child ties).  I think you need the tag value 'parent_id', but 'Parent' might work as well, with the caveat I haven't tried this myself yet.

chris

On Dec 2, 2010, at 2:03 AM, gvj wrote:

> 
> 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.
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list