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

Error when running on WES data #168

Closed CHENAO-QIAN closed 6 months ago

CHENAO-QIAN commented 7 months ago

Hi I am trying to run ascat.prepareHTS function on the wes data:

ASCAT::ascat.prepareHTS(tumourseqfile =paste0(data_dir,"BAM/HR15AE5E5.trimmomatic1_tumor_markdup.bam"), normalseqfile =paste0(data_dir,"BAM/HR15AE5E5.trimmomatic1_normal_markdup.bam"), tumourname ="HR15AE5E5", normalname ="HR15AE1E1", allelecounter_exe = "/hpc/scratch/nvme4/cq038719/alleleCounter/bin/alleleCounter", alleles.prefix = paste0(output_dir,"/data/G1000_allelesAll_hg38/G1000_alleles_hg38_chr"), loci.prefix = paste0(output_dir,"/data/G1000_lociAll_hg38/G1000_loci_hg38_chr"), gender = "XX", genomeVersion = "hg38", nthreads = 15, tumourLogR_file = "Tumor_LogR.txt", tumourBAF_file = "Tumor_BAF.txt", normalLogR_file = "Germline_LogR.txt", normalBAF_file = "Germline_BAF.txt", BED_file = paste0(data_dir,"Twist_Comprehensive_Exome_Covered_Targets_hg38.bed") )

It's giving me an error: 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: Cannot allocate memory) 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. Error in `/hpc/scratch/nvme4/cq038719/alleleCounter/bin/alleleCounter': munmap_chunk(): invalid pointer: 0x00007fffffffe1ba

I tried to search for similar error but had no luck. Thank you in advance!

tlesluyes commented 7 months ago

Hi @CHENAO-QIAN,

Is your BAM indexed? If yes, is the index located where the BAM is (same folder)? If yes, can you try re-indexing it?

This issue is related to alleleCounter. If the issue persists, try running alleleCounter manually with: alleleCounter -l $myPath1/G1000_alleles_hg38_chr1.txt -b $myPath2/HR15AE5E5.trimmomatic1_tumor_markdup.bam -o out_chr1.txt. This will help us understand what is going on.

Cheers,

Tom.

CHENAO-QIAN commented 7 months ago

Hi Tom,

The bam was indexed and the index was in the same bolder as the bam file, i tried ti re-index and got the same error.

I tried to run the cmd mannually and got the following info:

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: 'position a0 a1 '. [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. Error in `alleleCounter': munmap_chunk(): invalid pointer: 0x00007fffffffbb9f ======= Backtrace: ========= /usr/lib64/libc.so.6(+0x7f474)[0x2aaaab680474] alleleCounter(main+0x141)[0x401d61] /usr/lib64/libc.so.6(__libc_start_main+0xf5)[0x2aaaab623555] alleleCounter[0x402390] ======= Memory map: ======== 00400000-00408000 r-xp 00000000 00:55 242341 /hpc/scratch/nvme4/alleleCount-dev/alleleCounter/bin/alleleCounter 00607000-00608000 r--p 00007000 00:55 242341 /hpc/scratch/nvme4/alleleCount-dev/alleleCounter/bin/alleleCounter 00608000-00609000 rw-p 00008000 00:55 242341 /hpc/scratch/nvme4/alleleCount-dev/alleleCounter/bin/alleleCounter 00609000-00d2e000 rw-p 00000000 00:00 0 [heap] 2aaaaaaab000-2aaaaaacd000 r-xp 00000000 00:20 278065 /usr/lib64/ld-2.17.so 2aaaaaacd000-2aaaaaacf000 r-xp 00000000 00:00 0 [vdso] 2aaaaaacf000-2aaaaaad1000 rw-p 00000000 00:00 0 2aaaaaad1000-2aaaaaae0000 r--p 00000000 00:59 109420 /home/.conda/envs/htslib/lib/libhts.so.1.19.1 2aaaaaae0000-2aaaaabb0000 r-xp 0000f000 00:59 109420 /home/.conda/envs/htslib/lib/libhts.so.1.19.1 2aaaaabb0000-2aaaaabd2000 r--p 000df000 00:59 109420 /home/.conda/envs/htslib/lib/libhts.so.1.19.1 2aaaaabd2000-2aaaaabd4000 r--p 00101000 00:59 109420 /home/.conda/envs/htslib/lib/libhts.so.1.19.1 2aaaaabd4000-2aaaaabd9000 rw-p 00103000 00:59 109420 /home/.conda/envs/htslib/lib/libhts.so.1.19.1 2aaaaabd9000-2aaaaabda000 rw-p 00000000 00:00 0 2aaaaabda000-2aaaaabdd000 r--p 00000000 00:59 389380 /home/.conda/envs/htslib/lib/libz.so.1.2.13 2aaaaabdd000-2aaaaabec000 r-xp 00003000 00:59 389380 /home/.conda/envs/htslib/lib/libz.so.1.2.13 2aaaaabec000-2aaaaabf3000 r--p 00012000 00:59 389380 /home/.conda/envs/htslib/lib/libz.so.1.2.13 2aaaaabf3000-2aaaaabf4000 r--p 00018000 00:59 389380 /home/.conda/envs/htslib/lib/libz.so.1.2.13 2aaaaabf4000-2aaaaabf5000 rw-p 00019000 00:59 389380 /home/.conda/envs/htslib/lib/libz.so.1.2.13 2aaaaabf5000-2aaaaabf6000 rw-p 00000000 00:00 0 2aaaaabf6000-2aaaaabfa000 r--p 00000000 00:59 99294 /home/.conda/envs/htslib/lib/liblzma.so.5.2.6 2aaaaabfa000-2aaaaac11000 r-xp 00004000 00:59 99294 /home/.conda/envs/htslib/lib/liblzma.so.5.2.6 2aaaaac11000-2aaaaac1c000 r--p 0001b000 00:59 99294 /home/.conda/envs/htslib/lib/liblzma.so.5.2.6 2aaaaac1c000-2aaaaac1d000 ---p 00026000 00:59 99294 /home/.conda/envs/htslib/lib/liblzma.so.5.2.6 2aaaaac1d000-2aaaaac1e000 r--p 00026000 00:59 99294 /home/.conda/envs/htslib/lib/liblzma.so.5.2.6 2aaaaac1e000-2aaaaac1f000 rw-p 00027000 00:59 99294 /home/.conda/envs/htslib/lib/liblzma.so.5.2.6 2aaaaac1f000-2aaaaac20000 rw-p 00000000 00:00 0 2aaaaac20000-2aaaaac21000 r--p 00000000 00:59 109835 /home/.conda/envs/htslib/lib/libdeflate.so.0 2aaaaac21000-2aaaaac2e000 r-xp 00001000 00:59 109835 /home/.conda/envs/htslib/lib/libdeflate.so.0 2aaaaac2e000-2aaaaac33000 r--p 0000e000 00:59 109835 /home/.conda/envs/htslib/lib/libdeflate.so.0 2aaaaac33000-2aaaaac34000 r--p 00012000 00:59 109835 /home/.conda/envs/htslib/lib/libdeflate.so.0 2aaaaac34000-2aaaaac35000 rw-p 00013000 00:59 109835 /home/.conda/envs/htslib/lib/libdeflate.so.0 2aaaaac35000-2aaaaac37000 r--p 00000000 00:59 108463 /home/.conda/envs/htslib/lib/libbz2.so.1.0.8 2aaaaac37000-2aaaaac45000 r-xp 00002000 00:59 108463 /home/.conda/envs/htslib/lib/libbz2.so.1.0.8 2aaaaac45000-2aaaaac47000 r--p 00010000 00:59 108463 /home/.conda/envs/htslib/lib/libbz2.so.1.0.8 2aaaaac47000-2aaaaac48000 r--p 00011000 00:59 108463 /home/.conda/envs/htslib/lib/libbz2.so.1.0.8 2aaaaac48000-2aaaaac49000 rw-p 00012000 00:59 108463 /home/.conda/envs/htslib/lib/libbz2.so.1.0.8 2aaaaac49000-2aaaaac4e000 rw-p 00000000 00:00 0 2aaaaac4e000-2aaaaac52000 r--p 00000000 00:59 350339 /home/.conda/envs/htslib/lib/libgcc_s.so.1 2aaaaac52000-2aaaaac64000 r-xp 00004000 00:59 350339 /home/.conda/envs/htslib/lib/libgcc_s.so.1 2aaaaac64000-2aaaaac67000 r--p 00016000 00:59 350339 /home/.conda/envs/htslib/lib/libgcc_s.so.1 2aaaaac67000-2aaaaac68000 r--p 00019000 00:59 350339 /home/.conda/envs/htslib/lib/libgcc_s.so.1 2aaaaac68000-2aaaaac69000 rw-p 0001a000 00:59 350339 /home/.conda/envs/htslib/lib/libgcc_s.so.1 2aaaaaccc000-2aaaaaccd000 r--p 00021000 00:20 278065 /usr/lib64/ld-2.17.so 2aaaaaccd000-2aaaaacce000 rw-p 00022000 00:20 278065 /usr/lib64/ld-2.17.so 2aaaaacce000-2aaaaaccf000 rw-p 00000000 00:00 0 2aaaaaccf000-2aaaaace6000 r-xp 00000000 00:20 279294 /usr/lib64/libpthread-2.17.so 2aaaaace6000-2aaaaaee5000 ---p 00017000 00:20 279294 /usr/lib64/libpthread-2.17.so 2aaaaaee5000-2aaaaaee6000 r--p 00016000 00:20 279294 /usr/lib64/libpthread-2.17.so 2aaaaaee6000-2aaaaaee7000 rw-p 00017000 00:20 279294 /usr/lib64/libpthread-2.17.so 2aaaaaee7000-2aaaaaeeb000 rw-p 00000000 00:00 0 2aaaaaeeb000-2aaaaaefa000 r-xp 00000000 00:20 278372 /usr/lib64/libbz2.so.1.0.6 2aaaaaefa000-2aaaab0f9000 ---p 0000f000 00:20 278372 /usr/lib64/libbz2.so.1.0.6 2aaaab0f9000-2aaaab0fa000 r--p 0000e000 00:20 278372 /usr/lib64/libbz2.so.1.0.6 2aaaab0fa000-2aaaab0fb000 rw-p 0000f000 00:20 278372 /usr/lib64/libbz2.so.1.0.6 2aaaab0fb000-2aaaab1fc000 r-xp 00000000 00:20 278981 /usr/lib64/libm-2.17.so 2aaaab1fc000-2aaaab3fb000 ---p 00101000 00:20 278981 /usr/lib64/libm-2.17.so 2aaaab3fb000-2aaaab3fc000 r--p 00100000 00:20 278981 /usr/lib64/libm-2.17.so 2aaaab3fc000-2aaaab3fd000 rw-p 00101000 00:20 278981 /usr/lib64/libm-2.17.so 2aaaab3fd000-2aaaab3ff000 r-xp 00000000 00:20 278510 /usr/lib64/libdl-2.17.so 2aaaab3ff000-2aaaab5ff000 ---p 00002000 00:20 278510 /usr/lib64/libdl-2.17.so 2aaaab5ff000-2aaaab600000 r--p 00002000 00:20 278510 /usr/lib64/libdl-2.17.so 2aaaab600000-2aaaab601000 rw-p 00003000 00:20 278510 /usr/lib64/libdl-2.17.so 2aaaab601000-2aaaab7c5000 r-xp 00000000 00:20 278373 /usr/lib64/libc-2.17.so 2aaaab7c5000-2aaaab9c4000 ---p 001c4000 00:20 278373 /usr/lib64/libc-2.17.so 2aaaab9c4000-2aaaab9c8000 r--p 001c3000 00:20 278373 /usr/lib64/libc-2.17.so 2aaaab9c8000-2aaaab9ca000 rw-p 001c7000 00:20 278373 /usr/lib64/libc-2.17.so 2aaaab9ca000-2aaaab9cf000 rw-p 00000000 00:00 0 2aaaab9cf000-2aaaab9d6000 r-xp 00000000 00:20 279353 /usr/lib64/librt-2.17.so 2aaaab9d6000-2aaaabbd5000 ---p 00007000 00:20 279353 /usr/lib64/librt-2.17.so 2aaaabbd5000-2aaaabbd6000 r--p 00006000 00:20 279353 /usr/lib64/librt-2.17.so 2aaaabbd6000-2aaaabbd7000 rw-p 00007000 00:20 279353 /usr/lib64/librt-2.17.so 7ffffffdb000-7ffffffff000 rw-p 00000000 00:00 0 [stack] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Aborted

Maybe I did not install 'alleleCount' correctly? But I did not get any error while installing alleleCount and all tests passed.

Thanks, Chenao

tlesluyes commented 7 months ago

Hi @CHENAO-QIAN,

Sorry, I made a mistake in my previous post: alleleCounter needs the loci file, not the allele file. Can you try running:

alleleCounter -l $myPath1/G1000_loci_hg38_chr1.txt -b $myPath2/HR15AE5E5.trimmomatic1_tumor_markdup.bam -o out_chr1.txt

Please also post the first 5 lines of the loci file here so we can check that it's not empty and the genomic coordinates are valid.

AlleleCounter may require a few Gb of memory (up to 8Gb for the largest chromosomes, depending on the number of SNPs), it would be worth checking you have enough RAM on your system and creating a sub-loci file with just ~5 lines and try running alleleCounter with that.

Cheers,

Tom.

CHENAO-QIAN commented 6 months ago

Thank you so much for the help, Tom! I checked my bam and loci files (as you suggested) and found the genomic coordinates did not align. The problem has been solved now.

sunnaa0423 commented 5 months ago

genomic coordinates did not align

Hi

I got the error similar to yours. I wonder know that what do you mean "genomic coordinates did not align" and how you solved this problem detaily ,please. I have sorted and indexed the bam file by samtools. Thanks

sunna