@Override public void close() throws IOException { bamFileReader.close(); }
@Override public void close() throws IOException { bamFileReader.close(); }
/** Reads through the header and sequence records to find the virtual file offset of the first record in the BAM file. */ static long findVirtualOffsetOfFirstRecord(final File bam) throws IOException { final BAMFileReader reader = new BAMFileReader(bam, null, false, ValidationStringency.SILENT, new DefaultSAMRecordFactory()); final long offset = reader.mFirstRecordPointer; reader.close(); return offset; }
/** Reads through the header and sequence records to find the virtual file offset of the first record in the BAM file. */ static long findVirtualOffsetOfFirstRecord(final File bam) throws IOException { final BAMFileReader reader = new BAMFileReader(bam, null, false, false, ValidationStringency.SILENT, new DefaultSAMRecordFactory()); final long offset = reader.mFirstRecordPointer; reader.close(); return offset; }
/** Reads through the header and sequence records to find the virtual file offset of the first record in the BAM file. */ static long findVirtualOffsetOfFirstRecord(final File bam) throws IOException { final BAMFileReader reader = new BAMFileReader(bam, null, false, false, ValidationStringency.SILENT, new DefaultSAMRecordFactory()); final long offset = reader.mFirstRecordPointer; reader.close(); return offset; }
/** Reads through the header and sequence records to find the virtual file offset of the first record in the BAM file. */ static long findVirtualOffsetOfFirstRecord(final File bam) throws IOException { final BAMFileReader reader = new BAMFileReader(bam, null, false, false, ValidationStringency.SILENT, new DefaultSAMRecordFactory()); final long offset = reader.mFirstRecordPointer; reader.close(); return offset; }
public static void main(String[] args) throws IOException { Log.setGlobalLogLevel(LogLevel.INFO); File bamFile = new File(args[0]); File outCramFile = new File(args[1]); ReferenceSource source = new ReferenceSource(new File(args[2])); int maxThreads = Integer.valueOf(args[3]); BAMFileReader reader = new BAMFileReader(bamFile, null, false, false, ValidationStringency.SILENT, new DefaultSAMRecordFactory()); OutputStream os = new FileOutputStream(outCramFile); CRAMFileWriter writer = new CRAMFileWriter(os, source, reader.getFileHeader(), outCramFile.getName(), maxThreads); CloseableIterator<SAMRecord> iterator = reader.getIterator(); while (iterator.hasNext()) { SAMRecord record = iterator.next(); writer.addAlignment(record); } writer.close(); reader.close(); }