Skip to main content

split_seq_by_gaps

Function split_seq_by_gaps 

Source
pub fn split_seq_by_gaps(record: Record) -> Vec<RecordPiece>
Expand description

Given a record, split the sequence at runs of unscoreable bases.

Returns a vector of pieces, each covering a stretch of sequence that contains only A, C, G and T (in either case). Runs of N or IUPAC ambiguity codes are dropped, and the sequence is split there. Each piece records its own start-end position in the original record, the positions being 1-based.

Splitting matters because curvature is computed from a sliding window over a running sum of coordinates. Merely deleting the unknown bases would let a window span the gap and derive a value from bases that are far apart in the real sequence.

Input:

>chr42
ATGCATGC
NNNNATGC
A

Output:

>chr42 1-8
ATGCATGC
>chr42 13-17
ATGCA