Error with ASCAT
Description of the bug
Hello, I run ASCAT and got this error. Because it's a sample from male. I guess it has something to do with the chromosome Y but I am not sure if it is the case.
Command used and terminal output
nextflow run nf-core/sarek --input samplesheet.csv --outdir results --genome GATK.GRCh38 -profile singularity -revision 3.2.1 \
--tools strelka,mutect2,vep,cnvkit,ascat -c config_ori.txt --save_output_as_bam -resume
output:
Error executing process > 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_SOMATIC_ASCAT:ASCAT (OO99_tumor_vs_OO99_normal)'
Caused by:
Process `NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_SOMATIC_ASCAT:ASCAT (OO99_tumor_vs_OO99_normal)` terminated with an error exit status (1)
Command executed:
#!/usr/bin/env Rscript
library(RColorBrewer)
library(ASCAT)
options(bitmapType='cairo')
#build prefixes:
allele_path = normalizePath("ascat_alleles")
allele_prefix = paste0(allele_path, "/", "ascat_alleles", "_chr")
loci_path = normalizePath("ascat_loci")
loci_prefix = paste0(loci_path, "/", "ascat_loci", "_chr")
#prepare from BAM files
ascat.prepareHTS(
tumourseqfile = "OO99_tumor.recal.cram",
normalseqfile = "OO99_normal.recal.cram",
tumourname = paste0("OO99_tumor_vs_OO99_normal", ".tumour"),
normalname = paste0("OO99_tumor_vs_OO99_normal", ".normal"),
allelecounter_exe = "alleleCounter",
alleles.prefix = allele_prefix,
loci.prefix = loci_prefix,
gender = "XY",
genomeVersion = "hg38",
nthreads = 6
,minCounts = 10
,chrom_names = c(1:22, 'X', 'Y')
,min_base_qual = 20
,min_map_qual = 35
,ref.fasta = 'Homo_sapiens_assembly38.fasta'
,
seed = 42
)
#Load the data
ascat.bc = ascat.loadData(
Tumor_LogR_file = paste0("OO99_tumor_vs_OO99_normal", ".tumour_tumourLogR.txt"),
Tumor_BAF_file = paste0("OO99_tumor_vs_OO99_normal", ".tumour_tumourBAF.txt"),
Germline_LogR_file = paste0("OO99_tumor_vs_OO99_normal", ".tumour_normalLogR.txt"),
Germline_BAF_file = paste0("OO99_tumor_vs_OO99_normal", ".tumour_normalBAF.txt"),
genomeVersion = "hg38",
gender = "XY"
)
#Plot the raw data
ascat.plotRawData(ascat.bc, img.prefix = paste0("OO99_tumor_vs_OO99_normal", ".before_correction."))
# optional LogRCorrection
if("ascat_loci_gc" != "NULL") {
gc_input = paste0(normalizePath("ascat_loci_gc"), "/", "ascat_loci_gc", ".txt")
if("ascat_loci_rt" != "NULL"){
rt_input = paste0(normalizePath("ascat_loci_rt"), "/", "ascat_loci_rt", ".txt")
ascat.bc = ascat.correctLogR(ascat.bc, GCcontentfile = gc_input, replictimingfile = rt_input)
#Plot raw data after correction
ascat.plotRawData(ascat.bc, img.prefix = paste0("OO99_tumor_vs_OO99_normal", ".after_correction_gc_rt."))
}
else {
ascat.bc = ascat.correctLogR(ascat.bc, GCcontentfile = gc_input, replictimingfile = ascat_loci_rt)
#Plot raw data after correction
ascat.plotRawData(ascat.bc, img.prefix = paste0("OO99_tumor_vs_OO99_normal", ".after_correction_gc."))
}
}
#Segment the data
ascat.bc = ascat.aspcf(ascat.bc, seed=42)
#Plot the segmented data
ascat.plotSegmentedData(ascat.bc)
#Run ASCAT to fit every tumor to a model, inferring ploidy, normal cell contamination, and discrete copy numbers
#If psi and rho are manually set:
if (!is.null(NULL) && !is.null(NULL)){
ascat.output <- ascat.runAscat(ascat.bc, gamma=1, rho_manual=NULL, psi_manual=NULL)
} else if(!is.null(NULL) && is.null(NULL)){
ascat.output <- ascat.runAscat(ascat.bc, gamma=1, rho_manual=NULL)
} else if(!is.null(NULL) && is.null(NULL)){
ascat.output <- ascat.runAscat(ascat.bc, gamma=1, psi_manual=NULL)
} else {
ascat.output <- ascat.runAscat(ascat.bc, gamma=1)
}
#Extract metrics from ASCAT profiles
QC = ascat.metrics(ascat.bc,ascat.output)
#Write out segmented regions (including regions with one copy of each allele)
write.table(ascat.output[["segments"]], file=paste0("OO99_tumor_vs_OO99_normal", ".segments.txt"), sep=" ", quote=F, row.names=F)
#Write out CNVs in bed format
cnvs=ascat.output[["segments"]][2:6]
write.table(cnvs, file=paste0("OO99_tumor_vs_OO99_normal",".cnvs.txt"), sep=" ", quote=F, row.names=F, col.names=T)
#Write out purity and ploidy info
summary <- tryCatch({
matrix(c(ascat.output[["aberrantcellfraction"]], ascat.output[["ploidy"]]), ncol=2, byrow=TRUE)}, error = function(err) {
# error handler picks up where error was generated
print(paste("Could not find optimal solution: ",err))
return(matrix(c(0,0),nrow=1,ncol=2,byrow = TRUE))
}
)
colnames(summary) <- c("AberrantCellFraction","Ploidy")
write.table(summary, file=paste0("OO99_tumor_vs_OO99_normal",".purityploidy.txt"), sep=" ", quote=F, row.names=F, col.names=T)
write.table(QC, file=paste0("OO99_tumor_vs_OO99_normal", ".metrics.txt"), sep=" ", quote=F, row.names=F)
# version export
f <- file("versions.yml","w")
alleleCounter_version = system(paste("alleleCounter --version"), intern = T)
ascat_version = sessionInfo()$otherPkgs$ASCAT$Version
writeLines(paste0('"', "NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_SOMATIC_ASCAT:ASCAT", '"', ":"), f)
writeLines(paste(" alleleCounter:", alleleCounter_version), f)
writeLines(paste(" ascat:", ascat_version), f)
close(f)
Command exit status:
1
Command output:
(empty)
Command error:
Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Attaching package: ‘BiocGenerics’
The following objects are masked from ‘package:stats’:
IQR, mad, sd, var, xtabs
The following objects are masked from ‘package:base’:
anyDuplicated, aperm, append, as.data.frame, basename, cbind,
colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
table, tapply, union, unique, unsplit, which.max, which.min
Loading required package: S4Vectors
Attaching package: ‘S4Vectors’
The following objects are masked from ‘package:data.table’:
first, second
The following objects are masked from ‘package:base’:
expand.grid, I, unname
Loading required package: IRanges
Attaching package: ‘IRanges’
The following object is masked from ‘package:data.table’:
shift
Loading required package: GenomeInfoDb
Loading required package: parallel
Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
Warning message:
package ‘ASCAT’ was built under R version 4.2.3
Error in readAlleleCountFiles(tumourAlleleCountsFile.prefix, ".txt", chrom_names, :
length(files) > 0 is not TRUE
Calls: ascat.prepareHTS ... ascat.getBAFsAndLogRs -> readAlleleCountFiles -> stopifnot
Execution halted
Work dir:
/group/poetsch_projects/Projects/poetsch_sc/nf-core_run/work/5d/0f4ea23bcdcec31c68e1dcef8fb1fa
Tip: when you have fixed the problem you can continue the execution adding the option `-resume` to the run command line
Relevant files
No response
System information
No response
Can you share your .nextflow.log and your samplesheet?
Hello, I think this error Error in readAlleleCountFiles(tumourAlleleCountsFile.prefix, ".txt", chrom_names, : length(files) > 0 is not TRUE occurred because it looked for the wrong files'name in the folders ascat_alleles, ascat_loci, ascat_loci_gc, ascat_loci_rt. For example, in the main.nf script, rather than allele_prefix = paste0(allele_path, "/", "$allele_files", "_chr") the prefix should be like this: allele_prefix = paste0(allele_path, "/", "G1000_alleles_hg38_chr")
May I kindly ask for your opinion and could you help with this please? Thank you a lot