bio.std.hts.bam.tagvalue

BAM records may carry arbitrary information in tags.
Value type provides convenient way to work with this information.

Public Imports

std.conv
public import std.conv;

Members

Aliases

ArrayElementTagValueTypes
alias ArrayElementTagValueTypes = TypeTuple!(CharToType!('c', byte), CharToType!('C', ubyte), CharToType!('s', short), CharToType!('S', ushort), CharToType!('i', int), CharToType!('I', uint), CharToType!('f', float))
Undocumented in source.
PrimitiveTagValueTypes
alias PrimitiveTagValueTypes = TypeTuple!(CharToType!('A', char), CharToType!('c', byte), CharToType!('C', ubyte), CharToType!('s', short), CharToType!('S', ushort), CharToType!('i', int), CharToType!('I', uint), CharToType!('f', float))
Undocumented in source.
StringTagValueTypes
alias StringTagValueTypes = TypeTuple!(CharToType!('Z', string), CharToType!('H', string))
Undocumented in source.
TypeIdMap
alias TypeIdMap = TypeTuple!(TypeId!(char, 0b001_00_1_00), TypeId!(ubyte, 0b001_0_0000), TypeId!(ushort, 0b010_0_0000), TypeId!(uint, 0b100_0__0__0__0__0), TypeId!(byte, 0b001_1_0000), TypeId!(short, 0b010_1_0000), TypeId!(int, 0b100_1_0000), TypeId!(float, 0b100_01_000), TypeId!(ubyte[], 0b001_000_01), TypeId!(ushort[], 0b010_000_01), TypeId!(uint[], 0b100_000_01), TypeId!(byte[], 0b001_100_01), TypeId!(short[], 0b010_100_01), TypeId!(int[], 0b100_100_01), TypeId!(float[], 0b100_01_001), TypeId!(string, 0b001_00_101), TypeId!(string, 0b001_01_101), TypeId!(typeof(null), 0b0000_0010))
Undocumented in source.

Classes

UnknownTagTypeException
class UnknownTagTypeException

Thrown in case of unrecognized tag type

Functions

charToSizeof
uint charToSizeof(char c)
Undocumented in source. Be warned that the author may not have intended to support it.
generateUnion
string generateUnion()
Undocumented in source. Be warned that the author may not have intended to support it.
injectOpAssign
string injectOpAssign()
Undocumented in source. Be warned that the author may not have intended to support it.
injectOpCast
string injectOpCast()
Undocumented in source. Be warned that the author may not have intended to support it.
readValueFromArray
Value readValueFromArray(char type, const(ubyte)[] bytes, size_t offset)
Undocumented in source. Be warned that the author may not have intended to support it.

Structs

CharToType
struct CharToType(char c, T)
Undocumented in source.
TypeId
struct TypeId(T, ubyte id)
Undocumented in source.
Value
struct Value

Struct for representing tag values.

Templates

ArrayOf
template ArrayOf(T)
Undocumented in source.
GetTypeId
template GetTypeId(T)

Get tag for type T.

Examples

import bio.std.hts.bam.reader, bio.std.hts.bam.tagvalue;
...
auto bam = new BamReader("file.bam");
Value v = bam.reads.front["MD"];
assert(v.is_string);
v = 5;
assert(v.is_signed);     // because 5 is of type int which is signed
assert(v == "5");        // converted to string and then compared
v = "abc";
assert(v.is_string);
v = [1, 2, 3];           // integer and float arrays are supported
assert(v.is_numeric_array);
v = [1.5f, 2.3f, 17.0f]; // double[] arrays must be converted to float[]
assert(v.is_numeric_array);
v = 5.6;
assert(v.is_float);
v = -17;
assert(v.is_signed);

Meta