Why weblogo of biopython doesn't work?
0
1
Entering edit mode
2.3 years ago
Plus ▴ 20

Hello, I have a question about Weblogo in the Biopython motif.

Recently, I'm analyzing sequence data using biopython. I use example code to draw weblogo.

Using biopython, I can finally find motifs from DNA and amino acid sequence. It worked, but the error occurred in weblogo.

from Bio.motifs import Motif
from Bio import motifs
from Bio.Seq import Seq

instances = [Seq('TTGGACC'),
            Seq('AACCTTA'),
            Seq('GCATTCA'),
            Seq('CCATGAG'),
            Seq('TAGGGAC'),
            Seq('TTGGTTA'),
            Seq('TGGGAGC')]

m = motifs.create(instances)
print(m.counts)
Motif.weblogo(m, 'test.png')

Even if the length of the sequence is longer or shorter than the sequence which I write in this code, the file size of test.png is 25kb and there is no weblogo.

And I want to upload the test.png result file, but it is impossible to upload because the biostars page said 'image: Upload a valid image. The file you uploaded was either not an image or a corrupted image.'

I think that the result image file would be corrupted, but I don't know how to fix it.

Can anybody figure out this problem?

Biopython Weblogo • 2.9k views
ADD COMMENT
0
Entering edit mode

The weblogo module uses the web version of weblogo service and it seems the module is not working as intended. Instead of returning an image, the module is returning an HTML page (check output of file test.png). You can try the standalone version of Weblogo.

ADD REPLY
1
Entering edit mode

Yes. I can try the web version of WebLogo, but I just want to know what kind of problem can induce to make a corrupted file by using Motif.weblogo.

I also change the code to return an HTML page like SVG format, but there was the same problem.

'error on line 43 at column 8: Opening and ending tag mismatch: link line 38 and head'

'WebLogo 3 - Create WebLogo Create Layout Template .error { color: #900; border-left: red solid +4pt; } .err_msg { color: #900; } .err_msg .btn { color: #000; }'

Anyway, thank you give me an opinion of yours for me.

ADD REPLY
1
Entering edit mode

The Motif.weblogo module uses the web API of weblogo website and due to some website changes, the function cannot upload the correct set of data. This resulted in the creation of an invalid png file. If you check the image file with the file command in Unix/Linux systems it will return the file type as HTML.

ADD REPLY
1
Entering edit mode

In the current version of Biopython (https://github.com/biopython/biopython) the issue with weblogo has been fixed and will be released in version 1.80.

ADD REPLY
0
Entering edit mode

If you are using other software in the modern Python realm, you may want to check out Logomaker by Tareen and Kinney. It was built with integration and flexibility in mind.

ADD REPLY
0
Entering edit mode

The weblogo3 application is giving same file even if u run the scripts separately on python standalone or whatever. The weblogo command is returning a file of size 20.49 kb always even if u set the options

ADD REPLY

Login before adding your answer.

Traffic: 2597 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