[Bioperl-l] T-Coffee and Simple Align Objectsls

Shawn Hoon shawnh@fugu-sg.org
Tue Jan 21 15:16:28 EST 2003


Do u want to use profile_align to build your alignments instead?

anyways, I tried the following and it seems to work:

use Bio::Tools::Run::Alignment::TCoffee;
use Bio::SeqIO;
use Bio::Root::IO;
use strict;

my $str = Bio::SeqIO->new('-file' =>
        Bio::Root::IO->catfile("t","data","cysprot.fa"),
        '-format' => 'Fasta');
my @seq_array =();

while ( my $seq = $str->next_seq() ) {
    push (@seq_array, $seq) ;
}

my $seq_array_ref = \@seq_array;
my $i=1;
while($i< 5){
    my $aln = &tc($seq_array_ref);
    print $aln->no_sequences."\n";
    $i++;
}

sub tc{
  my ($seq) = @_;
  my $out = "out";
  my @params = ('output' => 'msf', 'outfile' => "$out");
  my  $factory = Bio::Tools::Run::Alignment::TCoffee->new(@params);
  $factory->quiet(1);
  my $aln = $factory->align($seq);
return $aln;
}


I think your best bet is to use AlignIO with output msf format.
I don't think gcg, score_html is supported even though the docs says so. I could be wrong.
 

hth,

shawn
 

On Tue, 21 Jan 2003, James Wasmuth wrote:


> Dear All,
> 
> this is has been bugging me for days, and I hope someone can answer it 
> or suggest a solution.
> 
> I'm writing a program that builds alignments iteratively using T-Coffee. 
>  I've written a sub-routine to carry out the alignment building which is 
> in a while loop, so basically...
> 
> while ($cond)    {
>     $aln_obj = &TCoffee($some_seq);
>     $cond = &somethingelse($aln_obj);
>      ......
> 
> }
> 
> sub T_COFFEE    {
>     my $fasta_seq = $_[0];
>     my $out = "out";
> #some code hear that converts $some_seq into array of BioSeq objects
>     my @params = ('output' => 'gcg, score_html' , 'outfile' => "$out");
>     my $factory = new Bio::Tools::Run::Alignment::TCoffee (@params);
>           
>     my $aln = $factory->align(\@seq_obj);
>     return $aln;
> }   
> 
> 
> The first time that T-Coffee is asked to build an alignment (from a 
> reference of an array of BioSeq objects, it works fine and a SimpleAlign 
> object is created by the &TCoffee subroutine.  However its the second 
> time of asking that things go flat.
> 
> I've double checked (and then some) that the argument for the ->align() 
> is correct and it is.  In fact I've inserted dummy code asking it to 
> align a fasta file from elsewhere.  While the alignment IS created and 
> stored in a FILE, the desired SimpleAlign object, $aln, is NOT created. 
>  I've tried loads of things to try and see what's going on.  I can build 
> as many SimpleAlign objects as I wish in the subroutine for the first 
> iteration but not subsequently.  I've even created a near identical 
> second subroutine  and placed this after the first and asked it to build 
> an alignment of some else completely, but to no avail, the alignment is 
> created in the required outfile, but not as a SimpleAlign object.  I've 
> also placed the code for the &TCoffee in the while loop instead of the 
> subroutine, and again the SimpleAlign object, $aln, is created only for 
> the first iteration.
> 
> Anyone any suggestions?  Otherwise I'll have to make it a system call 
> and I don't fancy re-writing the subsequent code...
> 
> Cheers
> 
> J
> 
> 
> 

-- 
********************************
* Shawn Hoon
* http://www.fugu-sg.org/~shawnh
********************************




More information about the Bioperl-l mailing list