VanLoo-lab / ascat

ASCAT R package
https://www.mdanderson.org/research/departments-labs-institutes/labs/van-loo-laboratory/resources.html#ASCAT
162 stars 85 forks source link

ERRER with "ascat.prepareHTS" #140

Closed duanshumeng closed 1 year ago

duanshumeng commented 1 year ago

ascat version 3.0.0

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. 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. munmap_chunk(): invalid pointer munmap_chunk(): invalid pointer 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. 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. munmap_chunk(): invalid pointer 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. Done reading locis Multi pos start: munmap_chunk(): invalid pointer 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. 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. 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. 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) wDone reading locis Multi pos start: hen trying to iterate through region. munmap_chunk(): invalid pointer [ERROR] (./src/alleleCounter.c: main:432 errno: None) Error scanning through bam file for loci list with dense snps. 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. 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. [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 Done reading locis Multi pos start: munmap_chunk(): invalid pointer 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 Aborted Aborted munmap_chunk(): invalid pointer munmap_chunk(): invalid pointer Aborted Aborted Aborted Done reading locis Multi pos start: Aborted munmap_chunk(): invalid pointer munmap_chunk(): invalid pointer 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. Aborted Aborted

tlesluyes commented 1 year ago

Hi @duanshumeng,

Hard to help with so little information, please provide the exact line of code that you have used so I can have a little bit of context. Is your BAM indexed? Can you check that you provide the absolute path? Can you check it's not truncated? Can you run (in a bash terminal, not par of ASCAT) alleleCounter without any error (alleleCounter -l myloci.txt -b myBAM.bam -o test.out -m 20 -q 35 -d)? It seems like there is a problem with the BAM or with the alleleCounter configuration here.

Cheers,

Tom.

duanshumeng commented 1 year ago

Hi @duanshumeng,

Hard to help with so little information, please provide the exact line of code that you have used so I can have a little bit of context. Is your BAM indexed? Can you check that you provide the absolute path? Can you check it's not truncated? Can you run (in a bash terminal, not par of ASCAT) alleleCounter without any error (alleleCounter -l myloci.txt -b myBAM.bam -o test.out -m 20 -q 35 -d)? It seems like there is a problem with the BAM or with the alleleCounter configuration here.

Cheers,

Tom.

Thank you for you reply. I followed your guide and run "alleleCounter -l myloci.txt -b myBAM.bam -o test.out -m 20 -q 35 -d" ,and there were new errors, and I don't understand. The command and error: root@9def351600c8:/home/ASCAT/WGS# ~/miniconda3/envs/hrd/bin/alleleCounter -l GC_G1000_hg38.txt -b ../demo_bam/Test_1_N.dedup.bam -o test.out -m 20 -q 35 -d Reading locis [ERROR] (./src/alleleCounter.c: get_position_info_from_file:288 errno: No such file or directory) Error parsing loci file line number 0 as a string match: ' Chr Position 25bp 50bp 100bp 200bp 500bp 1kb 2kb 5kb 10kb 20kb 50kb 100kb 200kb 500kb 1Mb '. [ERROR] (./src/alleleCounter.c: read_locis_from_file:359 errno: None) Error trying to fetch position from file at line 0. Done reading locis [ERROR] (./src/alleleCounter.c: main:411 errno: None) Error reading loci_stats from file. munmap_chunk(): invalid pointer Aborted (core dumped) root@9def351600c8:/home/ASCAT/WGS# less GC_G1000_hg38.txt

tlesluyes commented 1 year ago

Hi @duanshumeng,

It seems like there is some confusion about the input files. In your code, you are using the GC correction file (GC_G1000_hg38.txt) as the loci file for alleleCounter, these are two different sets of files. Can you give it a try with the correct loci files (here for WGS data)?

Cheers,

Tom.

duanshumeng commented 1 year ago

Hi @duanshumeng,

It seems like there is some confusion about the input files. In your code, you are using the GC correction file (GC_G1000_hg38.txt) as the loci file for alleleCounter, these are two different sets of files. Can you give it a try with the correct loci files (here for WGS data)?

Cheers,

Tom.

Thank you , I solved this problem as your your advice. But there is new error occurs, that is:

ascat.prepareHTS(

  • tumourseqfile = tumor_bam,
  • normalseqfile = normal_bam,
  • tumourname = tumor_name,
  • normalname = normal_name,
  • allelecounter_exe = allelecounter,
  • alleles.prefix = alleles_prefix,
  • loci.prefix = loci_prefix,
  • gender = gender,
  • genomeVersion = hg_version,
  • nthreads = 40,
  • tumourLogR_file = paste0(tumor_name, "_LogR.txt"),
  • tumourBAF_file = paste0(tumor_name, "_BAF.txt"),
  • normalLogR_file = paste0(normal_name, "_LogR.txt"),
  • normalBAF_file = paste0(normal_name, "_BAF.txt"),
  • BED_file = bed_file) Error in readAlleleCountFiles(tumourAlleleCountsFile.prefix, ".txt", chrom_names, : length(files) > 0 is not TRUE
tlesluyes commented 1 year ago

Can you have a look into the files called *_alleleFrequencies_chr* and show a few lines here?

duanshumeng commented 1 year ago

Can you have a look into the files called *_alleleFrequencies_chr* and show a few lines here?

Sorry, files called *_alleleFrequencies_chr* don't exist. Is there something wrong?

tlesluyes commented 1 year ago

Yes, something is clearly wrong. Such files should be generated early on when running ascat.prepareHTS (https://github.com/VanLoo-lab/ascat/blob/master/ASCAT/R/ascat.prepareHTS.R lines 261 & 273). Something is wrong in your configuration but, again, I have too little information to assist you at this point.

abhijitcbio commented 1 year ago

Hi, pardon me for jumping into the conversation but I am facing the same issue -

Error in readAllelesFiles(alleles.prefix, ".txt", chrom_names) :
  length(files) > 0 is not TRUE

and I have generated _alleleFrequencies_chr files, here are some of the lines -

head PATAAK_Day0_alleleFrequencies_chr*.txt
==> PATAAK_Day0_alleleFrequencies_chr1.txt <==
#CHR    POS     Count_A Count_C Count_G Count_T Good_depth
chr1    16103   0       0       1       13  14
chr1    51479   0       0       0       14  14
chr1    51898   0       32      0       0   32
chr1    51928   0       0       29      0   29
chr1    54490   0       0       33      0   33
chr1    54708   0       5       27      0   32
chr1    54716   0       22      0       2   24
chr1    54753   0       0       10      30  40
chr1    55299   0       15      0       17  32

==> PATAAK_Day0_alleleFrequencies_chr10.txt <==
#CHR    POS     Count_A Count_C Count_G Count_T Good_depth
chr10   11501   4       25      0       0   29
chr10   36097   0       0       9       0   9
chr10   47317   0       0       17      0   17
chr10   47347   0       24      0       0   24
chr10   47460   25      0       0       0   25
chr10   47754   0       4       0       21  25
chr10   47792   27      0       0       0   27
chr10   47804   0       0       0       26  26
chr10   47876   0       5       0       20  25

==> PATAAK_Day0_alleleFrequencies_chr11.txt <==
#CHR    POS     Count_A Count_C Count_G Count_T Good_depth
chr11   115634  0       0       0       0   0
chr11   128425  0       1       0       0   1
chr11   128429  0       1       0       0   1
chr11   128446  0       0       1       0   1
chr11   128557  0       0       0       0   0
chr11   128770  0       0       0       0   0
chr11   146846  0       0       0       0   0
chr11   157501  0       0       0       0   0
chr11   159344  0       0       0       0   0

Is anything wrong with these?

tlesluyes commented 1 year ago

Hi @abhijitcbio,

Please provide the exact line of code that you have used so I can have a little bit of context. Your *_alleleFrequencies_chr* files look good but your issue is related to the allele files (readAllelesFiles). I need to know what is the value of alleles.prefix when you run ascat.prepareHTS, if such files look good and if they can be accessed from where you run ASCAT.

Cheers,

Tom.

abhijitcbio commented 1 year ago

Here it is

ascat.prepareHTS(
  tumourseqfile = "../BAM_input_for_SV_callers/PATAAK_Day0_marked_duplicates.MAPQ20.bam",
  normalseqfile = "../BAM_input_for_SV_callers/PATAAK_Day28_marked_duplicates.MAPQ20.bam",
  tumourname = "PATAAK_Day0",
  normalname = "PATAAK_Day28",
  allelecounter_exe = "~/perl5/bin/alleleCounter",
  alleles.prefix = " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr",
  loci.prefix = "../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_loci_chr",
  gender = "XX",
  genomeVersion = "hg38",
  nthreads = 8,
  tumourLogR_file = "PATAAK_Day0_LogR.txt",
  tumourBAF_file = "PATAAK_Day0_BAF.txt",
  normalLogR_file = "PATAAK_Day28_LogR.txt",
  normalBAF_file = "PATAAK_Day28_BAF.txt")

I also tested with that particular portion of the code and tried to print the files by modifying the codes like this

readAllelesFiles=function(prefix,suffix,chrom_names,add_chr_string=F) {
  files=paste0(prefix,chrom_names,suffix)
  print (files)     #print the file names, stage1 
  print ("_____") #print a demarcation
  files=files[sapply(files,function(x) file.exists(x) && file.info(x)$size>0)]
  print (files)     #print against  stage2
  print (length(files)) #print the length
  stopifnot(length(files)>0)
  print (files)
  data=do.call(rbind,lapply(files,function(x) {
    tmp=data.frame(data.table::fread(x,sep='\t',showProgress=F,header=T))
    tmp=tmp[!is.na(tmp[,2] & !is.na(tmp[,3])),]
    tmp=tmp[!duplicated(tmp[,1]),]
    tmp$chromosome=gsub(paste0(prefix,'(',paste(chrom_names,collapse='|'),')',suffix),'\\1',x)
    if (add_chr_string) tmp$chromosome=paste0('chr',tmp$chromosome)
    tmp=tmp[,c(4,1:3)]
    rownames(tmp)=paste0(tmp[,1],'_',tmp[,2])
    return(tmp)
  }))
  stopifnot(nrow(data)>0)
  return(data)
}

and this generated the following

Reading locis
Done reading locis
Multi pos start:
 [1] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt"
 [2] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr2.txt"
 [3] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr3.txt"
 [4] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr4.txt"
 [5] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr5.txt"
 [6] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr6.txt"
 [7] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr7.txt"
 [8] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr8.txt"
 [9] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr9.txt"
[10] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr10.txt"
[11] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr11.txt"
[12] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr12.txt"
[13] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr13.txt"
[14] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr14.txt"
[15] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr15.txt"
[16] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr16.txt"
[17] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr17.txt"
[18] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr18.txt"
[19] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr19.txt"
[20] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr20.txt"
[21] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr21.txt"
[22] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr22.txt"
[23] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chrX.txt"
[1] "____"
character(0)
[1] 0
Error in readAllelesFiles(alleles.prefix, ".txt", chrom_names) :
  length(files) > 0 is not TRUE
Calls: Test.ascat.prepareHTS ... ascat.getBAFsAndLogRs -> readAllelesFiles -> stopifnot
Execution halted

So, it is showing the files at stage1 but not at stage2. The files are accessible from the same folder.

ls ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr*
../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt   ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr15.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr20.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr5.txt
../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr10.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr16.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr21.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr6.txt
../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr11.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr17.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr22.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr7.txt
../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr12.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr18.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr23.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr8.txt
../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr13.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr19.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr3.txt   ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr9.txt
../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr14.txt  ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr2.txt   ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr4.txt   ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chrX.txt

Thanks for your help.

tlesluyes commented 1 year ago

Hi @abhijitcbio,

Thanks for providing such a detailed report. That's really weird, could you split the file.exists(x) && file.info(x)$size>0) instruction so we can see if the files aren't considered because there is an issue with file.exists(x) or file.info(x)$size? Can you also double-check that you don't usesetwd in your script (so you are located in the right folder) and head 1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt to make sure that the files aren't empty? This can be checked in your modified function where you can:

  1. print(getwd())
  2. print(file.exists('../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt'))
  3. print(file.info('../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt')$size)
  4. print(head(readLines('../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt')))

Cheers,

Tom.

abhijitcbio commented 1 year ago

Here is the modified code

readAllelesFiles=function(prefix,suffix,chrom_names,add_chr_string=F) {
  files=paste0(prefix,chrom_names,suffix)
  print (files)
  print ("____")
  print (getwd())
  print (files[1])
  print (file.exists(files[1]))
  print (file.info(files[1])$size)
  print (head(readLines(files[1])))
  print ("____")
  files=files[sapply(files,function(x) file.exists(x) && file.info(x)$size>0)]
  print (files)
  print (length(files))
  stopifnot(length(files)>0)
  print (files)
  data=do.call(rbind,lapply(files,function(x) {
    tmp=data.frame(data.table::fread(x,sep='\t',showProgress=F,header=T))
    tmp=tmp[!is.na(tmp[,2] & !is.na(tmp[,3])),]
    tmp=tmp[!duplicated(tmp[,1]),]
    tmp$chromosome=gsub(paste0(prefix,'(',paste(chrom_names,collapse='|'),')',suffix),'\\1',x)
    if (add_chr_string) tmp$chromosome=paste0('chr',tmp$chromosome)
    tmp=tmp[,c(4,1:3)]
    rownames(tmp)=paste0(tmp[,1],'_',tmp[,2])
    return(tmp)
  }))
  stopifnot(nrow(data)>0)
  return(data)
}

And here is the outcome

Multi pos start:
 [1] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt"
 [2] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr2.txt"
 [3] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr3.txt"
 ....
[1] "____"
[1] "/mnt/bioadhoc-temp/Groups/abhijit/overflow/proj_overflow/Porject/Analysis/WGS/ASCAT/result"
[1] " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt"
[1] FALSE
[1] NA
Error in h(simpleError(msg, call)) :
  error in evaluating the argument 'x' in selecting a method for function 'head': cannot open the connection
Calls: Test.ascat.prepareHTS ... head -> readLines -> file -> .handleSimpleError -> h
In addition: Warning message:
In file(con, "r") :
  cannot open file ' ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt': No such file or directory
Execution halted

(base) pwd
/mnt/bioadhoc-temp/Groups/abhijit/overflow/proj_overflow/Porject/Analysis/WGS/ASCAT/result
(base) ls -trl ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt
-rwxrwxr-x+ 1 abhijit domain_users 28853842 Jul  1  2020 ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt

Somehow, it can't access the files and here's few lines from the index file

(base) head ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr1.txt
position        a0      a1
16103   4       3
51479   4       1
51898   2       1
51928   3       1
54490   3       1
54708   3       2
54716   2       4
54753   4       3
55299   2       4
tlesluyes commented 1 year ago

Hi @abhijitcbio,

I can't think of a reason why this doesn't work, it seems like the file is at the expected location but R can't access it for some reason. How about providing the absolute path instead? Should be: alleles.prefix = "/mnt/bioadhoc-temp/Groups/abhijit/overflow/proj_overflow/Porject/Analysis/WGS/ASCAT/1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr"

You can also use skip_allele_counting_tumour=T, skip_allele_counting_normal=T since you have generated the allele counts for this sample already.

Cheers,

Tom.

tlesluyes commented 1 year ago

If providing the absolute path doesn't help, then the ultimate check would be to make sure that you can access your files from where you are, outside of the ASCAT environment. Like if you consider using alleles.prefix = " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr", then, right before running ASCAT, try something like:

alleles.prefix = " ../1000G_loci_hg38/1kg.phase3.v5a_GRCh38nounref_allele_index_chr"
alleleFiles=paste0(alleles.prefix,c(1:22,'X'),'.txt')
print(getwd())
print(alleleFiles)
print(file.exists(alleleFiles))

If this doesn't work, then it would point to an issue with your environment rather than an issue with ASCAT.

Cheers,

Tom.

tlesluyes commented 1 year ago

Hi @duanshumeng,

I still don't have any information about your problem. You did provide the following piece of code:

 ascat.prepareHTS(
    tumourseqfile = tumor_bam,
    normalseqfile = normal_bam,
    tumourname = tumor_name,
    normalname = normal_name,
    allelecounter_exe = allelecounter,
    alleles.prefix = alleles_prefix,
    loci.prefix = loci_prefix,
    gender = gender,
    genomeVersion = hg_version,
    nthreads = 40,
    tumourLogR_file = paste0(tumor_name, "_LogR.txt"),
    tumourBAF_file = paste0(tumor_name, "_BAF.txt"),
    normalLogR_file = paste0(normal_name, "_LogR.txt"),
    normalBAF_file = paste0(normal_name, "_BAF.txt"),
    BED_file = bed_file)

But I still don't know what tumor_bam is, what alleles_prefix is, what loci_prefix is what log messages are, is there is any extra step before, etc. I can't help if I only have sparse information.

Cheers,

Tom.

abhijitcbio commented 1 year ago

Hi,

providing the absolute path solved the issue. Thanks a lot for the help.