[Bioperl-l] Help with manipulating quality objects PLUS write_seq(args)

Brian Desany bdesany@bcm.tmc.edu
Wed, 23 Oct 2002 14:38:01 -0500


Here's the code:


my ($self,%args) = @_;
my ($source)  = $self->_rearrange([qw(SOURCE)], %args);

if (!$source || ( ref($source) ne "Bio::Seq::SeqWithQuality" &&
		      ref($source) ne "Bio::Seq::PrimaryQual")) {
	$self->throw("You must pass a Bio::Seq::SeqWithQuality or a
Bio::Seq::PrimaryQual object to write_seq as a parameter named \"source\"");
}


In my hands, if @_ = ($callerObj, $primaryQualObj), then $source is set to
the string 'Bio::Seq::PrimaryQual=HASH(0x68aed8)', not an actual object, so
that ref($source) returns the empty string, so the method throws.

(Plus you get odd number of elements in hash assignment warning)

-Brian.


>-----Original Message-----
>From: Hilmar Lapp [mailto:hlapp@gnf.org]
>Sent: Wednesday, October 23, 2002 12:35 PM
>To: bdesany@bcm.tmc.edu; bioperl-l@bioperl.org
>Subject: RE: [Bioperl-l] Help with manipulating quality objects PLUS
>write_seq(args)
>
>
>
>
>> -----Original Message-----
>> From: Brian Desany [mailto:bdesany@bcm.tmc.edu]
>> Sent: Wednesday, October 23, 2002 10:06 AM
>> To: bioperl-l@bioperl.org
>> Subject: RE: [Bioperl-l] Help with manipulating quality objects PLUS
>> write_seq(args)
>>
><snip/>
>>
>> On a separate note:
>>
>> One thing I did notice is that write_seq takes named
>> arguments, and uses
>> _rearrange to get SOURCE.  OTOH, Bio::SeqIO::fasta::write_seq
>> takes an array
>> of Seq objects.
>>
>> In my code I like to have the correct module chosen at
>> runtime and call
>> write_seq without necessarily knowing ahead of time whether
>> it's a fasta or
>> qual IO. So therefore I would also like to call write_seq in
>> the same way
>> for both.
>>
>> Does anyone mind if I change qual.pm so that you can write_seq with
>>
>> $io->write_seq($qual);
>>
>> in addition to
>>
>> $io->write_seq('-source'=>$qual);
>>
>
>_rearrange() should take care of that already. Do you see that
>it doesn't?
>
>	-hilmar
>