Package htsjdk.samtools
Class TextTagCodec
java.lang.Object
htsjdk.samtools.TextTagCodec
Converter between SAM text representation of a tag, and in-memory Object representation.
Note that this class is not thread-safe, in that some local variables have been made into instance
variables in order to reduce object creation, but it should not ever be the case that the same
instance is used in multiple threads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvert typed tag in SAM text format (name:type:value) into tag name and Object value representation.Convert in-memory representation of tag to SAM text representation.encodeUntypedTag
(String tagName, Object value) Encode a standard header tag, which should not have a type field.
-
Constructor Details
-
TextTagCodec
public TextTagCodec()
-
-
Method Details
-
encode
Convert in-memory representation of tag to SAM text representation.- Parameters:
tagName
- Two-character tag name.value
- Tag value as appropriate Object subclass.- Returns:
- SAM text String representation, i.e. name:type:value
-
encodeUntypedTag
Encode a standard header tag, which should not have a type field.- Parameters:
tagName
- 2-character String.value
- Not necessarily a String. Some of these are integers but the type is implied by the tagName. Converted to String with toString().- Returns:
- Colon-separated text representation suitable for a SAM header, i.e. name:value.
-
decode
Convert typed tag in SAM text format (name:type:value) into tag name and Object value representation.- Parameters:
tag
- SAM text format name:type:value tag.- Returns:
- Tag name as 2-character String, and tag value in appropriate class based on tag type. If value is an unsigned array, then the value is a TagValueAndUnsignedArrayFlag object.
-