Question: How To Generate A Motif Object Directly For A Count Matrix In Biopython
1
gravatar for cauyrd
7.1 years ago by
cauyrd20
cauyrd20 wrote:

If I have a variable in python like this:

pfm = {'A': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       'C': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       'G': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
       'T': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}

how to generate a Biopython Motif object from this variable directly other than save above matrix in a file and use Motif.read() to load the matrix into a Motif object.

biopython • 2.4k views
ADD COMMENTlink modified 4.9 years ago by svichkarev.anatoly10 • written 7.1 years ago by cauyrd20
1
gravatar for svichkarev.anatoly
4.9 years ago by
Russia/Novosibirsk/NSU
svichkarev.anatoly10 wrote:

You can use:

m = Motif(counts=pfm)
ADD COMMENTlink modified 4.9 years ago • written 4.9 years ago by svichkarev.anatoly10
0
gravatar for lelle
7.1 years ago by
lelle820
Berlin
lelle820 wrote:

As far as I can see there is no way to do this with a proper function of the Motif class. You could try to just do:

m = Motif()
m.counts = pfm
m.has_counts = True
m.set_mask("*"*m.length)

I did not test it and have no idea if there are any problems with the alphabet, but something along this lines could work.

ADD COMMENTlink written 7.1 years ago by lelle820
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: 1048 users visited in the last hour