[Bioperl-l] Arrays of BioSeq and TCoffee

James Wasmuth james.wasmuth@ed.ac.uk
Thu Jan 16 20:38:25 EST 2003


Thanks to Jason and Brian for solutions, tidy code is so much more, 
errrm... tidy.  ;o)



Jason Stajich wrote:

>On Thu, 16 Jan 2003, James Wasmuth wrote:
>
>  
>
>>Hi people,
>>
>>I have a number of fasta format sequences in one string, which I wish to
>>align using T-Coffee, without writing the sequences to a file first.
>>
>>According to doc for T-Coffee module, the align method will take a
>>filename or an array of references for Bio::Seq objects...
>>
>>I've tried the following script but it fails, I am informed that the
>>first Bio::Seq object contains less than 2 sequences.  Well of course it
>>does, its a Bio::Seq object...  Can anyone see my error...
>>
>>    
>>
>
>  
>
>>my @fasta_seq = qw/  >seq1\nFTTATT  >seq2\nFTTGTT  >seq3\nFTATTT /;
>>my @seq;
>>foreach (@fasta_seq)    {
>>        my $stringfh = new IO::String($_);
>>        my $seqio = new Bio::SeqIO(-fh => $stringfh, -format => 'fasta');
>>        push @seq ($seqio_obj->next_seq);
>>    }
>># here I know that @seq is an array of Bio::Seq objects
>>
>>    
>>
>Ye gods, that is scary
>It would seem simplier to me
>
>
>my $fastaseq =<<EOF
>  
>
>>seq1
>>    
>>
>TTACATA
>  
>
>>seq2
>>    
>>
>TGACCAT
>  
>
>>seq3
>>    
>>
>ATAGT
>EOF
>;
>
>my $iostring = new IO::String($fastaseq);
>my $seqio = new Bio::SeqIO(-fh => $stringfh,-format =>'fasta');
>my @seq;
>while( my $seq = $seqio->next_seq) { push @seq,$seq }
>
>
>
>  
>
>>my @params = (some params);
>>my $factory = new Bio::Tools::Run::Alignment::TCoffee (@params);
>>my $aln = $factory->align(@seq);
>>
>>    
>>
>You want an array reference here:
>my $aln = $factory->align(\@seq);
>
>I think this is in the docs though...
>
>  
>
>>Can a Bio::Seq object hold more than one sequence? Is that my problem
>>
>>Many Thanks
>>
>>J
>>
>>
>>_______________________________________________
>>Bioperl-l mailing list
>>Bioperl-l@bioperl.org
>>http://bioperl.org/mailman/listinfo/bioperl-l
>>
>>    
>>
>
>--
>Jason Stajich
>Duke University
>jason at cgt.mc.duke.edu
>  
>

-- 

Nematode Bioinformatics
Blaxter Nematode Genomics Group
Institute of Cell, Animal and Population Biology
Ashworth Labs
University of Edinburgh
King's Buildings
Edinburgh
EH9 3JT

0131 650 7403






More information about the Bioperl-l mailing list