Re: [Bioperl-l] Parent/parent_id attribute
Timothy Parnell <Timothy.Parnell-xpE/FmUf0Yn2fBVCVOL8/[email protected]>
| Newsgroups | gmane.science.biology.gmod.gbrowse,gmane.comp.lang.perl.bio.general |
|---|---|
| Message-ID | <[email protected]> |
I think the best person to answer this is Lincoln, but I’ll try my hand as I’ve done some fair amount of work spelunking and writing my own GFF3 parsers and convertors for my Bio::ToolBox project. In the GFF3 spec, Parent is a special attribute, along with ID, so that when the object is written out as a GFF3 line these are handled with care to ensure they are written properly. One doesn’t normally specify the parent_id attribute in the code. Rather, you associate the child SeqFeature object with the parent SeqFeature object using the add_SeqFeature() method called on the parent object and passing the child object. For example, $transcript->add_SeqFeature($exon); # both are SeqFeature objects You can then write a GFF3 line using the gff_string(1) method. Passing a true object forces the method to recurse through sub features and write them out too, with proper parentage and Parent and ID tags set appropriately. I think this is undocumented in the POD, but works quite well. For the record, this is in Bio::SeqFeature::Lite, from which Bio::DB::SeqFeature and related inherit much of their methods. Hope that helps, Tim On Oct 15, 2014, at 9:12 AM, Fields, Christopher J <cjfields-nzINlOoChub2fBVCVOL8/[email protected]> wrote: > It’s been a little quiet lately :) > > chris > > On Oct 15, 2014, at 4:03 AM, Daniel Lang <Daniel.Lang-CrNPMedtCwE0K98s81L2pjwXqF960eAG@public.gmane.orgrg.de> wrote: > >> Hi Chris, >> >> thanks for you response! No, there hasn't been a response yet. >> >> The solution with add_tag_value('Parent') works for me tough. >> >> Best, >> Daniel >> >> On 28.09.2014 05:26, Fields, Christopher J wrote: >>> Hi Daniel, >>> >>> Not sure if you got an answer to this one yet. I’m cc’ing the gmod-gbrowse group just in case this was missed here. >>> >>> chris >>> >>> On Sep 22, 2014, at 1:13 PM, Daniel Lang <Daniel.Lang-CrNPMedtCwE0K98s81L2pvUpdFzICT1y@public.gmane.orgburg.de> wrote: >>> >>>> Hi, >>>> >>>> I'm using bioperl 1.6.923-1 (Ubuntu Trusty package) and >>>> Bio::DB::SeqFeature to store and manipulate GFF3 files. >>>> >>>> I'm wondering why the "Parent" GFF3 attributes are stored as parent_id >>>> values in the feature objects, but not returned as such in the gff3_string? >>>> >>>> GFF3: >>>> Chr01 transdecoder mRNA 5216 5627 . + . >>>> ID=T1.Chr01.mRNA.1;Parent=T1.Chr01.gene.1;Alias=T1.asmbl_1|m.6484,T1.ORF;Name=T1.Chr01.mRNA.1 >>>> >>>> Example debugger trace after fetching stored feature: >>>> >>>> x $f >>>> 0 Bio::DB::SeqFeature=HASH(0x3e3a798) >>>> 'attributes' => HASH(0x3e3a858) >>>> 'Alias' => ARRAY(0x3e3a8b8) >>>> 0 'T1.asmbl_1|m.6484' >>>> 1 'T1.ORF' >>>> 'load_id' => ARRAY(0x3e3aca8) >>>> 0 'T1.Chr01.mRNA.1' >>>> 'parent_id' => ARRAY(0x3e3acf0) >>>> 0 'T1.Chr01.gene.1' >>>> 'is_circular' => 0 >>>> 'name' => 'T1.Chr01.mRNA.1' >>>> 'phase' => undef >>>> 'primary_id' => 2428 >>>> 'ref' => 'Chr01' >>>> 'score' => undef >>>> 'source' => 'transdecoder' >>>> 'start' => 5216 >>>> 'stop' => 5627 >>>> 'store' => Bio::DB::SeqFeature::Store::DBI::mysql=HASH(0x39b95d0) >>>> 'class_loaded' => HASH(0x3e3a2b8) >>>> 'Bio::DB::SeqFeature' => 1 >>>> 'dbh' => DBI::db=HASH(0x3dc1e40) >>>> empty hash >>>> 'dumpdir' => '/tmp' >>>> 'is_temp' => undef >>>> 'namespace' => undef >>>> 'seqfeatureclass' => 'Bio::DB::SeqFeature' >>>> 'settings_cache' => HASH(0x3dc1d98) >>>> 'autoindex' => 1 >>>> 'compress' => 0 >>>> 'index_subfeatures' => 1 >>>> 'serializer' => 'Storable' >>>> 'writeable' => undef >>>> 'strand' => 1 >>>> 'type' => 'mRNA' >>>> >>>> x $f->gff3_string >>>> 0 >>>> "Chr01\cItransdecoder\cImRNA\cI5216\cI5627\cI.\cI+\cI.\cIName=T1.Chr01.mRNA.1;ID=2428;Alias=T1.asmbl_1%7Cm.6484,T1.ORF" >>>> >>>> What is the best practice to store parentage? I'm currently adding an >>>> additional "Parent" value using add_tag_value. >>>> >>>> Or is this a bug in the version I'm using? >>>> >>>> Best, >>>> Daniel >>>> -- >>>> >>>> Dr. Daniel Lang >>>> University of Freiburg, Plant Biotechnology >>>> Schaenzlestr. 1, D-79104 Freiburg >>>> fax: +49 761 203 6945 >>>> phone: +49 761 203 6989 >>>> homepage: http://www.plant-biotech.net/ >>>> http://www.cosmoss.org/ >>>> e-mail: [email protected] >>>> >>>> ################################################# >>>> My software never has bugs. >>>> It just develops random features. >>>> ################################################# >>>> >>>> >>>> >>>> _______________________________________________ >>>> Bioperl-l mailing list >>>> [email protected] >>>> http://mailman.open-bio.org/mailman/listinfo/bioperl-l >>> >> >> >> >> >> > > > ------------------------------------------------------------------------------ > Comprehensive Server Monitoring with Site24x7. > Monitor 10 servers for $9/Month. > Get alerted through email, SMS, voice calls or mobile push notifications. > Take corrective actions from your mobile device. > http://p.sf.net/sfu/Zoho > _______________________________________________ > Gmod-gbrowse mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho