I have 133 aligned and sorted BAM files that I am trying to run through the ref_map.pl script from the STACKS pipeline. My script looks as follows:
module load stacks ref_map.pl -T 15 --popmap B2_filenames.txt --samples /home/heather/scratch/03_sort_and_map/filtered_and_sorted/B2/ --out-path /home/heather/scratch/ref_map_results/full_data echo "ref_map.pl for B2 dataset completed"
I keep running into the issue where gstacks is unable to read the BAM files. This is what the log file looks like:
Configuration for this run: Input mode: reference-based Population map: 'B2_filenames.txt' Input files: 133, e.g. '/home/heather/scratch/03_sort_and_map/filtered_and_sorted/B2/1401-47750.sort_filt.bam' Output to: '/home/heather/scratch/ref_map_results/full_data/' Model: marukilow (var_alpha: 0.01, gt_alpha: 0.05) Reading BAM headers... Processing all loci... Error: No BAM records. Error: (At the 0th record in file '/home/heather/scratch/03_sort_and_map/filtered_and_sorted/B2/1401-47754_B2.sort_filt.bam'.) Aborted. ref_map.pl: Aborted because the last command failed (1). Last command executed by ref_map.pl was: /cvmfs/soft.computecanada.ca/easybuild/software/2020/avx2/Core/stacks/2.64/bin/gstacks -I /home/heather/scratch/03_sort_and_map/filtered_and_sorted/B2/ -M B2_filenames.txt -O /home/heather/scratch/ref_map_results/full_data -t 15
I checked the BAM file with samtools - the headers look ok, and I don't get any output when I run samtools quickcheck, so I can't quite figure out what is causing the issue. I am following the same pipeline as I did with a previous batch of data and can't understand whats going wrong.