ay-lab / mustache

Multi-scale Detection of Chromatin Loops from Hi-C and Micro-C Maps using Scale-Space Representation
MIT License
64 stars 11 forks source link

Mustache crashes on chrY using mcool files (cool files are fine now!) #19

Closed mblanche closed 3 years ago

mblanche commented 3 years ago

Real sorry, keep finding small bugs... I guess you'll need to make the changes you made for the cool file also work for mcool file

Problem Mustache crashes with IndexError: list index out of range error when processing chrY in .mcool file (similar to the previous issue #17 )

How to reproduce it: Download test data set and pull latest docker image:

wget https://dovetail-public.s3-us-west-2.amazonaws.com/publicData/mustacheEx/test_small.mcool
docker pull mblanche/mustache

Run mustache 1.1.2 from Docker image:

docker run -i -v ${PWD}:/mnt mblanche/mustache mustache -p 24 -f /mnt/test_small.mcool -o test.tsv -ch chrY -r 1000

Error Produced:

The distance limit is set to 2000000bp
Reading contact map...
0 4000000
2000000 6000000
4000000 8000000
6000000 10000000
8000000 12000000
10000000 14000000
12000000 16000000
14000000 18000000
16000000 20000000
18000000 22000000
20000000 24000000
22000000 26000000
24000000 28000000
26000000 30000000
28000000 32000000
30000000 34000000
32000000 36000000
34000000 38000000
36000000 40000000
38000000 42000000
40000000 44000000
42000000 46000000
44000000 48000000
46000000 50000000
48000000 52000000
50000000 54000000
52000000 56000000
54000000 57227414
Traceback (most recent call last):
  File "/usr/local/bin/mustache", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/mustache/mustache.py", line 1112, in main
    o = regulator(f, args.norm_method, args.cooler_do_balance, CHRM_SIZE, args.outdir,
  File "/usr/local/lib/python3.8/dist-packages/mustache/mustache.py", line 930, in regulator
    x, y, v = read_mcooler(f, distance_in_bp, chromosome,chromosome2, res, cooler_do_balance)
  File "/usr/local/lib/python3.8/dist-packages/mustache/mustache.py", line 623, in read_mcooler
    x = np.array(result[0])
IndexError: list index out of range

Expected behavior: Mustache should complete with exit 0 producing a .tsv file with loops or only header if no loops are found

ay-lab commented 3 years ago

Sorry for the inconvenience. Now, it runs for .mcool and generates an empty file with header. Again, if you want to run mustache on all chromosomes you just need to write something like this:

python ./mustache/mustache.py -f ./data.cool --pThreshold 0.1 -o out.loop -r 1000 -st 0.8

mblanche commented 3 years ago

I’m really sorry… just tested v1.1.3 on .mcool files. Thanks a lot, It does run through all chromosomes.

However, no file is produced if no loops are found.

On Apr 26, 2021, at 5:12 PM, ay-lab @.***> wrote:

Sorry for the inconvenience. Now, it runs for .mcool and generates an empty file with header. Again, if you want to run mustache for all chromosomes you just need to write something like this:

python ./mustache/mustache.py -f ./data.cool --pThreshold 0.1 -o out.loop -r 1000 -st 0.8

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ay-lab commented 3 years ago

Weird, it generates an empty output file (with just the header) for me! I tested it on test_small.cool and test_small.mcool.

mblanche commented 3 years ago

Weird… Let me test it again and make sure all is good with my docker image. I’ll open a new ticket with details if not…

On Apr 26, 2021, at 6:35 PM, ay-lab @.***> wrote:

Weird, it generates an empty output file (with just the header) for me! I tested it on test_small.cool and test_small.mcool.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

mblanche commented 3 years ago

Ok, real sorry about that last one... My fault. I was forgetting that I was running the job in the container at the root dir... take a look now!

Running mustache testing for the creation of test.tsv Command:

docker run -i -v ${PWD}:/mnt mblanche/mustache:1.1.3 mustache -p 24 -f /mnt/test_small.mcool -o test.tsv -ch chr1 -r 1000 &>/dev/null && \
if [[ -f test.tsv ]];then echo 'Hooray!!! found test.tsv';else echo 'Darn... Still missing test.tsv'; fi

Result:

Hooray!!! found test.tsv

Expected outcome To return a joyful message that the lost file is finally found!

Thanks a bunch for all your help and really fast answer! I'm building a very large NextFlow workflow for our production to submit to AWS Batch, and this was essential!

Best

Marco

ay-lab commented 3 years ago

No problem, glad it finally worked.