[Bioperl-l] Res: extract overhangs from Clustalw

Rohit Ghai ghai.rohit at gmail.com
Wed Feb 16 06:03:44 EST 2011


Hi

You could also consider using trimAL for cutting out selected columns from
an alignment.

http://trimal.cgenomics.org/

cheers
Rohit


On Wed, Feb 16, 2011 at 11:49 AM, Roy Chaudhuri <roy.chaudhuri at gmail.com>wrote:

> Hi Rondon,
>
> Please remember to cc the mailing list when you reply, that way others can
> chip in with an answer.
>
> The $endgapfree variable contains a Bio::SimpleAlign object, not a
> Bio::AlignIO. So you can get rid of the while loop and just say:
>
> $out->write_aln($endgapfree);
>
> Cheers,
> Roy.
>
> On 15/02/2011 18:05, Rondon Neto wrote:
>
>> Thank you! Sorry my poor question.
>>
>> I have gaps in the central region and want to keep them. I use your
>> suggestion and that works. I tried to print the alignment without
>> success, so I'm thinking to save it in a new file, like we do in SeqIO,
>> but its not working. Is that the way? see my code:
>>
>> -----------------------------------------------
>> #/usr/bin/perl
>> use warnings;
>> use strict;
>> use Bio::AlignIO;
>>
>> my $str = Bio::AlignIO->new('-file' => $ARGV[0]);
>> my $aln = $str->next_aln();
>> $aln->gap_line=~/^(-*).*[^-](-*)$/;
>> my $endgapfree=$aln->remove_columns([0,length($1)-1],
>> [$aln->length-length($2), $aln->length-1]);
>>
>> my $out = Bio::AlignIO->new(-file => ">test.out",
>> -format => 'clustalw');
>>
>> while ( my $aln = $endgapfree->next_aln() ) {
>> $out->write_aln($aln);
>> }
>>
>> exit;
>> ------------------------------------------------
>>
>> Thank you again,
>>
>> Rondon Neto
>>
>>
>>
>> ------------------------------------------------------------------------
>> *De:* Roy Chaudhuri <roy.chaudhuri at gmail.com>
>> *Para:* Rondon Neto <rondonbio at yahoo.com.br>
>> *Cc:* Jordi Durban <jordi.durban at gmail.com>; bioperl-l at lists.open-bio.org
>> *Enviadas:* Terça-feira, 15 de Fevereiro de 2011 10:19:00
>> *Assunto:* Re: [Bioperl-l] extract overhangs from Clustalw
>>
>> Hi Rondon,
>>
>> I'm assuming you mean "how do I remove columns with gaps at either end
>> of the alignment?" (since your alignment should be flush if it has come
>> from ClustalW). In future, when you ask questions on the list please try
>> and give as much information as possible, that way we do not have to
>> guess at what you mean.
>>
>> If those are the only gaps in the alignment, then this will work:
>>
>> my $gapfree=$aln->remove_gaps;
>>
>> However, if there are gaps in the central region that you want to keep,
>> then try something like this:
>>
>> $aln->gap_line=~/^(-*).*[^-](-*)$/;
>> my $endgapfree=$aln->remove_columns([0,length($1)-1],
>> [$aln->length-length($2), $aln->length-1]);
>>
>> This will not work correctly if there aren't gaps at both ends of the
>> alignment, so you may have to add in a few checks if you can't make that
>> assumption.
>>
>> Cheers,
>> Roy.
>>
>> On 14/02/2011 20:52, Jordi Durban wrote:
>>  > What do you mean by "overhangs"?
>>  > Have ypu heard about Extending Bio::Tools::Run::Clustalw?
>>  > hope this helps.
>>  > 2011/2/14 Rondon Neto<rondonbio at yahoo.com.br
>> <mailto:rondonbio at yahoo.com.br>>
>>  >
>>  >> How to extract overhangs from Clustalw alignments and return the aln
>> file
>>  >> without the overhangs? I'm trying to use Bio::AlignIO, but Im
>> confused.
>>  >> Thank you very much.
>>  >>
>>  >> Rondon
>>  >>
>>  >>
>>  >>
>>  >> _______________________________________________
>>  >> Bioperl-l mailing list
>>  >> Bioperl-l at lists.open-bio.org <mailto: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
>




More information about the Bioperl-l mailing list