Question: can not get the alignment result from needle alignment
0
gravatar for Medhat
4.1 years ago by
Medhat8.6k
Texas
Medhat8.6k wrote:

I am using this script to compare to sequence and parse the result:

 

from Bio.Emboss.Applications import NeedleCommandline
from Bio import AlignIO

needle_cline = NeedleCommandline(asequence="a.fa",
                bsequence="b.fa",
                gapopen=10, gapextend=0.5, outfile="needle.txt")

filename= "needle.txt"
format = "emboss"


alignments = list(AlignIO.parse(filename, format))

 

when i try to print the results in the alignments list it gives me only part of the last line 

like that

 

SingleLetterAlphabet() alignment with 2 rows and 2258 columns
TTGATGAGTGGGCACCATGATTGCCCGACTGTTATTACCGTCAA...TCT ref
TGGATGAGTGGGCACCATGATTGCCCGACTGTTATTACCGTCAA...T-- corr

 

any Idea?

alignment sequence • 955 views
ADD COMMENTlink modified 4.1 years ago by Kamil2.0k • written 4.1 years ago by Medhat8.6k
0
gravatar for Kamil
4.1 years ago by
Kamil2.0k
Boston
Kamil2.0k wrote:

Consider checking the examples in the documentation for the MultipleSeqAlignment class returned by AlignIO.

I guess this might do what you want:

print alignments[:,:]
ADD COMMENTlink modified 18 days ago by RamRS25k • written 4.1 years ago by Kamil2.0k
1

I figured it I need to add another loop to get the sequence

for alignment in AlignIO.parse(filename, format):
    for sequence in alignment:
        print(sequence.seq)
ADD REPLYlink modified 18 days ago by RamRS25k • written 4.1 years ago by Medhat8.6k

I changed the method from parse to read like this

alignments = AlignIO.read(filename, format)
print alignments[:,:]

but, the result is the same

SingleLetterAlphabet() alignment with 2 rows and 2258 columns
TTGATGAGTGGGCACCATGATTGCCCGACTGTTATTACCGTCAA...TCT ref
TGGATGAGTGGGCACCATGATTGCCCGACTGTTATTACCGTCAA...T-- corr

any Idea?

ADD REPLYlink modified 18 days ago by RamRS25k • written 4.1 years ago by Medhat8.6k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1192 users visited in the last hour