biohazard-0.6.2: bioinformatics support library

Safe HaskellNone



Trimming of reads as found in BAM files. Implements trimming low quality sequence from the 3' end.



trim_3' :: ([Nucleotides] -> [Qual] -> Bool) -> BamRec -> BamRec Source

Trims from the 3' end of a sequence. trim_3' p b trims the 3' end of the sequence in b at the earliest position such that p evaluates to true on every suffix that was trimmed off. Note that the 3' end may be the beginning of the sequence if it happens to be stored in reverse-complemented form. Also note that trimming from the 3' end may not make sense for reads that were constructed by merging paired end data (but we cannot take care of that here). Further note that trimming may break dependent information, notably the "mate" information of the mate and many optional fields.

TODO: The MD field is currently removed. It should be repaired instead. Many other fields should be trimmed if present.

trim_low_quality :: Qual -> a -> [Qual] -> Bool Source

Trim predicate to get rid of low quality sequence. trim_low_quality q ns qs evaluates to true if all qualities in qs are smaller (i.e. worse) than q.