public class CramIO extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CRAM_FILE_EXTENSION |
static byte[] |
ZERO_B_EOF_MARKER
The 'zero-B' EOF marker as per CRAM specs v2.1.
|
static byte[] |
ZERO_F_EOF_MARKER
The zero-F EOF marker as per CRAM specs v3.0.
|
| Constructor and Description |
|---|
CramIO() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkHeaderAndEOF(File file)
Check if the file: 1) contains proper CRAM header.
|
static long |
issueEOF(Version version,
OutputStream outputStream)
Write an end-of-file marker to the
OutputStream. |
static CramHeader |
readCramHeader(InputStream inputStream)
Read CRAM header from the given
InputStream. |
static boolean |
replaceCramHeader(File file,
CramHeader newHeader)
Attempt to replace the SAM file header in the CRAM file.
|
static long |
writeCramHeader(CramHeader cramHeader,
OutputStream outputStream)
Writes CRAM header into the specified
OutputStream. |
static long |
writeHeader(Version cramVersion,
OutputStream outStream,
SAMFileHeader samFileHeader,
String cramID)
Write a CRAM File header and a SAM Header to an output stream.
|
public static final String CRAM_FILE_EXTENSION
public static final byte[] ZERO_B_EOF_MARKER
public static final byte[] ZERO_F_EOF_MARKER
public static long issueEOF(Version version, OutputStream outputStream) throws IOException
OutputStream. The specific EOF marker is chosen based on the CRAM version.version - the CRAM version to assumeoutputStream - the stream to write toIOException - as per java IO contractpublic static long writeHeader(Version cramVersion, OutputStream outStream, SAMFileHeader samFileHeader, String cramID)
cramVersion - outStream - samFileHeader - cramID - public static boolean checkHeaderAndEOF(File file) throws IOException
file - the CRAM file to checkIOException - as per java IO contractpublic static long writeCramHeader(CramHeader cramHeader, OutputStream outputStream) throws IOException
OutputStream.cramHeader - the CramHeader object to writeoutputStream - the output stream to write toIOException - as per java IO contractpublic static CramHeader readCramHeader(InputStream inputStream) throws IOException
InputStream.inputStream - input stream to read fromCramHeader objectIOException - as per java IO contractpublic static boolean replaceCramHeader(File file, CramHeader newHeader) throws IOException
file - the CRAM filenewHeader - the new CramHeader container a new SAM file headerIOException - as per java IO contract