abyzovlab / CNVnator

a tool for CNV discovery and genotyping from depth-of-coverage by mapped reads
Other
206 stars 65 forks source link

Can't load index file for cram file #276

Closed ChristinaXu2017 closed 1 year ago

ChristinaXu2017 commented 1 year ago

According to GitHub issues #33 and #34. the latest CNVnator can read CRAM files. Yes, it can read the CRAM file but not the CRAM index file. I got below error message: Can't load index file for '/path/test.cram'.

The command line I used is

export REF_PATH=/reference/g/GRCh37_ICGC_standard_v2.fa;
./cnvnator -pe /path/test.cram -qual 40 -over 0.8 -root /path/test.rawresults.root  -f /path/test.rawresults.tsv 

The index file is created by samtools and renamed to

I doubt the error occurs on AliParser.cpp

  if (loadIndex) {
      index = bam_index_load(fileName.c_str());
      if (!index) cerr<<"Can't load index file for '"<<fileName<<"'."<<endl;
    }
ChristinaXu2017 commented 1 year ago

it can't load cram file, unless Change index file handle from bamidx to hts_idx_t on AliParser.*.

if (loadIndex) {
    //index = bam_index_load(fileName.c_str());
    samFile *hts = sam_open(fileName.c_str());
     index = sam_index_load2( hts, fileName.c_str(), NULL);
     ...

The reason is

abyzov commented 1 year ago

Hi, thanks for the info. Perhaps, it would be better to switch to CNVpytor (https://github.com/abyzovlab/CNVpytor) as it is better maintained.

Alexej Abyzov, Ph.D. Senior Associate Consultant, Associate Professor of Biomedical Informatics, Department of Quantitative Health Sciences, Center for Individualized Medicine, Mayo Clinic

Mayo Clinic, 200 1st street SW, Harwick 7-91 Rochester, MN 55905 www.abyzovlab.org tel: +1-(507)-538-0978

ChristinaXu2017 commented 1 year ago

thanks, will try it.