Hi, I followed ASCAT WES instructions and still go...
# sarek
a
Hi, I followed ASCAT WES instructions and still got this error, do you know what might be causing it?
Copy code
Aug-26 18:33:45.484 [Task monitor] ERROR nextflow.processor.TaskProcessor - Error executing process > 'NFCORE_SAREK:sarek:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_SOMATIC_ASCAT:ASCAT (AUR-AER5-TTM5_vs_AUR-AER5-NT2)'

Caused by:
  Process `NFCORE_SAREK:sarek:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_SOMATIC_ASCAT:ASCAT (AUR-AER5-TTM5_vs_AUR-AER5-NT2)` terminated with an error exit status (1)

Command executed:

  #!/usr/bin/env Rscript
  library(RColorBrewer)
  library(ASCAT)
  options(bitmapType='cairo')

  #build prefixes: <abspath_to_files/prefix_chr>
  allele_path = normalizePath("battenberg_alleles_on_target_hg38")
  allele_prefix = paste0(allele_path, "/", "battenberg_alleles_on_target_hg38", "_chr")

  loci_path = normalizePath("battenberg_loci_on_target_hg38")
  loci_prefix = paste0(loci_path, "/", "battenberg_loci_on_target_hg38", "_chr")

  #prepare from BAM files
  ascat.prepareHTS(
      tumourseqfile = "AUR-AER5-TTM5.recal.cram",
      normalseqfile = "AUR-AER5-NT2.recal.cram",
      tumourname = paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".tumour"),
      normalname = paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".normal"),
      allelecounter_exe = "alleleCounter",
      alleles.prefix = allele_prefix,
      loci.prefix = loci_prefix,
      gender = "XX",
      genomeVersion = "hg38",
      nthreads = 16
      ,minCounts = 10
      ,BED_file = 'xgen-exome-research-panel-targets-hg38.bed'
      ,chrom_names = c(1:22, 'X')
      ,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("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".tumour_tumourLogR.txt"),
      Tumor_BAF_file = paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".tumour_tumourBAF.txt"),
      Germline_LogR_file = paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".tumour_normalLogR.txt"),
      Germline_BAF_file = paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".tumour_normalBAF.txt"),
      genomeVersion = "hg38",
      gender = "XX"
  )

  #Plot the raw data
  ascat.plotRawData(ascat.bc, img.prefix = paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".before_correction."))

  # optional LogRCorrection
  if("GC_G1000_on_target_hg38" != "NULL") {
      gc_input = paste0(normalizePath("GC_G1000_on_target_hg38"), "/", "GC_G1000_on_target_hg38", ".txt")

      if("RT_G1000_on_target_hg38" != "NULL"){
          rt_input = paste0(normalizePath("RT_G1000_on_target_hg38"), "/", "RT_G1000_on_target_hg38", ".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("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".after_correction_gc_rt."))
      }
      else {
          ascat.bc = ascat.correctLogR(ascat.bc, GCcontentfile = gc_input, replictimingfile = RT_G1000_on_target_hg38)
          #Plot raw data after correction
          ascat.plotRawData(ascat.bc, img.prefix = paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".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("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".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("AUR-AER5-TTM5_vs_AUR-AER5-NT2",".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("AUR-AER5-TTM5_vs_AUR-AER5-NT2",".purityploidy.txt"), sep="	", quote=F, row.names=F, col.names=T)

  write.table(QC, file=paste0("AUR-AER5-TTM5_vs_AUR-AER5-NT2", ".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:
  [ERROR] (src/bam_access.c: bam_access_get_multi_position_base_counts:379 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
  [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps.
  munmap_chunk(): invalid pointer
  munmap_chunk(): invalid pointer
  munmap_chunk(): invalid pointer
  Reading locis
  Done reading locis
  Multi pos start:
  Reading locis
  Done reading locis
  Multi pos start:
  Reading locis
  Done reading locis
  Multi pos start:
  [E::sam_itr_next] Null iterator
  [ERROR] (src/bam_access.c: bam_access_get_multi_position_base_counts:379 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
  [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps.
  [E::sam_itr_next] Null iterator
  [ERROR] (src/bam_access.c: bam_access_get_multi_position_base_counts:379 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
  [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps.
  munmap_chunk(): invalid pointer
  munmap_chunk(): invalid pointer
  [E::sam_itr_next] Null iterator
  [ERROR] (src/bam_access.c: bam_access_get_multi_position_base_counts:379 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
  [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps.
  munmap_chunk(): invalid pointer
  Reading locis
  Done reading locis
  Multi pos start:
  Reading locis
  Reading locis
  Done reading locis
  Multi pos start:
  Done reading locis
  Multi pos start:
  [E::sam_itr_next] Null iterator
  [ERROR] (src/bam_access.c: bam_access_get_multi_position_base_counts:379 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
  [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps.
  [E::sam_itr_next] Null iterator
  [ERROR] (src/bam_access.c: bam_access_get_multi_position_base_counts:379 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
  [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps.
  munmap_chunk(): invalid pointer
  [E::sam_itr_next] Null iterator
  [ERROR] (src/bam_access.c: bam_access_get_multi_position_base_counts:379 errno: No such file or directory) Error detected (-2) when trying to iterate through region.
  [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps.
  munmap_chunk(): invalid pointer
  munmap_chunk(): invalid pointer
  Error in { : task 1 failed - "EXIT_CODE == 0 is not TRUE"
  Calls: ascat.prepareHTS -> %dopar% -> <Anonymous>
  Execution halted

Work dir:
  /ocean/projects/aurora/achang4/sarek/Part2_FASTQ2SAREK/work/37/1a97d124c75fc7fb167135750e01b7
t
It seems it can't find some (BAM?) file. When you look at the working directory of the process (
.../37/1a97d124c75fc7fb167135750e01b7
), is there anything that appears to be missing (given the command; check for dead symlinks)? Is this reproducible, i.e. if you rerun (with
-resume
), is the outcome the same?
a
Let me try, I manually checked and all the .cram files are there, and the WGS version works fine
Maybe it’s cause it’s looking for an area in the file that is empty caused it’s WES?
t
It says "file not found", so I don't think it's that ...
a
Ok let me retry the resume once I get back to the office
🤞 1
So the -resume kept running, but it looks like it went back to the GATK steps? also is the sequencing files in the folder all being .cram possible one of the causes? AUR-AER5-NT2.recal.cram AUR-AER5-NT2.recal.cram.crai AUR-AER5-TTM5.recal.cram AUR-AER5-TTM5.recal.cram.crai
nvm after resume it hit the same error again
t
Hmm, I don't think CRAMs should be a problem, since the pipeline uses them by default, and it seems to be complaining about
No such file or directory
... I would try to figure out what's going on by going to the work directory and trying to get the command in
.command.sh
running on the files there (using the container from the pipeline). Sorry I don't have any better ideas, I don't have any particular expertise with ASCAT. You are saying is works with WGS, maybe you can figure out what the differences are ...
If you have a successful process from WGS, you can compare that work directory to the one from the failed process -- see what files are there, and if the
.command.sh
files are equivalent or different.
a
Ok will give it a shot
Fixed it, it's a really specific error due to chr or no chr prefix on the loci file, I've submmited a PR to the usage file to document how to avoid it
👍 2
🙏 1