etal / cnvkit

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

Runtime error while running batch process #777

Open HeejunJang opened 1 year ago

HeejunJang commented 1 year ago

Hello,

I ran cnvkit on conda environment.

Here's my command

cnvkit.py batch $INPUT/$i".recal.bam" -n \ --targets $REF/bed/snuh_nicu_sort.bed \ --fasta $REF/hg19/hg19_1-22-X-Y-M.fa \ --access $CNVKIT/data/access-5k-mappable.hg19.bed \ --output-reference $FINAL/$i".cnn" \ --output-dir $FINAL

Here's error message

Segmenting /work/hjjang/CNV/result/G2102301_S16/G2102301_S16.cnr ... Segmenting with method 'cbs', significance threshold 0.0001, in 1 processes Traceback (most recent call last): File "/usr/bin/anaconda3/envs/cnvkit/bin/cnvkit.py", line 9, in args.func(args) File "/usr/bin/anaconda3/envs/cnvkit/lib/python3.10/site-packages/cnvlib/commands.py", line 138, in _cmd_batch pool.submit(batch.batch_run_sample, File "/usr/bin/anaconda3/envs/cnvkit/lib/python3.10/site-packages/cnvlib/parallel.py", line 19, in submit return SerialFuture(func(args)) File "/usr/bin/anaconda3/envs/cnvkit/lib/python3.10/site-packages/cnvlib/batch.py", line 186, in batch_run_sample segments = segmentation.do_segmentation(cnarr, segment_method, File "/usr/bin/anaconda3/envs/cnvkit/lib/python3.10/site-packages/cnvlib/segmentation/init.py", line 61, in do_segmentation rets = list(pool.map(_ds, ((ca, method, threshold, variants, File "/usr/bin/anaconda3/envs/cnvkit/lib/python3.10/site-packages/cnvlib/segmentation/init.py", line 89, in _ds return _do_segmentation(args) File "/usr/bin/anaconda3/envs/cnvkit/lib/python3.10/site-packages/cnvlib/segmentation/init.py", line 161, in _do_segmentation seg_out = core.call_quiet(rscript_path, File "/usr/bin/anaconda3/envs/cnvkit/lib/python3.10/site-packages/cnvlib/core.py", line 31, in call_quiet raise RuntimeError("Subprocess command failed:\n$ %s\n\n%s" RuntimeError: Subprocess command failed: $ Rscript --no-restore --no-environ /tmp/tmpxkmadfym

It seems there's a crush with Rscript.

thank you

Heejun Jang

looxon93 commented 1 year ago

Hi all, I am having the same issue as Heejun, running cnvkit.py batch is finishing, but not creating CNS files, however when I run cnvkit.py segment it returns:

/usr/local/lib/python3.10/site-packages/skgenome/intersect.py:11: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead. from pandas import Int64Index Segmenting with method 'cbs', significance threshold 0.0001, in 32 processes Smoothing overshot at 3 / 44841 indices: (-25.845103968660847, 1.141367320514) vs. original (-24.575, 1.47077) Smoothing overshot at 1 / 20746 indices: (-20.548024278245236, 1.3432732462933983) vs. original (-24.1506, 1.02317) Smoothing overshot at 1 / 18798 indices: (-19.14285562618283, 1.273973952972324) vs. original (-24.0673, 1.18271) concurrent.futures.process._RemoteTraceback: """ Traceback (most recent call last): File "/usr/local/lib/python3.10/concurrent/futures/process.py", line 246, in _process_worker r = call_item.fn(*call_item.args, *call_item.kwargs) File "/usr/local/lib/python3.10/concurrent/futures/process.py", line 205, in _process_chunk return [fn(args) for args in chunk] File "/usr/local/lib/python3.10/concurrent/futures/process.py", line 205, in return [fn(args) for args in chunk] File "/usr/local/lib/python3.10/site-packages/cnvlib/segmentation/init.py", line 89, in _ds return _do_segmentation(args) File "/usr/local/lib/python3.10/site-packages/cnvlib/segmentation/init.py", line 161, in _do_segmentation seg_out = core.call_quiet(rscript_path, File "/usr/local/lib/python3.10/site-packages/cnvlib/core.py", line 31, in call_quiet raise RuntimeError("Subprocess command failed:\n$ %s\n\n%s" RuntimeError: Subprocess command failed: $ Rscript --no-restore --no-environ /tmp/tmpk0e8yxfp

b'Error in library("DNAcopy") : there is no package called \xe2\x80\x98DNAcopy\xe2\x80\x99\nExecution halted\n' """

I checked if DNAcopy is installed with the suggestion from another post and it seems that everything is installed fine:

Rscript --help
Usage: Rscript [options] file [args]
   or: Rscript [options] -e expr [-e expr2 ...] [args]
A binary front-end to R, for use in scripting applications.

Options:
  --help              Print usage and exit
  --version           Print version and exit
  --verbose           Print information on progress
  --default-packages=LIST  Attach these packages on startup;
                        a comma-separated LIST of package names, or 'NULL'
and options to R (in addition to --no-echo --no-restore), for example:
  --save              Do save workspace at the end of the session
  --no-environ        Don't read the site and user environment files
  --no-site-file      Don't read the site-wide Rprofile
  --no-init-file      Don't read the user R profile
  --restore           Do restore previously saved objects at startup
  --vanilla           Combine --no-save, --no-restore, --no-site-file,
                        --no-init-file and --no-environ

Expressions (one or more '-e <expr>') may be used *instead* of 'file'.
Any additional 'args' can be accessed from R via 'commandArgs(TRUE)'.
See also  ?Rscript  from within R.
Rscript -e 'require(DNAcopy)'
Loading required package: DNAcopy

Any idea what is going on?

tetedange13 commented 1 year ago

Hi @HeejunJang,

I ran cnvkit on conda environment.

Did you follow guidelines I previously gave you to correctly install CNVkit with conda ? (new fresh dedicated env for CNVkit)
Hi @looxon93, are you facing this error after installing CNVkit through conda too ?
By any chance are you both facing this error if you specify --rscript-path parameter as I suggested in the 2nd part of my answer ?
Hope this helps ! Have a nice day, Felix.

looxon93 commented 1 year ago

Hi @tetedange13 and @HeejunJang, I resolved the issue with downgrading python from 3.10 to 3.9 and R version from 4.2.2 to 4.1.1. I am attaching Dockerfile which worked fine for me. I tested it and it created all outputs as expected. It has txt extension for github compliance.

Dockerfile.txt

HeejunJang commented 1 year ago

Hello @tetedange13

I followed all your latest guidelines

and used --Rscript-path option

PermissionError: [Errno 13] Permission denied: '/usr/bin/anaconda3/envs/cnvkit/lib'

It seems cnvkit can't access my R path

thank you.

HeejunJang commented 1 year ago

Hi @tetedange13 and @HeejunJang, I resolved the issue with downgrading python from 3.10 to 3.9 and R version from 4.2.2 to 4.1.1. I am attaching Dockerfile which worked fine for me. I tested it and it created all outputs as expected. It has txt extension for github compliance.

Dockerfile.txt

Hello, looxon93

I changed my environment Python 3.9 and R 4.1.1, But same error occured.

Thank you.

28rietd commented 1 year ago

@HeejunJang I ran into similar problems. See my suggested solution here: https://github.com/etal/cnvkit/issues/765#issuecomment-1363743810