[Bioperl-l] Newbie alert: Aligning and printing first position

Roy Chaudhuri roy.chaudhuri at gmail.com
Wed Mar 30 15:43:35 UTC 2011


Hi Diego,

Column refers to the position in the alignment, not the individual 
sequence. location_from_column therefore gives the position in the 
individual sequence that corresponds to the requested column (you get 
undef since there is a gap in the first column of the alignment for 
seq1). If I understand correctly, you want the reverse, the position in 
the alignment that corresponds to the first position in your sequence. 
For that you need the opposite function, column_from_residue_number:

my $loc=$seq->column_from_residue_number(1);

$loc will now contain 8 (not 7), since position 1 of your sequence is in 
column 8 of the alignment.

Hope this helps,
Roy.

On 30/03/2011 15:51, Diego M. Vadell wrote:
> Hi list,
>
>      I have an alignment ( done with Bio::Tools::Run::Alignment::Clustalw )
> that I can see ( printing $aln->match_line() along with the sequences ):
>
>          ********* .:                                   (match_line)
> .......TDDSFDTDVSSS.........[...].............   ($seq1)
> SDKIIHLTDDSFDTDVLKADGA[...]EFLDANLA   ($seq2)
>
>      It looks right ( that "[...]" is mine, it's larger ). Now I want to get
> the position of the match ( the first "T" ), which should be "7". I thought I
> needed to use something like:
>
> my $seq = $aln->get_seq_by_pos(1);
> my $loc = $seq->location_from_column(1);
> say $loc;
>
> And $loc would be 7, but it's undef. If I try to iterate from 1 to 10, I start
> getting Bio::Location::Simple objects at the 8th place. So, should I loop
> untill I location_from_column() gives me an object? Is it another way of
> finding the position of the match?
>
> As you can see, I'm just starting with bioinformatics. Any pointer will be
> appreciated.
>
> Thanks in advance,
>   -- Diego
> _______________________________________________
> 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