GtSamAlignment *gt_sam_alignment_clone(GtSamAlignment *sam_alignment) { GtSamAlignment *clone; gt_assert(sam_alignment != NULL); clone = gt_sam_alignment_new(sam_alignment->alphabet); (void)bam_copy1(clone->s_alignment, sam_alignment->s_alignment); clone->rightmost = sam_alignment->rightmost; return clone; }
int gt_samfile_iterator_next(GtSamfileIterator *s_iter, GtSamAlignment **s_alignment) { int read; if (s_iter->current_alignment == NULL) s_iter->current_alignment = gt_sam_alignment_new(s_iter->alphabet); read = samread(s_iter->samfile, s_iter->current_alignment->s_alignment); if (read > 0) { *s_alignment = s_iter->current_alignment; return read; } else { *s_alignment = NULL; return read; } }