Merge pull request #1113 from broadinstitute/ks_cram_with_index

Switched to using CRAM's SamReader.Indexing implementation.
This commit is contained in:
kshakir 2015-08-11 21:47:10 -03:00
commit d77611292f
16 changed files with 107 additions and 90 deletions

View File

@ -642,7 +642,7 @@ public class GenomeAnalysisEngine {
// If reads are present, assume that accessing the reads is always the dominant factor and shard based on that supposition.
if(!readsDataSource.isEmpty()) {
if(!readsDataSource.hasIndex() && !exclusions.contains(ValidationExclusion.TYPE.ALLOW_UNINDEXED_BAM))
throw new UserException.CommandLineException("Cannot process the provided BAM file(s) because they were not indexed. The GATK does offer limited processing of unindexed BAMs in --unsafe mode, but this GATK feature is currently unsupported.");
throw new UserException.CommandLineException("Cannot process the provided BAM/CRAM file(s) because they were not indexed. The GATK does offer limited processing of unindexed BAM/CRAMs in --unsafe mode, but this feature is unsupported -- use it at your own risk!");
if(!readsDataSource.hasIndex() && intervals != null && !argCollection.allowIntervalsWithUnindexedBAM)
throw new UserException.CommandLineException("Cannot perform interval processing when reads are present but no index is available.");

View File

@ -56,15 +56,15 @@ public class GATKArgumentCollection {
// parameters and their defaults
/**
* An input file containing sequence data mapped to a reference, in SAM or BAM format, or a text file containing a
* list of input files (with extension .list). Note that the GATK requires an accompanying index for each SAM or
* BAM file. Please see our online documentation for more details on input formatting requirements.
* An input file containing sequence data mapped to a reference, in BAM or CRAM format, or a text file containing a
* list of input files (with extension .list). Note that the GATK requires an accompanying .bai index for each BAM
* or CRAM file. Please see our online documentation for more details on input formatting requirements.
*/
@Input(fullName = "input_file", shortName = "I", doc = "Input file containing sequence data (SAM or BAM)", required = false)
@Input(fullName = "input_file", shortName = "I", doc = "Input file containing sequence data (BAM or CRAM)", required = false)
public List<String> samFiles = new ArrayList<>();
@Advanced
@Argument(fullName = "showFullBamList",doc="Emit a log entry (level INFO) containing the full list of sequence data files to be included in the analysis (including files inside .bam.list files).")
@Argument(fullName = "showFullBamList",doc="Emit a log entry (level INFO) containing the full list of sequence data files to be included in the analysis (including files inside .bam.list or .cram.list files).")
public Boolean showFullBamList = false;
@Advanced
@ -278,8 +278,8 @@ public class GATKArgumentCollection {
public boolean FIX_MISENCODED_QUALS = false;
/**
* This flag tells GATK to ignore warnings when encountering base qualities that are too high and that seemingly
* indicate a problem with the base quality encoding of the BAM file. You should only use this if you really know
* what you are doing; otherwise you could seriously mess up your data and ruin your analysis.
* indicate a problem with the base quality encoding of the BAM or CRAM file. You should only use this if you really
* know what you are doing; otherwise you could seriously mess up your data and ruin your analysis.
*/
@Argument(fullName = "allow_potentially_misencoded_quality_scores", shortName="allowPotentiallyMisencodedQuals", doc="Ignore warnings about base quality score encoding", required = false)
public boolean ALLOW_POTENTIALLY_MISENCODED_QUALS = false;
@ -320,7 +320,8 @@ public class GATKArgumentCollection {
/**
* Enables on-the-fly recalibrate of base qualities, intended primarily for use with BaseRecalibrator and PrintReads
* (see Best Practices workflow documentation). The covariates tables are produced by the BaseRecalibrator tool.
* Please be aware that you should only run recalibration with the covariates file created on the same input bam(s).
* Please be aware that you should only run recalibration with the covariates file created on the same input BAM(s)
* or CRAM(s).
*/
@Input(fullName="BQSR", shortName="BQSR", required=false, doc="Input covariates table file for on-the-fly base quality score recalibration")
public File BQSR_RECAL_FILE = null;
@ -343,14 +344,14 @@ public class GATKArgumentCollection {
public boolean disableIndelQuals = false;
/**
* By default, the OQ tag in not emitted when using the -BQSR argument. Use this flag to include OQ tags in the output BAM file.
* By default, the OQ tag in not emitted when using the -BQSR argument. Use this flag to include OQ tags in the output BAM or CRAM file.
* Note that this may results in significant file size increase.
*/
@Argument(fullName="emit_original_quals", shortName = "EOQ", doc = "Emit the OQ tag with the original base qualities (with -BQSR)", required=false)
public boolean emitOriginalQuals = false;
/**
* This flag tells GATK not to modify quality scores less than this value. Instead they will be written out unmodified in the recalibrated BAM file.
* This flag tells GATK not to modify quality scores less than this value. Instead they will be written out unmodified in the recalibrated BAM or CRAM file.
* In general it's unsafe to change qualities scores below < 6, since base callers use these values to indicate random or bad bases.
* For example, Illumina writes Q2 bases when the machine has really gone wrong. This would be fine in and of itself,
* but when you select a subset of these reads based on their ability to align to the reference and their dinucleotide effect,
@ -379,7 +380,7 @@ public class GATKArgumentCollection {
@Argument(fullName = "validation_strictness", shortName = "S", doc = "How strict should we be with validation", required = false)
public ValidationStringency strictnessLevel = ValidationStringency.SILENT;
/**
* Some tools keep program records in the SAM header by default. Use this argument to override that behavior and discard program records for the SAM header.
* Some tools keep program records in the SAM header by default. Use this argument to override that behavior and discard program records for the SAM header. Does not work on CRAM files.
*/
@Argument(fullName = "remove_program_records", shortName = "rpr", doc = "Remove program records from the SAM header", required = false)
public boolean removeProgramRecords = false;
@ -390,12 +391,12 @@ public class GATKArgumentCollection {
public boolean keepProgramRecords = false;
/**
* On-the-fly sample renaming works only with single-sample BAM and VCF files. Each line of the mapping file must
* contain the absolute path to a BAM or VCF file, followed by whitespace, followed by the new sample name for that
* BAM or VCF file. The sample name may contain non-tab whitespace, but leading or trailing whitespace will be
* ignored. The engine will verify at runtime that each BAM/VCF targeted for sample renaming has only a single
* sample specified in its header (though, in the case of BAM files, there may be multiple read groups for that
* sample).
* On-the-fly sample renaming works only with single-sample BAM, CRAM, and VCF files. Each line of the mapping file
* must contain the absolute path to a BAM, CRAM, or VCF file, followed by whitespace, followed by the new sample
* name for that BAM, CRAM, or VCF file. The sample name may contain non-tab whitespace, but leading or trailing
* whitespace will be ignored. The engine will verify at runtime that each BAM/CRAM/VCF targeted for sample
* renaming has only a single sample specified in its header (though, in the case of BAM/CRAM files, there may be
* multiple read groups for that sample).
*/
@Advanced
@Argument(fullName = "sample_rename_mapping_file", shortName = "sample_rename_mapping_file", doc = "Rename sample IDs on-the-fly at runtime using the provided mapping file", required = false)
@ -453,12 +454,12 @@ public class GATKArgumentCollection {
@Advanced
@Argument(fullName = "simplifyBAM", shortName = "simplifyBAM",
doc = "If provided, output BAM files will be simplified to include just key reads for downstream variation discovery analyses (removing duplicates, PF-, non-primary reads), as well stripping all extended tags from the kept reads except the read group identifier",
doc = "If provided, output BAM/CRAM files will be simplified to include just key reads for downstream variation discovery analyses (removing duplicates, PF-, non-primary reads), as well stripping all extended tags from the kept reads except the read group identifier",
required = false)
public boolean simplifyBAM = false;
@Advanced
@Argument(fullName = "disable_bam_indexing", doc = "Turn off on-the-fly creation of indices for output BAM files.",
@Argument(fullName = "disable_bam_indexing", doc = "Turn off on-the-fly creation of indices for output BAM/CRAM files.",
required = false)
public boolean disableBAMIndexing = false;
@ -488,7 +489,7 @@ public class GATKArgumentCollection {
@Argument(fullName="num_cpu_threads_per_data_thread", shortName = "nct", doc="Number of CPU threads to allocate per data thread", required = false, minValue = 1)
public int numberOfCPUThreadsPerDataThread = 1;
@Argument(fullName="num_io_threads", shortName = "nit", doc="Number of given threads to allocate to IO", required = false, minValue = 0)
@Argument(fullName="num_io_threads", shortName = "nit", doc="Number of given threads to allocate to BAM IO", required = false, minValue = 0)
@Hidden
public int numberOfIOThreads = 0;
@ -500,7 +501,8 @@ public class GATKArgumentCollection {
@Argument(fullName = "monitorThreadEfficiency", shortName = "mte", doc = "Enable threading efficiency monitoring", required = false)
public Boolean monitorThreadEfficiency = false;
@Argument(fullName = "num_bam_file_handles", shortName = "bfh", doc="Total number of BAM file handles to keep open simultaneously", required=false, minValue = 1)
@Argument(fullName = "num_bam_file_handles", shortName = "bfh", doc="When using IO threads, total number of BAM file handles to keep open simultaneously", required=false, minValue = 1)
@Hidden
public Integer numberOfBAMFileHandles = null;
/**
* This will filter out read groups matching <TAG>:<STRING> (e.g. SM:sample1) or a .txt file containing the filter strings one per line.
@ -598,7 +600,7 @@ public class GATKArgumentCollection {
/**
* NO INTEGRATION TESTS are available. Use at your own risk.
*/
@Argument(fullName="allow_intervals_with_unindexed_bam",doc="Allow interval processing with an unsupported BAM",required=false)
@Argument(fullName="allow_intervals_with_unindexed_bam",doc="Allow interval processing with an unsupported BAM/CRAM",required=false)
@Hidden
public boolean allowIntervalsWithUnindexedBAM = false;

View File

@ -497,20 +497,13 @@ public class SAMDataSource {
* @return True if all readers that require an index for SAMFileSpan creation have an index.
*/
public boolean hasIndex() {
for (final SAMReaderID readerID: readerIDs)
if (isSAMFileSpanSupported(readerID))
if (!hasIndex(readerID))
return false;
for (final SAMReaderID readerID: readerIDs) {
if (!hasIndex(readerID)) {
return false;
}
}
return true;
}
/**
* Returns true if the reader can use file spans.
* @return true if file spans are supported.
*/
private boolean isSAMFileSpanSupported(final SAMReaderID readerID) {
// example: https://github.com/samtools/htsjdk/blob/ee4308ede60962f3ab4275473ac384724b471149/src/java/htsjdk/samtools/BAMFileReader.java#L341
return readerID.getSamFile().getName().toLowerCase().endsWith(SamReader.Type.BAM_TYPE.fileExtension());
}
/**
* Returns true if the reader caches its SAMFileHeader for each iterator.
@ -579,16 +572,7 @@ public class SAMDataSource {
SAMReaders readers = resourcePool.getAvailableReaders();
for ( SAMReaderID id: getReaderIDs() ) {
GATKBAMFileSpan span;
try {
span = new GATKBAMFileSpan(readers.getReader(id).indexing().getFilePointerSpanningReads());
} catch (RuntimeException e) {
if ("Not implemented.".equals(e.getMessage())) { https://github.com/samtools/htsjdk/blob/035d4319643657d715e93c53c13fe4a1f64e0188/src/java/htsjdk/samtools/CRAMFileReader.java#L197
span = new GATKBAMFileSpan(new GATKChunk(0, Long.MAX_VALUE));
} else {
throw e;
}
}
final GATKBAMFileSpan span = new GATKBAMFileSpan(readers.getReader(id).indexing().getFilePointerSpanningReads());
initialPositions.put(id, span);
}
@ -636,16 +620,7 @@ public class SAMDataSource {
}
else {
final SamReader reader = readers.getReader(id);
try {
iterator = ((SamReader.Indexing)reader).iterator(shard.getFileSpans().get(id));
} catch (RuntimeException re) {
if ("Not implemented.".equals(re.getMessage())) { // https://github.com/samtools/htsjdk/blob/429f2a8585d9c98a3efd4cedc5188b60b1e66ac5/src/java/htsjdk/samtools/CRAMFileReader.java#L192
// No way to jump into the file span. Query the whole file.
iterator = readers.getReader(id).iterator();
} else {
throw re;
}
}
iterator = ((SamReader.Indexing)reader).iterator(shard.getFileSpans().get(id));
}
} catch ( RuntimeException e ) { // we need to catch RuntimeExceptions here because the Picard code is throwing them (among SAMFormatExceptions) sometimes
throw new UserException.MalformedBAM(id.getSamFile(), e.getMessage());

View File

@ -75,12 +75,10 @@ public class SAMFileWriterStorage implements SAMFileWriter, Storage<SAMFileWrite
if(stub.getOutputFile() != null) {
try {
if (stub.getOutputFile().getName().toLowerCase().endsWith(".cram")) {
this.writer = createCRAMWriter(factory, stub.getFileHeader(), new FileOutputStream(file), this.referenceFasta);
this.writer = createCRAMWriter(factory, stub.getFileHeader(), file, this.referenceFasta);
} else {
this.writer = createBAMWriter(factory,stub.getFileHeader(),stub.isPresorted(),file,stub.getCompressionLevel());
}
} catch(IOException ex) {
throw new UserException.CouldNotCreateOutputFile(file, "file could not be created", ex);
} catch(RuntimeIOException ex) {
throw new UserException.CouldNotCreateOutputFile(file,"file could not be created",ex);
}
@ -129,9 +127,9 @@ public class SAMFileWriterStorage implements SAMFileWriter, Storage<SAMFileWrite
private SAMFileWriter createCRAMWriter(final SAMFileWriterFactory factory,
final SAMFileHeader header,
final OutputStream outputStream,
final File file,
final File referenceFasta) {
return factory.makeCRAMWriter(header, outputStream, referenceFasta);
return factory.makeCRAMWriter(header, file, referenceFasta);
}
private SAMFileWriter createBAMWriter(final SAMFileWriterFactory factory,

View File

@ -26,10 +26,11 @@
package org.broadinstitute.gatk.engine.arguments;
import org.broadinstitute.gatk.engine.walkers.WalkerTest;
import org.broadinstitute.gatk.utils.exceptions.UserException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.Collections;
/**
* Test the GATK core CRAM parsing mechanism.
@ -39,19 +40,13 @@ public class CramIntegrationTest extends WalkerTest {
public Object[][] getCRAMData() {
return new Object[][] {
{"PrintReads", "exampleBAM.bam", "", "cram", "fc6e3919a8a34266c89ef66e97ceaba9"},
//{"PrintReads", "exampleCRAM.cram", "", "cram", "026ebc00c2a8f9832e37f1a6a0f53521"}, https://github.com/samtools/htsjdk/issues/148
{"PrintReads", "exampleCRAM.cram", "", "bam", "99e5f740b43594a5b8e5bc1a007719e0"},
{"PrintReads", "exampleCRAM-noindex.cram", "", "bam", "99e5f740b43594a5b8e5bc1a007719e0"},
{"PrintReads", "exampleCRAM.cram", "", "cram", "fc6e3919a8a34266c89ef66e97ceaba9"},
{"PrintReads", "exampleCRAM.cram", "", "bam", "d89efbc3bd867749a2864ebd2d2cd6e1"},
{"PrintReads", "exampleCRAM.cram", " -L chr1:200", "bam", "072435e8272411c31b2234f851706384"},
{"PrintReads", "exampleCRAM-noindex.cram", " -L chr1:200", "bam", "072435e8272411c31b2234f851706384"},
{"CountLoci", "exampleCRAM.cram", "", "txt", "ade93df31a6150321c1067e749cae9be"},
{"CountLoci", "exampleCRAM-noindex.cram", "", "txt", "ade93df31a6150321c1067e749cae9be"},
{"CountLoci", "exampleCRAM.cram", " -L chr1:200", "txt", "b026324c6904b2a9cb4b88d6d61c81d1"},
{"CountLoci", "exampleCRAM-noindex.cram", " -L chr1:200", "txt", "b026324c6904b2a9cb4b88d6d61c81d1"},
{"CountReads", "exampleCRAM.cram", "", "txt", "4fbafd6948b6529caa2b78e476359875"},
{"CountReads", "exampleCRAM-noindex.cram", "", "txt", "4fbafd6948b6529caa2b78e476359875"},
{"CountReads", "exampleCRAM.cram", " -L chr1:200", "txt", "b026324c6904b2a9cb4b88d6d61c81d1"},
{"CountReads", "exampleCRAM-noindex.cram", " -L chr1:200", "txt", "b026324c6904b2a9cb4b88d6d61c81d1"},
{"PrintReads", "exampleCRAM.cram", " -L chr1:200 -L chr1:89597", "bam", "9598062587ad8d2ec596a8ecb19be979"},
{"CountLoci", "exampleCRAM.cram", " -L chr1:200 -L chr1:89597", "txt", "26ab0db90d72e28ad0ba1e22ee510510"},
{"CountReads", "exampleCRAM.cram", " -L chr1:200 -L chr1:89597", "txt", "6d7fce9fee471194aa8b5b6e47267f03"},
@ -67,8 +62,27 @@ public class CramIntegrationTest extends WalkerTest {
args +
" -o %s",
1, // just one output file
Arrays.asList(ext),
Arrays.asList(md5));
Collections.singletonList(ext),
Collections.singletonList(md5));
executeTest(String.format("testCRAM %s %s -> %s: %s", walker, input, ext, args), spec);
}
@DataProvider(name = "cramNoBaiData")
public Object[][] getCRAMNoBaiData() {
return new Object[][]{
{"exampleCRAM-nobai-nocrai.cram"},
{"exampleCRAM-nobai-withcrai.cram"},
};
}
@Test(dataProvider = "cramNoBaiData")
public void testCRAMNoBai(String input) {
WalkerTestSpec spec = new WalkerTestSpec(
" -T TestPrintReadsWalker" +
" -I " + publicTestDir + input +
" -R " + exampleFASTA,
0,
UserException.class);
executeTest(String.format("testCRAMNoBai %s", input), spec);
}
}

View File

@ -29,7 +29,6 @@ import org.broadinstitute.gatk.engine.walkers.WalkerTest;
import org.testng.annotations.Test;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
/**
@ -45,7 +44,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -R " + hg18Reference +
" -o %s",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testAllIntervalsImplicit",spec);
}
@ -84,6 +83,32 @@ public class IntervalIntegrationTest extends WalkerTest {
executeTest("testUnmappedReadInclusion",spec);
}
@Test
public void testMultipleIntervalInclusionOnCRAM() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-T TestPrintReadsWalker" +
" -I " + validationDataLocation + "MV1994.cram" +
" -R " + validationDataLocation + "Escherichia_coli_K12_MG1655.fasta" +
" -L Escherichia_coli_K12:11000" +
" -L Escherichia_coli_K12:12000" +
" -L Escherichia_coli_K12:13000" +
" -L Escherichia_coli_K12:14000" +
" -L Escherichia_coli_K12:15000" +
" -L Escherichia_coli_K12:16000" +
" -L Escherichia_coli_K12:17000" +
" -L unmapped",
0, // two output files
Collections.<String>emptyList());
// our base file
File baseOutputFile = createTempFile("testUnmappedReadInclusion", ".cram");
spec.setOutputFileLocation(baseOutputFile);
spec.addAuxFile("36b3dfdcc3a5ab4e240a6e3237101489", createTempFileFromBase(baseOutputFile.getAbsolutePath()));
spec.addAuxFile("ebbe6e311b6bb240554ec96ed9809216", createTempFileFromBase(baseOutputFile.getAbsolutePath() + ".bai"));
executeTest("testUnmappedReadInclusionCRAM", spec);
}
@Test
public void testMixedMappedAndUnmapped() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
@ -136,7 +161,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -o %s" +
" -L " + validationDataLocation + "intervalTest.1.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testIntervalParsingFromFile", spec);
}
@ -151,7 +176,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -L " + validationDataLocation + "intervalTest.1.vcf" +
" -L " + validationDataLocation + "intervalTest.2.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testIntervalMergingFromFiles", spec);
}
@ -166,7 +191,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -L " + validationDataLocation + "intervalTest.1.vcf" +
" -XL " + validationDataLocation + "intervalTest.2.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testIntervalExclusionsFromFiles", spec);
}
@ -181,7 +206,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -L " + validationDataLocation + "intervalTest.1.vcf" +
" -L chr1:1677524-1677528",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testMixedIntervalMerging", spec);
}
@ -195,7 +220,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -o %s" +
" -L " + validationDataLocation + "intervalTest.bed",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testBed", spec);
}
@ -209,7 +234,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -o %s" +
" -L " + validationDataLocation + "intervalTest.3.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testComplexVCF", spec);
}
@ -224,7 +249,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -o %s" +
" -L " + validationDataLocation + "intervalTest.3.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testComplexVCFWithPadding", spec);
}
@ -239,7 +264,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -L " + validationDataLocation + "intervalTest.1.vcf" +
" -XL " + validationDataLocation + "intervalTest.3.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testMergingWithComplexVCF", spec);
}
@ -253,7 +278,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -o %s" +
" -L " + validationDataLocation + "intervalTest.empty.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testEmptyVCFWarning", spec);
}
@ -268,7 +293,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -L " + validationDataLocation + "intervalTest.1.vcf" +
" -XL " + validationDataLocation + "intervalTest.1.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testIncludeExcludeIsTheSame", spec);
}
@ -282,7 +307,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -o %s" +
" -L " + privateTestDir + "symbolic_alleles_1.vcf",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testSymbolicAlleles", spec);
}
@ -298,7 +323,7 @@ public class IntervalIntegrationTest extends WalkerTest {
" -isr INTERSECTION" +
" -o %s",
1, // just one output file
Arrays.asList(md5));
Collections.singletonList(md5));
executeTest("testIntersectionOfLexicographicallySortedIntervals", spec);
}
}

View File

@ -32,6 +32,7 @@ import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class PrintReadsIntegrationTest extends WalkerTest {
@ -65,6 +66,7 @@ public class PrintReadsIntegrationTest extends WalkerTest {
// See: GATKBAMIndex.getStartOfLastLinearBin(), BAMScheduler.advance(), IntervalOverlapFilteringIterator.advance()
{new PRTest(b37KGReference, new String[]{"unmappedFlagReadsInLastLinearBin.bam"}, "", "d7f23fd77d7dc7cb50d3397f644c6d8a")},
{new PRTest(b37KGReference, new String[]{"unmappedFlagReadsInLastLinearBin.bam"}, " -L 1", "c601db95b20248d012b0085347fcb6d1")},
{new PRTest(b37KGReference, new String[]{"unmappedFlagReadsInLastLinearBin.cram"}, " -L 1:10001 -L GL000192.1:500204", "b16f6ed6cc1e7640b08bf9bcc86f1596")},
{new PRTest(b37KGReference, new String[]{"unmappedFlagReadsInLastLinearBin.bam"}, " -L unmapped", "2d32440e47e8d9d329902fe573ad94ce")},
{new PRTest(b37KGReference, new String[]{"unmappedFlagReadsInLastLinearBin.bam"}, " -L 1 -L unmapped", "c601db95b20248d012b0085347fcb6d1")},
{new PRTest(b37KGReference, new String[]{"oneReadAllInsertion.bam"}, "", "349650b6aa9e574b48a2a62627f37c7d")},
@ -98,7 +100,7 @@ public class PrintReadsIntegrationTest extends WalkerTest {
params.args +
" --no_pg_tag" +
" -o %s",
Arrays.asList(params.md5));
Collections.singletonList(params.md5));
executeTest("testPrintReads-"+params.args, spec).getFirst();
}

View File

@ -421,9 +421,9 @@ public abstract class CommandLineProgram {
throw new ReviewedGATKException("SamException found with no message!", t);
errorPrintf("------------------------------------------------------------------------------------------%n");
errorPrintf("A BAM ERROR has occurred (version %s): %n", getVersionNumber());
errorPrintf("A BAM/CRAM ERROR has occurred (version %s): %n", getVersionNumber());
errorPrintf("%n");
errorPrintf("This means that there is something wrong with the BAM file(s) you provided.%n");
errorPrintf("This means that there is something wrong with the BAM/CRAM file(s) you provided.%n");
errorPrintf("The error message below tells you what is the problem.%n");
errorPrintf("%n");
printDocumentationReference();
@ -432,6 +432,9 @@ public abstract class CommandLineProgram {
errorPrintf("- Make sure that your BAM file is well-formed by running Picard's validator on it%n");
errorPrintf("(see http://picard.sourceforge.net/command-line-overview.shtml#ValidateSamFile for details)%n");
errorPrintf("- Ensure that your BAM index is not corrupted: delete the current one and regenerate it with 'samtools index'%n");
errorPrintf("- Ensure that your CRAM index is not corrupted: delete the current one and regenerate it with%n");
errorPrintf("'java -jar cramtools-3.0.jar index --bam-style-index --input-file <input cram file> --reference-fasta-file <reference fasta file>'%n");
errorPrintf("(see https://github.com/enasequence/cramtools/tree/v3.0 for details)%n");
errorPrintf("%n");
errorPrintf("MESSAGE: %s%n", t.getMessage().trim());
errorPrintf("------------------------------------------------------------------------------------------%n");

View File

@ -26,14 +26,12 @@
package org.broadinstitute.gatk.utils.sam;
import htsjdk.samtools.*;
import htsjdk.samtools.cram.build.CramIO;
import org.broadinstitute.gatk.utils.GenomeLoc;
import org.broadinstitute.gatk.utils.GenomeLocParser;
import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;