- samopen
- Open a SAM/BAM file
- samclose
- Close a SAM/BAM handler
- samread
- Read one alignment
- samwrite
- Write one alignment
- sampileup
- Get the pileup for a whole alignment file
Open a SAM/BAM file
samfile_t *samopen(
const char *fn,
const char *mode,
const void *aux);
Parameters
fn
- SAM/BAM file name; "-" is recognized as stdin (for
reading) or stdout (for writing).
mode
- open mode /[rw](b?)(u?)(h?)/: 'r' for reading, 'w' for
writing, 'b' for BAM I/O, 'u' for uncompressed BAM output and 'h'
for outputing header in SAM. If 'b' present, it must immediately
follow 'r' or 'w'. Valid modes are "r", "w", "wh", "rb", "wb" and
"wbu" exclusively.
aux
- auxiliary data; if mode[0]=='w', aux points to
bam_header_t; if strcmp(mode, "rb")==0 and @SQ header lines in SAM
are absent, aux points the file name of the list of the reference;
aux is not used otherwise.
Return Value
SAM/BAM file handler
Close a SAM/BAM handler
void samclose(
samfile_t *fp);
Parameters
fp
- file handler to be closed
Read one alignment
int samread(
samfile_t *fp,
bam1_t *b);
Parameters
fp
- file handler
b
- alignment
Return Value
bytes read
Write one alignment
int samwrite(
samfile_t *fp,
const bam1_t *b);
Parameters
fp
- file handler
b
- alignment
Return Value
bytes written
Get the pileup for a whole alignment file
int sampileup(
samfile_t *fp,
int mask,
bam_pileup_f func,
void *data);
Parameters
fp
- file handler
mask
- mask transferred to bam_plbuf_set_mask()
func
- user defined function called in the pileup process
#param data user provided data for func()
© Genome Research Ltd.
Last Updated: Saturday, June 13, 2009