[Bioperl-l] Bio::DB::Fasta::get_Seq_by_id()

Hilmar Lapp hlapp at gmx.net
Tue Oct 31 17:01:44 UTC 2006


The only thing I would add to Jason's reply is that it is easy to do

	if (! $seq->isa("Bio::SeqI")) {
		my $bioseq = Bio::Seq->new();
		$bioseq->primary_seq($seq);
		$seq = $bioseq;
	}

and from that point on all your objects are Bio::SeqI compliant  
regardless of whether they were obtained that way or not.

Aside from that I wonder why there isn't a -primary_seq option in  
Bio::Seq::new - this would shorten the above into a (more perl'ish)  
single line:

	$seq = Bio::Seq->new(-primary_seq=>$seq) unless $seq->isa("Bio::SeqI");

Anyone takers to add that capability?

-hilmar

On Oct 30, 2006, at 3:51 AM, Nathan S. Haigh wrote:

> In my script I retrieve sequences from GenBank in FASTA format by GI
> numbers and optionally store the sequence in a cache using
> Bio::DB::Fasta. On subsequent runs of the script, the cache is first
> checked for the GI and returns the sequence if it is found or the
> sequence is obtained from GenBank as above.
>
> I would have thought that Bio::DB::Fasta::get_Seq_by_id() would have
> returned a Bio::Seq object but rather it returns a Bio::PrimarySeq
> object which is defined within the Bio::DB::Fasta file. This is
> annoying, since $seq_obj in my script would be either a Bio::Seq if it
> was obtained from GenBank or a Bio::PrimarySeq if obtained from the
> cache and calling primary_id() on it doesn't do the expected thing  
> with
> Bio::PrimarySeq:
> ID:          Bio::PrimarySeq::Fasta=HASH(0x89b4508)
>
> Is there a reason why Bio::DB::Fasta doesn't return a Bio::Seq object?
>
> Nath
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>

-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================








More information about the Bioperl-l mailing list