INNER CODE UNIT · C
seq
dpryan79/MethylDackel · MBias.c:147
seq = faidx_fetch_seq(fai, hdr->target_name[localTid], localPos, localEnd, &seqlen);
if(seqlen < 0) {
fprintf(stderr, "faidx_fetch_seq returned %i while trying to fetch the sequence for tid %s:%"PRIu32"-%"PRIu32"!\n",\
seqlen, hdr->target_name[localTid], localPos, localEnd);
fprintf(stderr, "Note that the output will be truncated!\n");
return NULL;
}
data->seq = seq;
data->lseq = seqlen;
data->offset = localPos;
//Start the pileup
iter = bam_mplp_init(1, filter_func, (void **) &data);
// bam_mplp_init_overlaps(iter); //This is included in extract but excluded here. The main benefit to exclusion is that you can more accurately gauge overlapping regions.
bam_mplp_set_maxcnt(iter, INT_MAX);
while((ret = bam_mplp_auto(iter, &tid, &pos, &n_plp, plp)) > 0) {
if(pos < localPos || pos >= localEnd) continue; // out of the region requested