[Bioperl-l] Bio::PrimarySeq obj?

Jason Stajich jason.stajich at gmail.com
Fri Jun 21 23:09:47 UTC 2013


fork, change, commit, issue pull request - it will be incorporated.  Lincoln wrote the module to support gbrowse in the first iteration - I think I have been annoyed by the same problems as you but found it was easier for me to just create a new object most of the time rather than try to worry about some of the speed things that it does under the hood.  I think adding the warnings is your best bet though rather than retooling it to allow objects to be mutable. 

Jason
On Jun 21, 2013, at 5:08 AM, "Freeman, Robert M." <Bob_Freeman at hms.harvard.edu> wrote:

> So, a number of things bother me about this:
> - why is BioPerl deciding that I can't change this?
> - no warning is thrown when I try to change any value of the object 
> - documentation does not indicate the object is immutable 
> - documentation does not indicate that a PrimarySeq is returned.
> - Worse (at the time), the object is tied to the DB file, so when I dumped the object in the debugger, it started dumping the whole DB Index. Not sure why this decision was made. 
> 
> LOL! Are these bugs or features?
> 
> Yeah, an option at fetch time would be nice.
> 
> -b
> 
> Sent from my iPhone
> 
>> On Jun 20, 2013, at 10:13 PM, "Fields, Christopher J" <cjfields at illinois.edu> wrote:
>> 
>>> On Jun 20, 2013, at 6:27 PM, Bob Freeman <bob_freeman at hms.harvard.edu> wrote:
>>> 
>>> Hoping for an easy answer on this…
>>> 
>>> Using Bio::DB::Fasta to retrive a seqobj with get_Seq_by_id. I can print the raw sequence with seqobj->seq(), but when I try to change and set the raw sequence data (e.g. seqobj->seq("ACTT"), the change is ignored (as evidenced when writing out to new FASTA file).
>>> 
>>> Looking under the hood with the Perl debugger, it appears that the object returned is a Bio::PrimarySeq::FASTA, which points to the whole (indexed) FASTA file; not what I had expected.
>>> 
>>> Is the PrimarySeq obj that is returned immutable?
>> 
>> Right; the object is a lightweight representation IIRC and is designed to be immutable, I'm sure b/c the data in the 'database' (file) can't be changed.
>> 
>>> If so, is there an easy way to 'copy' the object so that I can change the sequence and then write this out to a different file?
>>> 
>>> Tx,
>>> B
>> 
>> I would copy them to a new Bio::PrimarySeq; it's lighter that a full Bio::Seq and will work with Bio::SeqIO.  Might be worth adding a method to Bio::DB::Fasta to do this for convenience.
>> 
>> chris
>> 
>>> -----------------------------------------------------
>>> Bob Freeman, Ph.D.
>>> Acorn Worm Informatics, Kirschner lab
>>> Dept of Systems Biology, Alpert 524
>>> Harvard Medical School
>>> 200 Longwood Avenue
>>> Boston, MA  02115
>>> 617/432.2294, vox
>>> 
>>> "Sorry I'm late. Oh, God, that sounded insincere. I'm late."
>>>   -- Karen Walker, from Will and Grace
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

Jason Stajich
jason.stajich at gmail.com
jason at bioperl.org





More information about the Bioperl-l mailing list