flatironinstitute / inferelator-prior

Gene regulatory network inference using DNA-binding motifs and chromatin accessibility data.
MIT License
9 stars 3 forks source link

Issue when running pwm-to_meme #7

Closed ngaitan55 closed 2 years ago

ngaitan55 commented 2 years ago

Hello!

I am trying to run this software to obtain the prior matrix for rice. The issue I have is when converting the PWM files from Cis-BP to meme format. I tried to run it with the rice data and the S.cerevisiae data and none of them worked. Here is the command that i ran:

python -m inferelator_prior.pwm_to_meme -m pwms_all_motifs/* -i TF_Information_all_motifs.txt -o Sc2.cisbp.meme

For the example data. Alternatively, I tried:

python -m inferelator_prior.pwm_to_meme -m pwms_all_motifs/* -i TF_Information_all_motifs.txt -o Sc2.cisbp.meme --indirect --pwm_no_header --pwm_alphabet ALPHABET --pwm_transpose

And I have got the same result. Here is the output:

Parsing 1440 PWM files
1440 PWM files not found in in Motif_ID of TF_Information_all_motifs.txt
Parsed 0 motifs, writing to file Sc2.cisbp.meme
Traceback (most recent call last):
  File "/home/ngaitan55/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/ngaitan55/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/ngaitan55/Documents/trabajo/rice_internode_project/regulatory_network/inferelator_prior/inferelator-prior/inferelator_prior/pwm_to_meme.py", line 46, in <module>
    main()
  File "/home/ngaitan55/Documents/trabajo/rice_internode_project/regulatory_network/inferelator_prior/inferelator-prior/inferelator_prior/pwm_to_meme.py", line 28, in main
    pwm_to_meme(files, args.info, args.out, direct=args.direct, no_headers=args.pwm_no_header, alphabet=args.alphabet,
  File "/home/ngaitan55/Documents/trabajo/rice_internode_project/regulatory_network/inferelator_prior/inferelator-prior/inferelator_prior/pwm_to_meme.py", line 42, in pwm_to_meme
    write(output_file, list(motifs))
  File "/home/ngaitan55/Documents/trabajo/rice_internode_project/regulatory_network/inferelator_prior/inferelator-prior/inferelator_prior/motifs/meme.py", line 42, in write
    alphabet = alphabet if alphabet is not None else motifs[0].alphabet
IndexError: list index out of range

I used grep to check for all the names of the motif files in the info file and it does find them. I think it may have to do with pattern matching in the software or something similar. I would be very thankful if you could help me with this issue in order to run it successfully.

asistradition commented 2 years ago

Apologies, this was an error matching up the motif files to the metadata file. It's been corrected in bb6b7005a5f624dab5ac781e50e30e3bc8ed855b and released to pypi as v0.3.2.

Running with the currrent CisBP Orzya sativa motifs should now work without a problem:

python -m inferelator_prior.pwm_to_meme -m pwms_all_motifs/* -i TF_Information_all_motifs.txt -o Oryza_sativa.cisbp.meme --indirect 

Parsing 1557 PWM files
36 PWM files not found in in Motif_ID of TF_Information_all_motifs.txt
232 PWM files malformed and improperly parsed
Parsed 1289 motifs, writing to file Oryza_sativa.cisbp.meme