etal / cnvkit

Copy number variant detection from targeted DNA sequencing
http://cnvkit.readthedocs.org
Other
547 stars 165 forks source link

Error traceback python #583

Open Bettariccardo opened 3 years ago

Bettariccardo commented 3 years ago

Hello i'm using CNVkit V 0.9.6.0 to analyze CNV in WGS. My samples are 5 normals and 5 tumorals sorted .bams. Im using this script for the batch mode:

cnvkit.py batch -m wgs -f /dataset/reference_genome/human/hg38/genome.fa --annotate /home/riccardo.betta/PTCL/cnvkit_data/refFlat.txt -d /home/riccardo.betta/PTCL/cnvkit_data/results/ --scatter --diagram /home/riccardo.betta/PTCL/cnvkit_data/PTCL_05_srt.bam /home/riccardo.betta/PTCL/cnvkit_data/PTCL_08_srt.bam /home/riccardo.betta/PTCL/cnvkit_data/PTCL_13_srt.bam /home/riccardo.betta/PTCL/cnvkit_data/cnvkit/PTCL_16_srt.bam /mnt/data/cnvkit/PTCL_19_srt.bam \ -n /home/riccardo.betta/PTCL/cnvkit_data/PTCL_NORM_05_srt.bam /home/riccardo.betta/PTCL/cnvkit_data/PTCL_NORM_08_srt.bam /home/riccardo.betta/PTCL/cnvkit_data/PTCL_NORM_13_srt.bam /home/riccardo.betta/PTCL/cnvkit_data/PTCL_NORM_16_srt.bam /home/riccardo.betta/PTCL/cnvkit_data/PTCL_NORM_19_srt.bam \

After the construction of the .bed file, the program crash and i recive a clear exit code 1 and this is the report of the crash

Wrote genome.bed with 249 regions Traceback (most recent call last): File "/opt/tools/conda/envs/cna/bin/cnvkit.py", line 13, in args.func(args) File "/opt/tools/conda/envs/cna/lib/python2.7/site-packages/cnvlib/commands.py", line 113, in _cmd_batch args.count_reads, args.method) File "/opt/tools/conda/envs/cna/lib/python2.7/site-packages/cnvlib/batch.py", line 72, in batch_make_reference bam_fname = autobin.midsize_file(normal_bams) File "/opt/tools/conda/envs/cna/lib/python2.7/site-packages/cnvlib/autobin.py", line 21, in midsize_file return sorted(fnames, key=lambda f: os.stat(f).st_size File "/opt/tools/conda/envs/cna/lib/python2.7/site-packages/cnvlib/autobin.py", line 21, in return sorted(fnames, key=lambda f: os.stat(f).st_size OSError: [Errno 2] No such file or directory: ' '

Is the error linked to my script (or files) or to the installation of cnvkit on my machine?

Looks to me that im missing some package/functions in my conda evironment, but im not sure. My files are low depth, like 4x or 6x, maybe i have to set a particular bin for this type of files. Any help is appreciated :)

Thanks in advance

Riccardo

tetedange13 commented 3 years ago

Hi @Bettariccardo,
Not an author of CNVkit, but it looks like nothing's wrong with your conda env !

During batch, the substep of autobin is trying to take the median-sized BAM from the list of files you gave and fail to find one of them => Try to check if every filename/path you gave in your script is correct? Could be a BAM that really does not exist or just a typo error ?

If you are a bit familiar with Python, you can also open this file "/opt/tools/conda/envs/cna/lib/python2.7/site-packages/cnvlib/autobin.py" in your favorite text editor and add print(f) right above the culprit line 21 => Re-run your script and, you will see what filename Python tried to evaluate and failed to find (just before raising the error).
Hope this helps. Have a nice day. Felix.

Bettariccardo commented 3 years ago

Hi

Thanks for your support. I found out that i had to put -m wgs before the .bams files. And after that i found out that i had a double directory, like cnvkit/cnvkit/samples that dosn’t exist, like you said 😊

That trick in pyhton seems really helpfull to find what made angry the autobin function. Do you know if i can print also other filenames?

Thank you very much Felix!!!!!

Have a nice day too 😊

Riccardo

Inviato da Posta per Windows 10

Da: tetedange13 Inviato: venerdì 26 marzo 2021 11:35 A: etal/cnvkit Cc: Riccardo Betta; Mention Oggetto: Re: [etal/cnvkit] Error traceback python (#583)

Hi @Bettariccardo,

Not an author of CNVkit, but it looks like nothing's wrong with your conda env ! During batch, the substep of autobin is trying to take the median-sized BAM from the list of files you gave and fail to find one of them => Try to check if every filename/path you gave in your script is correct? Could be a BAM that really does not exist or just a typo error ? If you are a bit familiar with Python, you can also open this file "/opt/tools/conda/envs/cna/lib/python2.7/site-packages/cnvlib/autobin.py" in your favorite text editor and add print(f) right above the culprit line 21 => Re-run your script and, you will see what filename Python tried to evaluate and failed to find (just before raising the error)

Hope this helps. Have a nice day. Felix. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

tetedange13 commented 3 years ago

Hi @Bettariccardo,

I am not sure what your question is ! I don't see your interest in printing every filename within the script => Do you mean to print them to be sure that they all exist? (correct path and filename) => If YES, the simplest way is to use BASH, rather than Python I guess ? => Something like:

for a_file in /home/riccardo.betta/PTCL/cnvkit_data/*bam ; do echo $a_file ; test -f $a_file && echo "File exists" ; echo ; done

But this is a bit beyond the scope of this issue and you will surely have a better BASH answer asking Google ^^ Have a nice day. Felix.

tskir commented 3 years ago

@tetedange13 Thanks a lot for stepping in!

@Bettariccardo After the fixes, is everything working for you? And if this is the case, could you close the issue please?