The current GATK version is 3.7-0
Examples: Monday, today, last week, Mar 26, 3/26/04

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

GATK 3.7 is here! Be sure to read the Version Highlights and optionally the full Release Notes.
Register now for the upcoming GATK Best Practices workshop, Feb 20-22 in Leuven, Belgium. Open to all comers! More info and signup at http://bit.ly/2i4mGxz

# Markduplicates in Cram files. A valid CRAM reference was not supplied...

Cambridge, UKMember Posts: 5

Hello,
I wonder if you can help with the following. I am trying to mark duplicates in a cram file with the following command (picard latest):
'picard-tools MarkDuplicates I=09_1#21.cram O=09_1#21_md.cram M=09_1#21_md.txt'

I keep getting the following errors:

Exception in thread "main" java.lang.IllegalStateException: A valid CRAM reference was not supplied and one cannot be acquired via the property settings reference_fasta or use_cram_ref_download
at htsjdk.samtools.cram.ref.ReferenceSource.getDefaultCRAMReferenceSource(ReferenceSource.java:107)
at htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:301) at picard.sam.markduplicates.util.AbstractMarkDuplicatesCommandLineProgram.openInputs(AbstractMarkDuplicatesCommandLineProgram.java:212) at picard.sam.markduplicates.MarkDuplicates.buildSortedReadEndLists(MarkDuplicates.java:421) at picard.sam.markduplicates.MarkDuplicates.doWork(MarkDuplicates.java:220) at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:208) at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95) at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:105 I have also tried with the fasta reference R=in.fasta but nothing.. There is a similar post asking the same question but it doesn't seem to have been solved. Many thanks in advance, Carmen Tagged: #### Issue · Github September 2016 by Sheila Issue Number 1266 State closed Last Updated Assignee Array Milestone Array Closed By vdauwera ## Best Answers ## Answers • Administrator, Dev Posts: 11,117 admin When you provided the reference, did you get the exact same error message, or a different one? Geraldine Van der Auwera, PhD • Cambridge, UKMember Posts: 5 Hello Geraldine, Thank you for looking into this. I get exactly the same error as you see below. For some reason, Picard does not like the reference. The only way I found around it is using scramble to convert cram to bam and then using markduplicates. The reason I use scramble and not Samtools is because I found that converting cram-to-bam with Samtools also throws an error to do with 'allocating reads to wrong bins'. Looking online and talking to people in the Sanger it appears they are aware of this so this might change in the near future. My as you can imagine, I would ideally like to use my cram files to save space. Anyway, this is what I get when I try to work with my cram files. picard-tools MarkDuplicates I=09_1#21.cram O=09_1#21_md.cram M=09_1#21_md.txt R=/lustre/scratch108/viruses/cds1/References/Homo_sapiens.GRCh37.dna.all.fa [Tue Sep 13 06:39:03 BST 2016] picard.sam.markduplicates.MarkDuplicates INPUT=[09_1#21.cram] OUTPUT=09_1#21_md.cram METRICS_FILE=09_1#21_md.txt REFERENCE_SEQUENCE=/lustre/scratch108/viruses/cds1/References/Homo_sapiens.GRCh37.dna.all.fa MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP=50000 MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=8000 SORTING_COLLECTION_SIZE_RATIO=0.25 REMOVE_SEQUENCING_DUPLICATES=false TAGGING_POLICY=DontTag REMOVE_DUPLICATES=false ASSUME_SORTED=false DUPLICATE_SCORING_STRATEGY=SUM_OF_BASE_QUALITIES PROGRAM_RECORD_ID=MarkDuplicates PROGRAM_GROUP_NAME=MarkDuplicates READ_NAME_REGEX= OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false GA4GH_CLIENT_SECRETS=client_secrets.json [Tue Sep 13 06:39:03 BST 2016] Executing as cds1@pcs5b on Linux 3.2.0-105-generic amd64; Java HotSpot(TM) 64-Bit Server VM 1.8.0_74-b02; Picard version: 2.6.0-SNAPSHOT INFO 2016-09-13 06:39:03 MarkDuplicates Start of doWork freeMemory: 2042802184; totalMemory: 2058354688; maxMemory: 2058354688 INFO 2016-09-13 06:39:03 MarkDuplicates Reading input file and constructing read end information. INFO 2016-09-13 06:39:03 MarkDuplicates Will retain up to 7916748 data points before spilling to disk. [Tue Sep 13 06:39:04 BST 2016] picard.sam.markduplicates.MarkDuplicates done. Elapsed time: 0.01 minutes. Runtime.totalMemory()=2058354688 To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp Exception in thread "main" java.lang.IllegalStateException: A valid CRAM reference was not supplied and one cannot be acquired via the property settings reference_fasta or use_cram_ref_download at htsjdk.samtools.cram.ref.ReferenceSource.getDefaultCRAMReferenceSource(ReferenceSource.java:107) at htsjdk.samtools.SamReaderFactory$SamReaderFactoryImpl.open(SamReaderFactory.java:301)
at picard.sam.markduplicates.util.AbstractMarkDuplicatesCommandLineProgram.openInputs(AbstractMarkDuplicatesCommandLineProgram.java:212)
at picard.sam.markduplicates.MarkDuplicates.doWork(MarkDuplicates.java:220)
at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:208)
at picard.cmdline.PicardCommandLine.instanceMain(PicardCommandLine.java:95)
at picard.cmdline.PicardCommandLine.main(PicardCommandLine.java:105)

Many thanks,

Carmen

• Cambridge, UKMember Posts: 5

Hello,
Yes, the data is actually indexed. So I guess it is not possible to work with Crams at the moment. That's not problem. I will continue with my Bams. I will also give it a try with the conversion tool as you suggest.
Cheers!

• Cambridge, UKMember Posts: 5

Hello, Thank you for looking into this Geraldine. The bug in samtools is fixed now so it can be used to convert to bam.