What's STAMP? I'm trying to plot weblogo from count dictionary ie. {'A': [3, 7, 0, 2, 1], 'C': [0, 0, 5, 2, 6], 'G': [0, 0, 0, 3, 0], 'T': [4, 0, 2, 0, 0]}
I try to create some motif logos. Now I follow biopython example and write script like following, it works well when dataset is small, but fails for large dataset. And there are several web tools can create motif logo, but, still, they has input limitation. Any suggestions?
for motif in tot:
m = Motif.Motif(alphabet=IUPAC.unambiguous_dna)
for i in tot[motif]:
m.add_instance(Seq(i,m.alphabet))
print >>fao, m.format("transfac") #PWM
pic=motif+".png"
m.weblogo(pic) #logo
"tot" is a dictionary, "motif" are keys of "tot", which are different motif(such as "TANNTA") I am looking for, and key values are list, which have exact motif sequence as elements (["TATTTA","TAGGTA",.....]).
3 answers
hi Yunfei Li,
you can use the following tools to draw motif logos:
-
WebLogo: A Sequence Logo Generator: is a tool for creating sequence logos from biological sequence alignments. It can be run on the command line, as a standalone webserver, as a CGI webapp, or as a python library.
-

-
MoRAine is a tool for the reannotation of transcription factor binding motifs and the creation of sequence logos.
-
GENIO/logo: Positional dependent information contents of aligned RNA/DNA or amino acid sequences are useful for the display of consensus sequences and for finding optimal search windows used in sequence analysis.

-
CorreLogo: An online server for 3D sequence logos of RNA and DNA alignments
I hope this helps.
I also think about solutions during waiting for suggestions. This part can create PWM directly, then use STAMP to plot logo.
for key in tot:
#num report
print "motif: %s, count: %d" % (key, len(tot[key]))
#read in by postion
dic={}
for seq in tot[key]:
if re.search("N",seq): continue
for pos in range(len(seq)):
dic.setdefault(pos,[]).append(seq[pos])
#PWM
print >> fao, ">%s" % (key)
for pos in range(len(tot[key][0])):
posc={'A': 0,'C': 0,'G': 0,'T': 0}
dic[pos].sort()
tmp=[(x,len(list(y))) for x, y in groupby(dic[pos])]
for base,count in tmp:
posc[base]+=count
print >> fao, "%d %d %d %d" % (posc["A"],posc["C"],posc["G"],posc["T"])
print >> fao
Log in to answer this question.
