Exemplo n.º 1
0
LIB_EXPORT rc_t CC AlignAccessRefSeqEnumeratorNext(const AlignAccessRefSeqEnumerator *cself) {
    AlignAccessRefSeqEnumerator *self = (AlignAccessRefSeqEnumerator *)cself;
    
    if (cself->cur + 1 >= cself->end)
        return AlignAccessRefSeqEnumeratorEOFCode;
    
    ++self->cur;
    if (!BAMFileIsIndexed(cself->parent->innerSelf))
    	return 0;
	if (BAMFileIndexHasRefSeqId(cself->parent->innerSelf, cself->cur))
		return 0;
	return AlignAccessRefSeqEnumeratorNext(cself);
}
Exemplo n.º 2
0
LIB_EXPORT rc_t CC AlignAccessRefSeqEnumeratorNext(const AlignAccessRefSeqEnumerator *cself) {
    AlignAccessRefSeqEnumerator *self = (AlignAccessRefSeqEnumerator *)cself;
    
    if (cself->cur + 1 >= cself->end)
        return AlignAccessRefSeqEnumeratorEOFCode;
    
    ++self->cur;
#if ENUMERATOR_IS_NOT_FILTERED_BY_INDEX
    return 0;
#else
    if (!BAMFileIsIndexed(cself->parent->innerSelf))
    	return 0;
	if (BAMFileIndexHasRefSeqId(cself->parent->innerSelf, cself->cur))
		return 0;
	return AlignAccessRefSeqEnumeratorNext(cself);
#endif
}
Exemplo n.º 3
0
LIB_EXPORT rc_t CC AlignAccessDBEnumerateRefSequences(const AlignAccessDB *self, AlignAccessRefSeqEnumerator **refseq_enum) {
    AlignAccessRefSeqEnumerator *lhs;
    unsigned cur = 0;
    unsigned end;
    
    BAMFileGetRefSeqCount(self->innerSelf, &end);
    if (BAMFileIsIndexed(self->innerSelf)) {
        while (cur != end && BAMFileIndexHasRefSeqId(self->innerSelf, cur) == 0)
            ++cur;
        if (cur == end)
            return AlignAccessRefSeqEnumeratorEOFCode;
    }
    lhs = malloc(sizeof(*lhs));
    *refseq_enum = lhs;
    if (lhs != NULL) {
        lhs->parent = self;
        AlignAccessDBAddRef(lhs->parent);
        lhs->cur = cur;
        lhs->end = end;
        atomic32_set(&lhs->refcount, 1);
        return 0;
    }
    return RC(rcAlign, rcDatabase, rcConstructing, rcMemory, rcExhausted);
}