Problems going from biopython motif to logo
1
0
Entering edit mode
11 months ago
Emilio • 0

Hello,

I'm trying to go from Bio.motif elements into logos and the available resources haven't solved my particular problem.

The motif.weblogo() function doesn't seem to be working. There's a previous issue asking about it, and I have the same problem, but none of the answers work for me. I updated biopython to 1.81 and it still doesn't work even though the problem was supposed to be solved by 1.80.

I also checked Logomaker, which is a great tool but I need a dataframe object for the motif, and I don't know how to go from a Bio.motif element to that format. I only have access to a position counts matrix, not a list of sequences, so I can't just output the sequences and use that as a dataframe.

Is there any more direct method to solve this issue?

Thanks in advance

logo biopython motif • 653 views
ADD COMMENT
0
Entering edit mode

do you have a reproducible example to work with?

ADD REPLY
0
Entering edit mode

Hi! This is an old problem I ended up solving, but I don't remember the things I had tried that failed.

I downloaded a set of counts matrixes from HOCOMOCO (e.g. NKX2-5), opened them in Python with

m_list = motifs.parse(open(file.pcm), 'pfm-four-columns')
m = m_list[0]

and tried to get from that counts matrix to a LOGO visualization.

I ended up putting it into a Pandas (pd) data frame with

m_df = pd.DataFrame(m.counts) 

and parsing that with Logomaker (lm) using

lm_info = lm.transform_matrix(m_df, from_type='counts', to_type='information')

That seemed to work fine. I think my problem was not using data frames and trying to make it work with Python lists.

ADD REPLY
1
Entering edit mode
3 months ago
Emilio • 0

This is an old (and solved) issue. I'll add an answer to mark it as solved.

I downloaded a set of counts matrixes from HOCOMOCO (e.g. NKX2-5), opened them in Python with

m_list = motifs.parse(open(file.pcm), 'pfm-four-columns')
m = m_list[0]

and tried to get from that counts matrix to a LOGO visualization.

I ended up putting it into a Pandas (pd) data frame with

m_df = pd.DataFrame(m.counts) 

and parsing that with Logomaker (lm) using

lm_info = lm.transform_matrix(m_df, from_type='counts', to_type='information')

Using lm.Logo(lm_info) seemed to work fine to visualize a LOGO.

Apparently, my problem was not using data frames and trying to make it work with Python lists.

ADD COMMENT

Login before adding your answer.

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