Package htsjdk.beta.codecs.reads.cram
Class CRAMEncoder
java.lang.Object
htsjdk.beta.codecs.reads.cram.CRAMEncoder
- All Implemented Interfaces:
HtsEncoder<SAMFileHeader,
,SAMRecord> ReadsEncoder
,Closeable
,AutoCloseable
- Direct Known Subclasses:
CRAMEncoderV2_1
,CRAMEncoderV3_0
InternalAPI
Base class for
BundleResourceType.READS_CRAM
decoders.-
Constructor Summary
ConstructorDescriptionCRAMEncoder
(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions) InternalAPI Create a CRAM encoder for the given output bundle. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close any resources associated with this decoder.static CRAMReferenceSource
getCRAMReferenceSource
(CRAMEncoderOptions cramEncoderOptions) Return aCRAMReferenceSource
using theReadsEncoderOptions
, or a default source.final String
Get a user-friendly display name for this encoder.final String
Get the name of the file format supported by this encoder.Get the outputBundle
for this encoder.Get theReadsEncoderOptions
for this encoder.void
setHeader
(SAMFileHeader samFileHeader) Set the file format header for this decoder, of typeHtsEncoder
.void
Write a single record to the underlying output.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface htsjdk.beta.plugin.HtsEncoder
getVersion
-
Constructor Details
-
CRAMEncoder
InternalAPI Create a CRAM encoder for the given output bundle. The primary resource in the bundle must have content typeBundleResourceType.ALIGNED_READS
(to find a decoder for a bundle, seeReadsResolver
).- Parameters:
outputBundle
- bundle to encodereadsEncoderOptions
- options to use
-
-
Method Details
-
getFileFormat
Description copied from interface:HtsEncoder
Get the name of the file format supported by this encoder. The format name defines the underlying format handled by this encoder, and also corresponds to the format of the primary bundle resource that is required when encoding (seeBundleResourceType
andBundleResource.getFileFormat()
).- Specified by:
getFileFormat
in interfaceHtsEncoder<SAMFileHeader,
SAMRecord> - Returns:
- the name of the underlying file format handled by this encoder
-
getDisplayName
Description copied from interface:HtsEncoder
Get a user-friendly display name for this encoder.- Specified by:
getDisplayName
in interfaceHtsEncoder<SAMFileHeader,
SAMRecord> - Returns:
- a user-friendly display name for this encoder for use in error and warning messages
-
setHeader
Description copied from interface:HtsEncoder
Set the file format header for this decoder, of typeHtsEncoder
.HtsEncoder.setHeader(HtsHeader)
must be called beforeHtsEncoder.write(HtsRecord)
can be called.- Specified by:
setHeader
in interfaceHtsEncoder<SAMFileHeader,
SAMRecord> - Parameters:
samFileHeader
- to use
-
write
Description copied from interface:HtsEncoder
Write a single record to the underlying output.HtsEncoder.write(HtsRecord)
may only called afterHtsEncoder.setHeader(HtsHeader)
has been called.- Specified by:
write
in interfaceHtsEncoder<SAMFileHeader,
SAMRecord> - Parameters:
record
- record to write
-
close
public void close()Description copied from interface:HtsEncoder
Close any resources associated with this decoder.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceHtsEncoder<SAMFileHeader,
SAMRecord>
-
getOutputBundle
Get the outputBundle
for this encoder.- Returns:
- the output
Bundle
for this encoder
-
getReadsEncoderOptions
Get theReadsEncoderOptions
for this encoder.- Returns:
- the
ReadsEncoderOptions
for this encoder.
-
getCRAMReferenceSource
@InternalAPI public static CRAMReferenceSource getCRAMReferenceSource(CRAMEncoderOptions cramEncoderOptions) Return aCRAMReferenceSource
using theReadsEncoderOptions
, or a default source.- Parameters:
cramEncoderOptions
- CRAMEncoderOptions options to use- Returns:
- a
CRAMReferenceSource
-