/** * Create a CRAMFileReader from a file and optional index file using the supplied reference source. If index file * is supplied then random access will be available. * * @param cramFile CRAM file to read. May not be null. * @param indexFile index file to be used for random access. May be null. * @param referenceSource a {@link htsjdk.samtools.cram.ref.CRAMReferenceSource source} of * reference sequences. May not be null. * @throws IllegalArgumentException if the {@code cramFile} or the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final File indexFile, final CRAMReferenceSource referenceSource) { if (cramFile == null) throw new IllegalArgumentException("File is required."); if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; mIndexFile = findIndexForFile(indexFile, cramFile); this.referenceSource = referenceSource; getIterator(); }
/** * Create a CRAMFileReader from a file using the supplied reference source. * * @param cramFile CRAM file to read. Can not be null. * @param referenceSource a {@link htsjdk.samtools.cram.ref.CRAMReferenceSource source} of * reference sequences. May not be null. * @throws IllegalArgumentException if the {@code cramFile} or the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final CRAMReferenceSource referenceSource) { if (cramFile == null) throw new IllegalArgumentException("CRAM file cannot be null."); if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; this.referenceSource = referenceSource; mIndexFile = findIndexForFile(null, cramFile); getIterator(); }
/** * Create a CRAMFileReader from a file using the supplied reference source. * * @param cramFile CRAM file to read. Can not be null. * @param referenceSource a {@link htsjdk.samtools.cram.ref.CRAMReferenceSource source} of * reference sequences. May not be null. * @throws IllegalArgumentException if the {@code cramFile} or the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final CRAMReferenceSource referenceSource) { if (cramFile == null) throw new IllegalArgumentException("CRAM file cannot be null."); if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; this.referenceSource = referenceSource; mIndexFile = findIndexForFile(null, cramFile); getIterator(); }
/** * Create a CRAMFileReader from a file and optional index file using the supplied reference source. If index file * is supplied then random access will be available. * * @param cramFile CRAM file to read. May not be null. * @param indexFile index file to be used for random access. May be null. * @param referenceSource a {@link htsjdk.samtools.cram.ref.CRAMReferenceSource source} of * reference sequences. May not be null. * @throws IllegalArgumentException if the {@code cramFile} or the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final File indexFile, final CRAMReferenceSource referenceSource) { if (cramFile == null) throw new IllegalArgumentException("File is required."); if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; mIndexFile = findIndexForFile(indexFile, cramFile); this.referenceSource = referenceSource; getIterator(); }
/** * Create a CRAMFileReader from either a file or input stream using the supplied reference source. * * @param cramFile CRAM file to read * @param inputStream CRAM stream to read * @param referenceSource a {@link htsjdk.samtools.cram.ref.ReferenceSource source} of * reference sequences. May not be null. * * @throws IllegalArgumentException if the {@code cramFile} and the {@code inputStream} are both null * or if the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final InputStream inputStream, final CRAMReferenceSource referenceSource) { if (cramFile == null && inputStream == null) { throw new IllegalArgumentException("Either file or input stream is required."); } if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; this.inputStream = inputStream; this.referenceSource = referenceSource; if (cramFile != null) { mIndexFile = findIndexForFile(null, cramFile); } getIterator(); }
/** * Create a CRAMFileReader from either a file or input stream using the supplied reference source. * * @param cramFile CRAM file to read * @param inputStream CRAM stream to read * @param referenceSource a {@link htsjdk.samtools.cram.ref.ReferenceSource source} of * reference sequences. May not be null. * * @throws IllegalArgumentException if the {@code cramFile} and the {@code inputStream} are both null * or if the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final InputStream inputStream, final CRAMReferenceSource referenceSource) { if (cramFile == null && inputStream == null) { throw new IllegalArgumentException("Either file or input stream is required."); } if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; this.inputStream = inputStream; this.referenceSource = referenceSource; if (cramFile != null) { mIndexFile = findIndexForFile(null, cramFile); } getIterator(); }
/** * Create a CRAMFileReader from a CRAM file and optional index file using the supplied reference * source and validation stringency. * * @param cramFile CRAM stream to read. May not be null. * @param indexFile index file to be used for random access. May be null. * @param referenceSource a {@link htsjdk.samtools.cram.ref.CRAMReferenceSource source} of * reference sequences. May not be null. * @param validationStringency Validation stringency to be used when reading * * @throws IllegalArgumentException if the {@code cramFile} or the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final File indexFile, final CRAMReferenceSource referenceSource, final ValidationStringency validationStringency) throws IOException { if (cramFile == null) { throw new IllegalArgumentException("Input file can not be null for CRAM reader"); } if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; this.referenceSource = referenceSource; this.mIndexFile = findIndexForFile(indexFile, cramFile); final SeekableFileStream indexStream = this.mIndexFile == null ? null : new SeekableFileStream(this.mIndexFile); initWithStreams(new FileInputStream(cramFile), indexStream, validationStringency); }
/** * Create a CRAMFileReader from a CRAM file and optional index file using the supplied reference * source and validation stringency. * * @param cramFile CRAM stream to read. May not be null. * @param indexFile index file to be used for random access. May be null. * @param referenceSource a {@link htsjdk.samtools.cram.ref.CRAMReferenceSource source} of * reference sequences. May not be null. * @param validationStringency Validation stringency to be used when reading * * @throws IllegalArgumentException if the {@code cramFile} or the {@code CRAMReferenceSource} is null */ public CRAMFileReader(final File cramFile, final File indexFile, final CRAMReferenceSource referenceSource, final ValidationStringency validationStringency) throws IOException { if (cramFile == null) { throw new IllegalArgumentException("Input file can not be null for CRAM reader"); } if (referenceSource == null) { throw new IllegalArgumentException("A reference is required for CRAM readers"); } this.cramFile = cramFile; this.referenceSource = referenceSource; this.mIndexFile = findIndexForFile(indexFile, cramFile); final SeekableFileStream indexStream = this.mIndexFile == null ? null : new SeekableFileStream(this.mIndexFile); initWithStreams(new FileInputStream(cramFile), indexStream, validationStringency); }