Question: Create a WebLogo with gapped sequences using Biopython
0
gravatar for makuba
2.8 years ago by
makuba0
makuba0 wrote:

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 biopython alignment • 1.5k views
ADD COMMENTlink modified 2.7 years ago • written 2.8 years ago by makuba0

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 REPLYlink modified 2.8 years ago • written 2.8 years ago by makuba0
1
gravatar for makuba
2.7 years ago by
makuba0
makuba0 wrote:

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

ADD COMMENTlink written 2.7 years ago by makuba0
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: 641 users visited in the last hour