GavinHaLab / ichorCNA

Estimating tumor fraction in cell-free DNA from ultra-low-pass whole genome sequencing.
GNU General Public License v3.0
12 stars 10 forks source link

Broken CLI : runIchorCNA.R: line 50: Syntaxerror #14

Open sroener opened 1 year ago

sroener commented 1 year ago

Hi,

I have been updating my ichorCNA version and now I get the following error:

runIchorCNA.R: line 50: Syntaxerror at unexpected word `('
runIchorCNA.R: line 50: `run_ichorCNA <- function(tumor_wig, normal_wig = NULL, gcWig, mapWig, repTimeWig, normal_panel=NULL, sex = NULL, exons.bed=NULL, id = "test", '

This happens both with the full command or just with runIchorCNA.r --help.

Full command:

runIchorCNA.R --id test19_processed --WIG results/testrun/icorCNA/readcounts/test19_index_processed.hg19.wig \
--ploidy "c(2,3)" --normal "c(0.5,0.6,0.7,0.8,0.9)" --maxCN 5 \
--gcWig resources/ichorCNA/gc_hg19_1000kb.wig \
--mapWig resources/ichorCNA/map_hg19_1000kb.wig \
--centromere resources/ichorCNA/GRCh37.p13_centromere_UCSC-gapTable.txt \
--normalPanel resources/ichorCNA/HD_ULP_PoN_1Mb_median_normAutosome_mapScoreFiltered_median.rds \
--includeHOMD False \
--chrs 'c(1:22,"X")' \
 --chrTrain "c(1:22)" \
--estimateNormal True \
--estimatePloidy True \
--estimateScPrevalence True \
--scStates "c(1,3)" \
--txnE 0.9999 \
--txnStrength 10000 \
--plotFileType png \
--genomeBuild hg19 \
--genomeStyle UCSC \
--outDir results/testrun/icorCNA/test19_processed_hg19

ichorCNA was installed via bioconda:

name: ichorCNA
channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - r-ichorcna
  - hmmcopy

The final environment looks like this:

 - _libgcc_mutex=0.1=conda_forge                                                                                                                                                                            
  - _openmp_mutex=4.5=2_gnu                                                                                                                                                                                  
  - _r-mutex=1.0.1=anacondar_1                                                                                                                                                                               
  - argcomplete=3.0.6=pyhd8ed1ab_0                                                                                                                                                                           
  - binutils_impl_linux-64=2.40=hf600244_0                                                                                                                                                                   
  - bioconductor-biobase=2.58.0=r42hc0cfd56_0                                                                                                                                                                
  - bioconductor-biocgenerics=0.44.0=r42hdfd78af_0                                                                                                                                                           
  - bioconductor-biocio=1.8.0=r42hdfd78af_0                                                                                                                                                                  
  - bioconductor-biocparallel=1.32.5=r42hc247a5b_0                                                                                                                                                           
  - bioconductor-biostrings=2.66.0=r42hc0cfd56_0                                                                                                                                                             
  - bioconductor-bsgenome=1.66.3=r42hdfd78af_0                                                                                                                                                               
  - bioconductor-bsgenome.hsapiens.ucsc.hg19=1.4.3=r42hdfd78af_6                                                                                                                                             
  - bioconductor-bsgenome.hsapiens.ucsc.hg38=1.4.5=r42hdfd78af_0                                                                                                                                             
  - bioconductor-data-packages=20230420=hdfd78af_0                                                                                                                                                           
  - bioconductor-delayedarray=0.24.0=r42hc0cfd56_0                                                                                                                                                           
  - bioconductor-genomeinfodb=1.34.9=r42hdfd78af_0                                                                                                                                                           
  - bioconductor-genomeinfodbdata=1.2.9=r42hdfd78af_0                                                                                                                                                        
  - bioconductor-genomicalignments=1.34.0=r42hc0cfd56_0                                                                                                                                                      
  - bioconductor-genomicranges=1.50.0=r42hc0cfd56_0                                                                                                                                                          
  - bioconductor-hmmcopy=1.40.0=r42hc0cfd56_0                                                                                                                                                                
  - bioconductor-iranges=2.32.0=r42hc0cfd56_0                                                                                                                                                                
  - bioconductor-matrixgenerics=1.10.0=r42hdfd78af_0                                                                                                                                                         
  - bioconductor-rhtslib=2.0.0=r42hc0cfd56_0                                                                                                                                                                 
  - bioconductor-rsamtools=2.14.0=r42hc247a5b_0                                                                                                                                                              
  - bioconductor-rtracklayer=1.58.0=r42h171f361_1                                                                                                                                                            
  - bioconductor-s4vectors=0.36.0=r42hc0cfd56_0                                                                                                                                                              
  - bioconductor-summarizedexperiment=1.28.0=r42hdfd78af_0                                                                                                                                                   
  - bioconductor-xvector=0.38.0=r42hc0cfd56_0                                                                                                                                                                
  - bioconductor-zlibbioc=1.44.0=r42hc0cfd56_0                                                                                                                                                               
  - bowtie=1.0.0=1                                                                                                                                                                                           
  - bwidget=1.9.14=ha770c72_1                                                                                                                                                                                
  - bzip2=1.0.8=h7f98852_4                                                                                                                                                                                   
  - c-ares=1.18.1=h7f98852_0                                                                                                                                                                                 
  - ca-certificates=2022.12.7=ha878542_0                                                                                                                                                                     
  - cairo=1.16.0=ha61ee94_1014                                                                                                                                                                               
  - curl=7.87.0=h6312ad2_0                                                                                                                                                                                   
  - expat=2.5.0=hcb278e6_1                                                                                                                                                                                   
  - font-ttf-dejavu-sans-mono=2.37=hab24e00_0                                                                                                                                                                
  - font-ttf-inconsolata=3.000=h77eed37_0                                                                                                                                                                    
  - font-ttf-source-code-pro=2.038=h77eed37_0                                                                                                                                                                
  - font-ttf-ubuntu=0.83=hab24e00_0                                                                                                                                                                          
  - fontconfig=2.14.2=h14ed4e7_0                                                                                                                                                                             
  - fonts-conda-ecosystem=1=0                                                                                                                                                                                
  - fonts-conda-forge=1=0
  - freetype=2.12.1=hca18f0e_1
  - fribidi=1.0.10=h36c2ea0_0
  - gcc_impl_linux-64=12.2.0=hcc96c02_19
  - gettext=0.21.1=h27087fc_0
  - gfortran_impl_linux-64=12.2.0=h55be85b_19
  - graphite2=1.3.13=h58526e2_1001
  - gsl=2.7=he838d99_0
  - gxx_impl_linux-64=12.2.0=hcc96c02_19
  - harfbuzz=6.0.0=h8e241bc_0
  - hmmcopy=0.1.1=h5b5514e_8
  - icu=70.1=h27087fc_0
  - jpeg=9e=h0b41bf4_3
  - jq=1.6=h36c2ea0_1000
  - kernel-headers_linux-64=2.6.32=he073ed8_15
  - keyutils=1.6.1=h166bdaf_0
  - krb5=1.20.1=hf9c8cef_0
  - ld_impl_linux-64=2.40=h41732ed_0
  - lerc=4.0.0=h27087fc_0                                                                                                                                                                            
  - libblas=3.9.0=16_linux64_openblas                                                                                                                                                                        
  - libcblas=3.9.0=16_linux64_openblas                                                                                                                                                                       
  - libcurl=7.87.0=h6312ad2_0                                                                                                                                                                                
  - libdeflate=1.17=h0b41bf4_0                                                                                                                                                                               
  - libedit=3.1.20191231=he28a2e2_2                                                                                                                                                                          
  - libev=4.33=h516909a_1                                                                                                                                                                                    
  - libexpat=2.5.0=hcb278e6_1                                                                                                                                                                                
  - libffi=3.4.2=h7f98852_5                                                                                                                                                                                  
  - libgcc-devel_linux-64=12.2.0=h3b97bd3_19                                                                                                                                                                 
  - libgcc-ng=12.2.0=h65d4601_19                                                                                                                                                                             
  - libgfortran-ng=12.2.0=h69a702a_19                                                                                                                                                                        
  - libgfortran5=12.2.0=h337968e_19                                                                                                                                                                          
  - libglib=2.76.2=hebfc3b9_0                                                                                                                                                                                
  - libgomp=12.2.0=h65d4601_19                                                                                                                                                                               
  - libiconv=1.17=h166bdaf_0                                                                                                                                                                                 
  - liblapack=3.9.0=16_linux64_openblas                                                                                                                                                                      
  - libnghttp2=1.51.0=hdcd2b5c_0                                                                                                                                                                             
  - libnsl=2.0.0=h7f98852_0                                                                                                                                                                                  
  - libopenblas=0.3.21=pthreads_h78a6416_3                                                                                                                                                                   
  - libpng=1.6.39=h753d276_0                                                                                                                                                                                 
  - libsanitizer=12.2.0=h46fd767_19                                                                                                                                                                          
  - libsqlite=3.40.0=h753d276_1                                                                                                                                                                              
  - libssh2=1.10.0=haa6b8db_3                                                                                                                                                                                
  - libstdcxx-devel_linux-64=12.2.0=h3b97bd3_19                                                                                                                                                              
  - libstdcxx-ng=12.2.0=h46fd767_19                                                                                                                                                                          
  - libtiff=4.5.0=h6adf6a1_2                                                                                                                                                                                 
  - libuuid=2.38.1=h0b41bf4_0                                                                                                                                                                                
  - libwebp-base=1.3.0=h0b41bf4_0                                                                                                                                                                            
  - libxcb=1.13=h7f98852_1004                                                                                                                                                                                
  - libxml2=2.10.3=hca2bb57_4                                                                                                                                                                                
  - libzlib=1.2.13=h166bdaf_4                                                                                                                                                                                
  - make=4.3=hd18ef5c_1                                                                                                                                                                                      
  - ncurses=6.3=h27087fc_1                                                                                                                                                                                   
  - oniguruma=6.9.8=h166bdaf_0                                                                                                                                                                               
  - openssl=1.1.1t=h0b41bf4_0                                                                                                                                                                                
  - pango=1.50.14=hd33c08f_0                                                                                                                                                                                 
  - pcre2=10.40=hc3806b6_0                                                                                                                                                                                   
  - perl=5.32.1=2_h7f98852_perl5                                                                                                                                                                             
  - pip=23.1.1=pyhd8ed1ab_0
  - pixman=0.40.0=h36c2ea0_0                                                                                                                                                                         
  - pthread-stubs=0.4=h36c2ea0_1001                                                                                                                                                                          
  - python=3.11.0=h10a6764_1_cpython                                                                                                                                                                         
  - python_abi=3.11=3_cp311                                                                                                                                                                                  
  - pyyaml=6.0=py311hd4cff14_5                                                                                                                                                                               
  - r-base=4.2.2=ha7d60f8_3                                                                                                                                                                                  
  - r-bh=1.81.0_1=r42hc72bb7e_0                                                                                                                                                                              
  - r-bitops=1.0_7=r42h06615bd_1                                                                                                                                                                             
  - r-cli=3.6.1=r42h38f115c_0                                                                                                                                                                                
  - r-codetools=0.2_19=r42hc72bb7e_0                                                                                                                                                                         
  - r-colorspace=2.1_0=r42h133d619_0                                                                                                                                                                         
  - r-cpp11=0.4.3=r42hc72bb7e_0                                                                                                                                                                              
  - r-crayon=1.5.2=r42hc72bb7e_1                                                                                                                                                                             
  - r-data.table=1.14.8=r42h133d619_0                                                                                                                                                                        
  - r-domc=1.3.8=r42ha770c72_1                                                                                                                                                                               
  - r-ellipsis=0.3.2=r42h06615bd_1                                                                                                                                                                           
  - r-fansi=1.0.4=r42h133d619_0                                                                                                                                                                              
  - r-farver=2.1.1=r42h7525677_1                                                                                                                                                                             
  - r-foreach=1.5.2=r42hc72bb7e_1                                                                                                                                                                            
  - r-formatr=1.14=r42hc72bb7e_0                                                                                                                                                                             
  - r-futile.logger=1.4.3=r42hc72bb7e_1004                                                                                                                                                                   
  - r-futile.options=1.0.1=r42hc72bb7e_1003                                                                                                                                                                  
  - r-getopt=1.20.3=r42ha770c72_3                                                                                                                                                                            
  - r-ggplot2=3.4.2=r42hc72bb7e_0                                                                                                                                                                            
  - r-glue=1.6.2=r42h06615bd_1                                                                                                                                                                               
  - r-gtable=0.3.3=r42hc72bb7e_0                                                                                                                                                                             
  - r-ichorcna=0.5.0=pl5321r42hdfd78af_0                                                                                                                                                                     
  - r-isoband=0.2.7=r42h38f115c_1                                                                                                                                                                            
  - r-iterators=1.0.14=r42hc72bb7e_1                                                                                                                                                                         
  - r-labeling=0.4.2=r42hc72bb7e_2                                                                                                                                                                           
  - r-lambda.r=1.2.4=r42hc72bb7e_2                                                                                                                                                                           
  - r-lattice=0.21_8=r42h133d619_0                                                                                                                                                                           
  - r-lifecycle=1.0.3=r42hc72bb7e_1                                                                                                                                                                          
  - r-magrittr=2.0.3=r42h06615bd_1                                                                                                                                                                           
  - r-mass=7.3_59=r42h57805ef_0                                                                                                                                                                              
  - r-matrix=1.5_4=r42he1ae0d6_0                                                                                                                                                                             
  - r-matrixstats=0.63.0=r42h06615bd_0                                                                                                                                                                       
  - r-mgcv=1.8_42=r42he1ae0d6_0                                                                                                                                                                              
  - r-munsell=0.5.0=r42hc72bb7e_1005                                                                                                                                                                         
  - r-nlme=3.1_162=r42hac0b197_0      
  - r-optparse=1.7.3=r42hc72bb7e_1
  - r-pillar=1.9.0=r42hc72bb7e_0
  - r-pkgconfig=2.0.3=r42hc72bb7e_2
  - r-plyr=1.8.8=r42h7525677_0
  - r-r6=2.5.1=r42hc72bb7e_1
  - r-rcolorbrewer=1.1_3=r42h785f33e_1
  - r-rcpp=1.0.10=r42h38f115c_0
  - r-rcurl=1.98_1.10=r42h133d619_0
  - r-restfulr=0.0.15=r42h73dbb54_1
  - r-rjson=0.2.21=r42h7525677_2
  - r-rlang=1.1.0=r42h38f115c_0
  - r-scales=1.2.1=r42hc72bb7e_1
  - r-snow=0.4_4=r42hc72bb7e_1
  - r-stringi=1.7.12=r42h1ae9187_0
  - r-stringr=1.5.0=r42h785f33e_0
  - r-tibble=3.2.1=r42h133d619_1
  - r-utf8=1.2.3=r42h133d619_0
  - r-vctrs=0.6.2=r42ha503ecb_0
  - r-viridislite=0.4.1=r42hc72bb7e_1
  - r-withr=2.5.0=r42hc72bb7e_1
  - r-xml=3.99_0.14=r42hb43fdd4_0
  - r-yaml=2.3.7=r42h133d619_0
  - readline=8.2=h8228510_1
  - sed=4.8=he412f7d_0
  - setuptools=67.7.1=pyhd8ed1ab_0
  - sysroot_linux-64=2.12=he073ed8_15
  - tk=8.6.12=h27826a3_0
  - tktable=2.10=hb7b940f_3
  - toml=0.10.2=pyhd8ed1ab_0
  - tomlkit=0.11.7=pyha770c72_0
  - typing=3.10.0.0=pyhd8ed1ab_0
  - tzdata=2023c=h71feb2d_0
  - wheel=0.40.0=pyhd8ed1ab_0
  - xmltodict=0.13.0=pyhd8ed1ab_0
  - xorg-kbproto=1.0.7=h7f98852_1002
  - xorg-libice=1.0.10=h7f98852_0
  - xorg-libsm=1.2.3=hd9c2040_1000
  - xorg-libx11=1.8.4=h0b41bf4_0
  - xorg-libxau=1.0.9=h7f98852_0
  - xorg-libxdmcp=1.1.3=h7f98852_0
  - xorg-libxext=1.3.4=h0b41bf4_2
  - xorg-libxrender=0.9.10=h7f98852_1003
  - xorg-libxt=1.2.1=h7f98852_2
  - xorg-renderproto=0.11.1=h7f98852_1002
  - xorg-xextproto=7.3.0=h0b41bf4_1003
  - xorg-xproto=7.0.31=h7f98852_1007
  - xz=5.2.6=h166bdaf_0
  - yaml=0.2.5=h7f98852_2
  - yq=3.2.2=pyhd8ed1ab_0
  - zlib=1.2.13=h166bdaf_4
  - zstd=1.5.2=h3eb15da_6

Help would be appreciated!

IanCodes commented 1 year ago

I discovered this problem recently. I appears that the runIchorCNA.R file for v0.5.0 only contains the run_ichorCNA() function. This means it cannot be run using Rscript. I have tried using the script from v0.3.2.

ycl6 commented 1 year ago

Hi @sroener

With ichorCNA v0.5, the analysis need to be performed inside R using the run_ichorCNA function. Below is an example that I adapted from that you provided.

Also, you'll need to get a copy of the repTime wig from inst/extdata, e.g. Koren_repTiming_hg38_1000kb.wig that I used in the example.

ichorCNA::run_ichorCNA(id = "test19_processed", 
  tumor_wig = "results/testrun/icorCNA/readcounts/test19_index_processed.hg19.wig",
  gcWig = "resources/ichorCNA/gc_hg19_1000kb.wig", 
  mapWig = "resources/ichorCNA/map_hg19_1000kb.wig", 
  repTimeWig = "Koren_repTiming_hg38_1000kb.wig", # Get it from "inst/extdata"
  normal_panel = "resources/ichorCNA/HD_ULP_PoN_1Mb_median_normAutosome_mapScoreFiltered_median.rds",
  centromere = "resources/ichorCNA/GRCh37.p13_centromere_UCSC-gapTable.txt",
  ploidy = "c(2,3)",
  normal = "c(0.5,0.6,0.7,0.8,0.9)",
  maxCN = 5,
  scStates = "c(1,3)",
  chrs = 'c(1:22,"X")',     # default
  chrTrain = "c(1:22)",     # default
  estimateNormal = TRUE,    # default
  estimatePloidy = TRUE,    # default
  estimateScPrevalence = TRUE,  # default
  includeHOMD = FALSE,      # default
  txnE = 0.9999,
  txnStrength = 10000,
  plotFileType = "png",
  genomeBuild = "hg19",
  genomeStyle = "UCSC",
  outDir = "results/testrun/icorCNA/test19_processed_hg19", # Folder need to exist
)
sroener commented 1 year ago

Hi @ycl6

thank you for your answer.

Could you provide a little background on what Koren_repTiming_hg38_1000kb.wig does?

In the past I used ichorCNA in a pipeline using the runIchorCNA.r CLI in a rule for processing a huge amount of samples. As I think that providing CLIs and functional interfaces for end-to-end tools, I am wondering whether there is a particular reason for dropping the CLI?

ycl6 commented 12 months ago

Hi @sroener

repTiming takes a wig file that has replication timing data. Amnon Koren is a leading researcher of this field and you can see a figure on his website that illustrate how replication timing influences copy number along a chromosome during DNA replication. Like other CNA tools, correction for replication timing can be enabled to better profile CNV events. Ideally, you will/can use the replication timing data from your cell/tissue type (assayed using Repli-seq or inferred from WGS) to perform correction. Though, replication timing is highly conserved, you can try publicly available resources, such as that provided here. @gavinha can probably share where the replication timing tracks were sourced and how they were converted into wig files.

The repTimeWig param should be an optional input but a bug with the current version means you do need to supply one. You can try PR https://github.com/GavinHaLab/ichorCNA/pull/15 and that should allow you to run ichorCNA without replication timing wig.

@gavinha can probably explain why the CLI version is dropped (or not have a script to work alongside the current run_ichorCNA function). It is not too difficult to write one to work with the current version. I can chip in if the maintainer does not already have one.

lbeltrame commented 9 months ago

It would be very useful to have a working CLI. Otherwise, to work in containers during workflows (e.g. in nextflow, snakemake, WDL, you name it), everyone would need to reinvent the wheel.

xiucz commented 7 months ago

Hi, @ycl6 Do you know how to create a repTimeWig file? I need a 50kb binsize file for hg19, but I have found very limited information online.

Best, xiucz

ycl6 commented 7 months ago

Hi @xiucz

You might want to contact @gavinha and ask how he creates the repTimeWig files provided in this repo.

One of the repTimeWig files is in 50kb binsize: Koren_repTiming_hg19_50kb.wig

https://github.com/GavinHaLab/ichorCNA/tree/master/inst/extdata