@@ -0,0 +1,1291 @@
+package htsjdk.samtools.cram;%0A%0Aimport htsjdk.samtools.SAMFileHeader;%0Aimport htsjdk.samtools.cram.build.ContainerFactory;%0Aimport htsjdk.samtools.cram.build.Sam2CramRecordFactory;%0Aimport htsjdk.samtools.cram.common.CramVersions;%0Aimport htsjdk.samtools.cram.ref.ReferenceTracks;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport net.sf.cram.ref.ReferenceSource;%0A%0A/**%0A * Conversion context: holds all info required for converting SAMRecords to CRAM%0A * container.%0A * %0A * @author vadim%0A *%0A */%0Apublic class CramContext %7B%0A%09private static final int RECORDS_PER_SLICE = 10000;%0A%09public SAMFileHeader samFileHeader;%0A%09public ReferenceSource referenceSource;%0A%09public Map%3CInteger, ReferenceTracks%3E tracks = new HashMap%3CInteger, ReferenceTracks%3E();%0A%09public CramLossyOptions lossyOptions;%0A%09public long recordIndex = 0;%0A%0A%09Sam2CramRecordFactory sam2cramFactory;%0A%09ContainerFactory containerFactory;%0A%0A%09public CramContext(SAMFileHeader samFileHeader, ReferenceSource referenceSource, CramLossyOptions lossyOptions) %7B%0A%09%09this.samFileHeader = samFileHeader;%0A%09%09this.referenceSource = referenceSource;%0A%09%09this.lossyOptions = lossyOptions;%0A%0A%09%09sam2cramFactory = new Sam2CramRecordFactory(null, samFileHeader, CramVersions.CRAM_v3);%0A%09%09containerFactory = new ContainerFactory(samFileHeader, RECORDS_PER_SLICE);%0A%09%7D%0A%7D%0A

context for conversion to CRAM