Converting CRAM to FastQ
1
0
Entering edit mode
7 months ago
Maverick ▴ 10

I am trying to convert a cram file into fastq without reference. The command I am using is:

SamToFastq - I <path_to_cram_file> -F "<path_to_first_fastq>" -F2 "<path_to_second_fastq>"

This is the error that shows up:

java.lang.IllegalArgumentException: Failure getting reference bases for sequence chr1
    at htsjdk.samtools.cram.build.CRAMReferenceRegion.fetchReferenceBasesByRegion(CRAMReferenceRegion.java:172)
    at htsjdk.samtools.cram.build.CRAMReferenceRegion.fetchReferenceBasesByRegion(CRAMReferenceRegion.java:192)
    at htsjdk.samtools.cram.structure.Slice.normalizeCRAMRecords(Slice.java:450)
    at htsjdk.samtools.cram.structure.Container.getSAMRecords(Container.java:322)
    at htsjdk.samtools.CRAMIterator.nextContainer(CRAMIterator.java:112)
    at htsjdk.samtools.CRAMIterator.hasNext(CRAMIterator.java:204)
    at htsjdk.samtools.SamReader$AssertingIterator.hasNext(SamReader.java:608)
    at picard.sam.SamToFastq.doWork(SamToFastq.java:204)
    at picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:280)
    at org.broadinstitute.hellbender.cmdline.PicardCommandLineProgramExecutor.instanceMain(PicardCommandLineProgramExecutor.java:37)
    at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:166)
    at org.broadinstitute.hellbender.Main.mainEntry(Main.java:209)
    at org.broadinstitute.hellbender.Main.main(Main.java:306)

This is the output I received when I tried to view the cram file

This is the snapshot of the cram file when I tried to view it using ViewSam

Is there not a way to convert them without the reference file?

GATK samtools cram SamToFastq fastq • 925 views
ADD COMMENT
2
Entering edit mode
7 months ago
GenoMax 148k

Use samtools view for this conversion. See discussion in Questions about a bug when transferring cram file to bam file

Specifically @jkbonfield's comment here --> Questions about a bug when transferring cram file to bam file

ADD COMMENT
0
Entering edit mode

Thank you so much! Will look it up right away.

ADD REPLY
0
Entering edit mode

enter image description hereI was able to get my fastq files. I can see that my reference files are cached in a hts-ref directory but in multiple files as seen in the screenshot below. I want to run these fastq files now into my GATK pipeline that follows the GATK best practices workflow of broad.It requires a fasta file for running the bwa mem. is there a way to compile this cached ref files into a single fasta file? What would be the ideal way to handle this?

Thank you again!

ADD REPLY
1
Entering edit mode

You can use any reference that you like at this point. Since you are planning to use GATK, you can get their version from the resource bundle available from their public cloud bucket here: https://console.cloud.google.com/storage/browser/genomics-public-data/resources/broad/hg38/v0/ There are pre-made indexes there as well.

ADD REPLY
0
Entering edit mode

Understood Thank you!

ADD REPLY

Login before adding your answer.

Traffic: 1419 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6