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?
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 offile test.png
). You can try the standalone version of Weblogo.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.
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 invalidpng
file. If you check the image file with thefile
command in Unix/Linux systems it will return the file type asHTML
.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.
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.
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