Create a WebLogo with gapped sequences using Biopython
2
0
Entering edit mode
7.8 years ago
makuba • 0

Hello everybody ! The idea of my program is as follows : I use clustalOmega to create a multiple sequence alignment saved in a fasta file. Then I would like to create a sequence logo with WebLogo using Biopython. The thing is that my sequences look like this now : "----TTTAT-", so I have to use the alphabet Gapped(IUPAC.unambiguous_dna) for motifs.create (if not, there's a KeyError : '-'). My problem is that afterwards, when I try to launch WebLogo, I get an Error : Exception : Unknown Alphabet. I tried to run the same fasta file on the WebLogo server without using Biopython, everything went just fine. This is the code I use : `nameLogo="sqc_logo" fichier=ReadFastaMul(target) for i in range (0,len(fichier)): instances.append(fichier[i][1]) print (instances) instances_f=motifs.create(instances,alphabet=Gapped(IUPAC.unambiguous_dna)) print (instances_f)

instances_f.weblogo(nameLogo) ReadFastaMul reads a fasta file and generates a list of tuples (name, sequence). I've already used it in several occasions, so I'm rather sure this is not the problem. (I've also tried to run the code defining instances myself, with something likeinstances=['---TTTAAGA-', '--TTTTTAAG-', '----TTTAAG-']` and I've ended up stuck for the same reasons). If I try everything with ungapped sequences, it works out fine, so weblogo seems to work for these. It's my first time using Biopython. I have not installed Clustal on my computer yet, so I use a file I've aligned with their online service. I use Python 2.7 and Biopython 1.6.7 with OS X 10.11.5. Thanks a lot for any help I may get !

RNA-Seq alignment Biopython • 3.3k views
ADD COMMENT
0
Entering edit mode

I'm really sorry, the code didn't print well, so I'll try again :

nameLogo="logo"+str(i)+".png"
fichier=ReadFastaMul(target)
for i in range (0,len(fichier)):
    instances.append(fichier[i][1])
print (instances)
instances_f=motifs.create(instances,alphabet=Gapped(IUPAC.unambiguous_dna))
print (instances_f)
instances_f.weblogo(nameLogo)
ADD REPLY
1
Entering edit mode
7.7 years ago
makuba • 0

Got it : replace "-" by "N" and use IUPAC.ambiguousDNA in stead of Gapped(IUPAC.unambiguousDNA), then it works perfectly.

ADD COMMENT

Login before adding your answer.

Traffic: 2279 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6