filters

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2018 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package filters defines filters for .sam/.bam/.cram sequencing pipelines.

Index

Constants

This section is empty.

Variables

View Source
var (
	X0 = utils.Intern("X0")
	X1 = utils.Intern("X1")
	XM = utils.Intern("XM")
	XO = utils.Intern("XO")
	XG = utils.Intern("XG")
)

Symbols for optional fields used for determining exact matches. See http://samtools.github.io/hts-specs/SAMv1.pdf - Section 1.5.

Functions

func AddOrReplaceReadGroup

func AddOrReplaceReadGroup(readGroup utils.StringMap) sam.Filter

AddOrReplaceReadGroup returns a filter for adding or replacing the read group both in the Header and in each Alignment.

func AddPGLine

func AddPGLine(newPG utils.StringMap) sam.Filter

AddPGLine returns a filter for adding a @PG tag to a Header, and ensuring that it is the first one in the chain.

func AddREFID

func AddREFID(header *sam.Header) sam.AlignmentFilter

AddREFID is a filter for adding the refid (index in the reference sequence dictionary) to alignments as temporary values.

func CleanSam

func CleanSam(header *sam.Header) sam.AlignmentFilter

CleanSam is a filter for soft-clipping an alignment at the end of a reference sequence, and set MAPQ to 0 if unmapped.

func KeepOptionalFields

func KeepOptionalFields(tags []string) sam.Filter

KeepOptionalFields returns a filter for removing all but a list of given optional fields in an alignment.

func MarkDuplicates

func MarkDuplicates(deterministic bool) sam.Filter

MarkDuplicates returns a filter for marking duplicate alignments. Depends on the AddREFID filter being called before to fill in the refid.

Duplicate marking is based on an adapted Phred score. In case of ties, if deterministic is true, the QNAME is used as a tie-breaker. Otherwise duplicate marking is random for alignments tied for best score.

func RemoveDuplicateReads

func RemoveDuplicateReads(_ *sam.Header) sam.AlignmentFilter

RemoveDuplicateReads is a filter for removing duplicate sam-alignment instances, based on FLAG.

func RemoveMappingQualityLessThan

func RemoveMappingQualityLessThan(mq int) sam.Filter

RemoveMappingQualityLessThan is a filter for removing reads that do not match or exceed the given mapping quality.

func RemoveNonExactMappingReads

func RemoveNonExactMappingReads(_ *sam.Header) sam.AlignmentFilter

RemoveNonExactMappingReads is a filter that removes all reads that are not exact matches with the reference (soft-clipping ok), based on CIGAR string (only M and S allowed).

func RemoveNonExactMappingReadsStrict

func RemoveNonExactMappingReadsStrict(header *sam.Header) sam.AlignmentFilter

RemoveNonExactMappingReadsStrict is a filter that removes all reads that are not exact matches with the reference, based on the optional fields X0=1 (unique mapping), X1=0 (no suboptimal hit), XM=0 (no mismatch), XO=0 (no gap opening), XG=0 (no gap extension).

func RemoveNonOverlappingReads

func RemoveNonOverlappingReads(bed *bed.Bed) sam.Filter

RemoveNonOverlappingReads returns a filter for removing all reads that do not overlap with a set of regions specified by a bed file.

func RemoveOptionalFields

func RemoveOptionalFields(tags []string) sam.Filter

RemoveOptionalFields returns a filter for removing optional fields in an alignment.

func RemoveOptionalReads

func RemoveOptionalReads(header *sam.Header) sam.AlignmentFilter

RemoveOptionalReads is a filter for removing alignments that represent optional information in elPrep.

func RemoveUnmappedReads

func RemoveUnmappedReads(_ *sam.Header) sam.AlignmentFilter

RemoveUnmappedReads is a filter for removing unmapped sam-alignment instances, based on FLAG.

func RemoveUnmappedReadsStrict

func RemoveUnmappedReadsStrict(_ *sam.Header) sam.AlignmentFilter

RemoveUnmappedReadsStrict is a filter for removing unmapped sam-alignment instances, based on FLAG, or POS=0, or RNAME=*.

func RenameChromosomes

func RenameChromosomes(header *sam.Header) sam.AlignmentFilter

RenameChromosomes is a filter for prepending "chr" to the reference sequence names in a Header, and in RNAME and RNEXT in each Alignment.

func ReplaceReferenceSequenceDictionary

func ReplaceReferenceSequenceDictionary(dict []utils.StringMap) sam.Filter

ReplaceReferenceSequenceDictionary returns a filter for replacing the reference sequence dictionary in a Header.

func ReplaceReferenceSequenceDictionaryFromSamFile

func ReplaceReferenceSequenceDictionaryFromSamFile(samFile string) (f sam.Filter, err error)

ReplaceReferenceSequenceDictionaryFromSamFile returns a filter for replacing the reference sequence dictionary in a Header with one parsed from the given SAM/DICT file.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL