[BioPython] From alignment column pos to seq nucleotide pos

Iddo Friedberg idoerg@cc.huji.ac.il
Thu, 4 Oct 2001 17:48:40 +0200 (GMT+0200)


Hi Anders,

Quick & dirty:

--acat---acca-aaatgcgt      # record 0
a-ccattag-ccataa--gcgt      # record 1
agc--ttag-ccataa--gcgt      # record 2
       ^
	   column  7

Now, you want to find the sequence number if the "a" in record 1, on column 7.

s = 0
for i in c_align._records[1].seq[:7]:
    if i <> "-":   # is this is a bad way for gapchecking??
	    s += 1

"s" is your sequence position.  There is probably a more elegant way of checking for
a gap within Biopython. See the Alphabet modules.

Hope this helped,

Iddo


On Thu, 4 Oct 2001, Anders Lundmark wrote:

: Hi,
:
: Given the column position in an alignment object,
: how do I easiest get the corresponding nucleotide
: position in one of the sequence members?
:
:  Regards,
:
: Anders Lundmark
:
: _______________________________________________
: BioPython mailing list-  BioPython@biopython.org
: http://biopython.org/mailman/listinfo/biopython
:

--

Iddo Friedberg                                  | Tel: +972-2-6757374
Dept. of Molecular Genetics and Biotechnology   | Fax: +972-2-6757308
The Hebrew University - Hadassah Medical School | email: idoerg@cc.huji.ac.il
POB 12272, Jerusalem 91120                      |
Israel                                          |
http://bioinfo.md.huji.ac.il/marg/people-home/iddo/