loosolab / TF-COMB

Transcription Factor Co-Occurrence using Market Basket analysis
https://tf-comb.readthedocs.io
MIT License
10 stars 1 forks source link

AttributeError: 'OneMotif' object has no attribute 'get_pssmm' #62

Open VenkateshLab opened 1 year ago

VenkateshLab commented 1 year ago

Hi, I was working on mice E16 scATAC seq data. the raw data were downloaded from encode project, the motif data was downloaded from jaspar in a text file.

python
>>> import os
>>> os.getcwd()
'/media/volume/sdf/Manoj/test_tfcomb/Data'
>>> import tfcomb
>>> C = tfcomb.CombObj()
>>> C.TFBS_from_motifs(regions="E16.bed", motifs= "Motif.txt", genome="MM10.fa", threads=4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/exouser/miniconda3/envs/tfcomb_env/lib/python3.7/site-packages/tfcomb/objects.py", line 415, in TFBS_from_motifs
    motifs = tfcomb.utils.prepare_motifs(motifs_f, motif_pvalue, motif_naming)
  File "/home/exouser/miniconda3/envs/tfcomb_env/lib/python3.7/site-packages/tfcomb/utils.py", line 1603, in prepare_motifs
    _ = [motif.get_threshold(motif_pvalue) for motif in motifs_obj]
  File "/home/exouser/miniconda3/envs/tfcomb_env/lib/python3.7/site-packages/tfcomb/utils.py", line 1603, in <listcomp>
    _ = [motif.get_threshold(motif_pvalue) for motif in motifs_obj]
  File "/home/exouser/miniconda3/envs/tfcomb_env/lib/python3.7/site-packages/tobias/utils/motifs.py", line 270, in get_threshold
    self.get_pssmm()
AttributeError: 'OneMotif' object has no attribute 'get_pssmm'
>>> tfcomb.__version__
'1.0.3'

also i have enclosed the my motif.txt file for your reference. Motif.txt

Screenshot 2023-04-27 at 18 53 52

msbentsen commented 1 year ago

Hi @VenkateshLab,

Sorry for this issue - it looks like the error is coming from an older version of tobias, which is a requirement for tfcomb. Can you update tobias to at least tobias>=11.0? for example with: pip install tobias --upgrade

This will also be included in the next version of TF-COMB. Let us know if this works out, thank you!

VenkateshLab commented 1 year ago

@msbentsen thanks thats helps me to solve the issue on motif object, now while trying to get the Genomic locations of TF-TF pairs. i come with an error called I have enclosed the screenshot for the detailed error. I have 128GB of RAM with 1TB storage space free also i have 32 core process, while reading about the error online they are asking me to clean up my memory. can you help me up to solve this issue. because i can run identidfy the pair of TF but now i want to know their Genomic locations

pairs = C.get_pair_locations((TF1, TF2))
double free or corruption (!prev)
285037 IOT instruction  python

Command i used

python
import tfcomb
C = tfcomb.CombObj()
C.TFBS_from_motifs(regions="E16.bed", motifs= "Motif.txt", genome="MM10.fa", threads=30)
C.market_basket(threads=30)
C.rules.head() #helps me to identify the different TF's
TF1, TF2 = C.rules.iloc[0, [0,1]]
pairs = C.get_pair_locations((TF1, TF2))
double free or corruption (!prev)
[1]    285037 IOT instruction  python

Screenshot 2023-04-28 at 10 21 21

msbentsen commented 1 year ago

Hi @VenkateshLab,

Thank you for the screenshot. With ~100.000 and ~300.000 regions, it might be that the number of combinations indeed takes up a lot of memory (but it should not take up 128GB RAM).

Can you try with a smaller example, for example limit the number of regions in E16.bed and see if that runs? That might help to debug what type of error this is.

VenkateshLab commented 1 year ago

@msbentsen i have reduced my bed file im getting the same error

>>> pairs = C.get_pair_locations((TF1, TF2))
double free or corruption (!prev)
[1]    345155 IOT instruction  python

for your reference i have enloced my bed file for your reference. I have enclosed the raw E16 bed file along with the extracted bed file. please rename the text file into bed. E16_S.txt E16.txt

msbentsen commented 1 year ago

Hi @VenkateshLab ,

Thank you for sending the files. I discovered a bug in the function, so your commands were correct and it was not a RAM issue. I fixed it now on the TF-COMB@dev branch, so you can fetch the new version using:

pip install git+https://github.com/loosolab/TF-COMB@dev

The version should then show as:

import tfcomb
tfcomb.__version__
>>> '1.0.4-b'

It will be included in version 1.0.4 in the future, but we like to collect a few fixes before releasing the final version. Let me know if that fixes the issue, thank you!

PS. I don't know if you noticed, but your .bed-files contain a lot of duplicate regions like for example: image It might be beneficial to merge these in order to not count them twice, for example using bedtools merge.