SAMRecord

Encapsulates a SAM/BAM/CRAM record, using the bam1_t type for memory efficiency, and the htslib helper functions for speed.

Constructors

this
this()

Construct blank SAMRecord with empty backing bam1_t

this
this(bam1_t* b)

Construct SAMRecord from supplied bam1_t

Destructor

~this
~this()
Undocumented in source.

Members

Functions

getAlignedCoordinates
auto getAlignedCoordinates()

get aligned coordinates per each cigar op

getAlignedCoordinates
auto getAlignedCoordinates(int start, int end)

get aligned coordinates per each cigar op within range range is 0-based half open using chromosomal coordinates

getAlignedPairs
auto getAlignedPairs(int start, int end)

get a range of aligned read and reference positions this is meant to recreate functionality from pysam: https://pysam.readthedocs.io/en/latest/api.html#pysam.AlignedSegment.get_aligned_pairs

range is 0-based half open using chromosomal coordinates

getAlignedPairs
auto getAlignedPairs()

get a range of aligned read and reference positions this is meant to recreate functionality from pysam: https://pysam.readthedocs.io/en/latest/api.html#pysam.AlignedSegment.get_aligned_pairs

opIndex
TagValue opIndex(string val)

Get aux tag from bam1_t record and return a TagValue

opIndexAssign
void opIndexAssign(T value, string index)

Assign a tag key value pair

opIndexAssign
void opIndexAssign(T[] value, string index)

Assign a tag key array pair

q_scores
void q_scores(const(char)[] seq)

Add qscore sequence given that it is the same length as the bam sequence

qscores
const(char)[] qscores()

Return char array of the qscores see samtools/sam_view.c: get_quality

qscores
void qscores(ubyte[] seq)

Add qscore sequence given that it is the same length as the bam sequence

Properties

cigar
Cigar cigar [@property getter]

Create cigar from bam1_t record

cigar
Cigar cigar [@property setter]

Assign a cigar string

flag
ushort flag [@property getter]
ushort flag [@property setter]

bitwise flag

insertSize
int insertSize [@property getter]
int insertSize [@property setter]

Presumably Insert size, but is undocumented. Per samtools source, is measured 5' to 5' https://github.com/samtools/samtools/blob/bd1a409aa750d25d70a093405d174db8709a3f2c/bam_mate.c#L320

isMapped
bool isMapped [@property getter]

is read mapped?

isMateMapped
bool isMateMapped [@property getter]

is read mate mapped?

isPaired
bool isPaired [@property getter]

is read paired?

isReversed
bool isReversed [@property getter]

is read reversed? bool bam_is_rev(bam1_t *b) { return ( ((*b).core.flag & BAM_FREVERSE) != 0 ); }

isSecondary
bool isSecondary [@property getter]

is read secondary?

isSupplementary
bool isSupplementary [@property getter]

is read supplementary?

length
int length [@property getter]

query (and quality string) length

matePos
int matePos [@property getter]
int matePos [@property setter]

0-based leftmost coordinate of next read in template

mateReversed
bool mateReversed [@property getter]

is mate reversed? bool bam_is_mrev(bam1_t *b) { return( ((*b).core.flag & BAM_FMREVERSE) != 0); }

mateTID
int mateTID [@property getter]
int mateTID [@property setter]

chromosome ID of next read in template, defined by bam_hdr_t

pos
int pos [@property getter]
int pos [@property setter]

0-based leftmost coordinate

qual
ubyte qual [@property getter]
ubyte qual [@property setter]

mapping quality

queryName
char[] queryName [@property getter]

auto bam_get_qname(bam1_t *b) { return (cast(char*)(*b).data); }

queryName
string queryName [@property setter]

Set query name

sequence
const(char)[] sequence [@property getter]

Return char array of the sequence see samtools/sam_view.c: get_read

sequence
const(char)[] sequence [@property setter]

Assigns sequence and resets quality score

strand
char strand [@property getter]

Return read strand + or - (as char)

tid
int tid [@property getter]
int tid [@property setter]

chromosome ID, defined by bam_hdr_t

Structs

AlignedPair
struct AlignedPair(bool refSeq)
Undocumented in source.

Variables

b
bam1_t* b;

Meta