Hello,
We use elPrep for BQSR, sorting and duplicate marking. However, when we attempt to run picard CollectMultipleMetrics on the CRAM output files we encounter an error:
"Exception in thread "main" htsjdk.samtools.SAMException: Requesting earlier reference sequence: 11 < 12",
which may point to the CRAM files not being properly sorted.
This made us wonder if we might be using elPrep incorrectly.
The elPrep commands we use in our workflow are the following:
elprep split "$BAMS/" "$SPLIT/" \
--output-prefix "$sample_ID" \
--output-type bam \
--nr-of-threads 16
elprep filter $bam_file "$Results/$base.bam" \
--mark-duplicates --remove-duplicates \
--mark-optical-duplicates-intermediate "$Results/$base.metrics" \
--nr-of-threads 16 \
--bqsr-tables-only "$Results/$base.elrecal" \
--bqsr-reference $el_fasta \
--quantize-levels 0 \
--known-sites $el_dbsnp,$el_known_indels,$el_mills \
--sorting-order coordinate
elprep merge "$BAMS/" /dev/stdout --nr-of-threads 6 | \
elprep filter /dev/stdin /dev/stdout --bqsr-apply "$RECAL/" --recal-file "$RESULTS/$sample_ID.recal" --nr-of-threads 24 | \
samtools view -C -T $refFasta -o "$RESULTS/$sample_ID.dedup.recal.cram" -@ 4 --write-index -