I think you are confusing Bioperl's biological coordinates (which start at
1) with Perl coordinates (which start at 0). Just realising this
distinction should answer your first problem - the first column of the
alignment is column 1, so of course you get an error (admittedly a not very
helpful one) when you specify column 0.
The same confusion causes a subtle bug in your example code for problem b -
you use $col1 and $col2 for your substr coordinates, but they are
biological coordinates returned by Bioperl, so you need to subtract one (or
you could use the Bio::Seq method subseq rather than Perl's substr).
Correcting this bug means that you do not get any gaps reported in the
On 23 April 2013 17:10, Téletchéa Stéphane
> Dear bioperlers,
> I am facing a problem I used to encounter in the past and failed to
> it properly.
> I am either mis-using it or there is a bug, I would like your feedback.
> Consider the alignment between sequence A and B in test.ali,
> and the bioperl_test.pl as examples (attached to this mail).
> I would like to know at position i what is the amino acid of seq A,
> and what is the amino acid in position i in sequence B (of course these
> residues may not be aligned).
> The problem is:
> a) I cannot parse the first residue of the alignment, it has to start at
> 1, otherwise I have:
> ------------- EXCEPTION: Bio::Root::Exception -------------
> MSG: Second argument residue number missing
> STACK: Error::throw
> STACK: Bio::Root::Root::throw /usr/share/perl5/Bio/Root/**Root.pm:472
> STACK: Bio::SimpleAlign::column_from_**residue_number
> STACK: ./bioperl_test.pl:19
> b) Although, if I understand correctly, this function should return only
> the residues,
> sometimes I have a gap inserted, so the function is not working properly:
> ./bioperl_test.pl |grep '-'
> P:11 for seq 1 and -:30 for seq 2
> S:76 for seq 1 and -:96 for seq 2
> -:124 for seq 1 and L:146 for seq 2
> -:150 for seq 1 and K:170 for seq 2
> -:175 for seq 1 and I:190 for seq 2
> -:202 for seq 1 and L:215 for seq 2
> -:224 for seq 1 and G:233 for seq 2
> W:264 for seq 1 and -:263 for seq 2
> S:296 for seq 1 and -:297 for seq 2
> -:343 for seq 1 and S:345 for seq 2
> -:369 for seq 1 and H:361 for seq 2
> Can we discuss it here or I have to open a bug report?
> Thanks in advance,
> Equipe DSIMB - Dynamique des Structures et
> des Interactions des Macromolécules Biologiques
> INTS, INSERM-Paris-Diderot UMR-S665
> 6 rue Alexandre Cabanel - 75739 Paris cedex 15- France
> Tél : +33 144 493 057
> Fax : +33 147 347 431
> http://www.dsimb.inserm.fr / http://steletch.free.fr
> Bioperl-l mailing list
> [email protected]