package minimizer
A module for finding minimizers and splitting nucleotide sequences into super-mers.
- Alphabetic
- By Inheritance
- minimizer
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
type
BucketId = Long
The type of a bucket ID (derived from minimizer).
The type of a bucket ID (derived from minimizer). Buckets can be used to group super-mers.
-
final
case class
Canonical(inner: MinimizerOrdering) extends MinimizerOrdering with Product with Serializable
A derived ordering that maps every minimizer to its canonical (forward) orientation
-
final
case class
CanonicalPriorities[+P <: MinimizerPriorities](inner: P) extends MinimizerPriorities with Product with Serializable
Canonicalise a minimizer ordering.
Canonicalise a minimizer ordering. This maps each potential minimizer to its forward orientation (which must also be a valid minimizer). This effectively cuts the size of the minimizer set by up to half.
-
final
case class
Extended(inner: MinimizerSource, n: Int, canonical: Boolean, withSuffix: Boolean) extends MinimizerSource with Product with Serializable
An extended minimizer source which expands a MinTable by adding every possible suffix/prefix.
- class ExtendedFormat extends SplitterFormat[ExtendedTable]
-
final
case class
ExtendedTable(inner: MinTable, width: Int, canonical: Boolean, withSuffix: Boolean) extends MinimizerPriorities with Product with Serializable
Hybrid lookup/compute MinimizerPriorities, where minimizers consist of a prefix taken from the table and a computed suffix/prefix.
Hybrid lookup/compute MinimizerPriorities, where minimizers consist of a prefix taken from the table and a computed suffix/prefix. This can give low minimizer density for long minimizers while avoiding the need for a huge table.
- inner
The inner minimizer ordering (containing the lookup table)
- width
Expanded width > inner.width
-
final
case class
Generated(byPriority: Array[Int]) extends MinimizerSource with Product with Serializable
Programmatially generated minimizers.
Programmatially generated minimizers. Will be used in the given order if minimizerOrder = Given is used
- byPriority
the minimizers in the given order.
-
final
case class
InputFragment(header: SeqTitle, location: SeqLocation, nucleotides: NTSeq, nucleotides2: Option[NTSeq]) extends Product with Serializable
A sequence fragment with a controlled maximum size.
A sequence fragment with a controlled maximum size. Does not contain whitespace.
- header
Title/header of the sequence
- location
1-based location in the source sequence
- nucleotides
Nucleotides in the source sequence
- nucleotides2
Nucleotides for the second half in a pair, for paired end reads
-
final
case class
LocationSegment(bucket: BucketId, sequence: SeqID, location: SeqLocation, nucleotides: NTBitArray) extends Product with Serializable
A superkmer (segment where every k-mer shares the same minimizer), with bucket ID, sequence ID, and 1-based sequence location.
A superkmer (segment where every k-mer shares the same minimizer), with bucket ID, sequence ID, and 1-based sequence location.
- bucket
bucket (derived from minimizer)
- sequence
Sequence ID/header that this segment came from
- location
Sequence location (1-based) if available. Location is relative to the position in the original sequence with the given header.
- nucleotides
Encoded nucleotides of this segment
-
final
case class
MinSplitter[+P <: MinimizerPriorities](priorities: P, k: Int) extends Product with Serializable
Split reads into superkmers by ranked motifs (minimizers).
Split reads into superkmers by ranked motifs (minimizers). Such superkmers can be bucketed by the corresponding minimizer.
- priorities
Minimizer ordering to use for splitting
- k
k-mer length
-
final
case class
MinTable(byPriority: Array[Int], width: Int, numLargeBuckets: Long = 0) extends MinimizerPriorities with Product with Serializable
A lookup table of minimizers with relative priorities (minimizer ordering).
A lookup table of minimizers with relative priorities (minimizer ordering). This can represent any ordering. The downside is that the entire table must be stored in memory, so there is a natural limit to how wide m can be.
- byPriority
Encoded minimizers ordered from high priority to low. The position in the array is the rank of the corresponding minimizer. All minimizers must be of equal length.
- numLargeBuckets
Number of buckets expected to be "very large", if any. Intended as a heuristic for algorithms that may need to know this.
-
final
case class
Minimizer(location: Int, rank: Array[Long], length: Int) extends Product with Serializable
- location
location of superkmer
- rank
encoded priority of minimizer; uniquely identifies it
- length
length of superkmer
-
sealed
trait
MinimizerOrdering extends AnyRef
An ordering of a minimizer set
-
final
class
MinimizerPositions extends IndexedSeq[NTBitArray]
This class adapts KmerTable for use as a list of minimizers of some underlying sequence.
This class adapts KmerTable for use as a list of minimizers of some underlying sequence. This is more memory efficient than representing each NTBitArray as an object by itself. Each entry in the KmerTable corresponds to a position in a sequence. A single tag indicates whether the minimizer is valid or not.
-
trait
MinimizerPriorities extends Serializable
Defines a bidirectional mapping between encoded minimizers and their priorities.
Defines a bidirectional mapping between encoded minimizers and their priorities. Priorities and minimizers are both represented as NTBitArray objects. If the bit array is a priority, the first 2*width bits should be interpreted as an unsigned integer, where a smaller value indicates a higher priority minimizer. If the bit array is a minimizer, then it can be interpreted as a 2-bit encoded string of nucleotides in the usual way.
The unsigned integer space representing priorities is no larger than the number of m-mers, so e.g. for nucleotides, for width m there is up to 4m possible minimizers and no more than 4m priorities.
The forward mapping (priorityOf) may be many-to-one, and not necessarily reversible. In this case, the reverse mapping (motifFor) returns a representative minimizer.
-
trait
MinimizerSource extends AnyRef
A method for obtaining a set of minimizers for given values of k and m.
A method for obtaining a set of minimizers for given values of k and m. The sets obtained should be universal hitting sets (UHSs), or otherwise guaranteed to hit every k-mer in practice. Only m <= 15 can be loaded in this way.
-
sealed
trait
Orientation extends AnyRef
Orientations of k-mers.
-
final
class
PosRankWindow extends AnyRef
Tracks minimizers in a moving window, such that the top priority item can always be obtained efficiently.
Tracks minimizers in a moving window, such that the top priority item can always be obtained efficiently. Mutates the minimizer positions by setting valid/invalid flags. Can only be used once. This class looks like an Iterator[Int], but to avoid boxing of integers, does not extend that trait.
Invariants: the leftmost position has the highest priority (minimal rank). Priority decreases (i.e. rank increases) monotonically going left to right. Motifs are sorted by position. The minimizer of the current k-length window is always the first motif in the list.
-
final
case class
RandomXOR(width: Int, xorMask: Long, canonical: Boolean) extends MinimizerPriorities with Product with Serializable
Compute minimizer priority by XORing with a random mask
-
final
case class
SampledFrequencies(table: MinTable, minimizerCounts: Array[Long]) extends Product with Serializable
Sampled motif frequencies that may be used to construct a new minimizer ordering.
Sampled motif frequencies that may be used to construct a new minimizer ordering.
- table
Template table, whose ordering of motifs will be refined based on counted frequencies. This table will be mutated and cannot be reused after passing into SampledFrequencies.
- minimizerCounts
Maps encoded minimizer to count.
-
final
case class
ShiftScanner(priorities: MinimizerPriorities) extends Product with Serializable
Bit-shift scanner for fixed width motifs.
Bit-shift scanner for fixed width motifs. Identifies all valid (according to some MinimizerPriorities) motifs/minimizers in a sequence.
- priorities
The minimizer ordering to scan for motifs of
-
final
case class
SpacedSeed(s: Int, inner: MinimizerPriorities) extends MinimizerPriorities with Product with Serializable
Apply spaced seed mask to some minimizer priorities s nts, 1 nt apart from each other, counting from the rightmost position, will be removed, yielding (width-s) nts.
Apply spaced seed mask to some minimizer priorities s nts, 1 nt apart from each other, counting from the rightmost position, will be removed, yielding (width-s) nts. Masked positions will be set to A Example: TTCTGTGGG with s = 3 will be masked as TTC-G-G-G, yielding TTCAGAGAG
- s
the number of nts to mask out
- inner
inner priorities to mask
-
final
case class
Supermer(rank: Array[Long], nucleotides: NTBitArray, location: SeqLocation) extends Product with Serializable
- rank
encoded priority of minimizer; uniquely identifies it
- nucleotides
encoded super-mer
- location
location in sequence if available. The location is relative to the string that was passed to MinSplitter (not to the longer upstream sequence that it might have come from).
-
final
case class
XORMask(mask: Long = DEFAULT_TOGGLE_MASK) extends MinimizerOrdering with Product with Serializable
Ordering obtained by XORing with a mask
Ordering obtained by XORing with a mask
- mask
The XOR mask
Value Members
-
val
DEFAULT_TOGGLE_MASK: Long
For RandomXOR ordering
-
object
All extends MinimizerSource with Product with Serializable
Use all m-mers as minimizers.
Use all m-mers as minimizers. Can be auto-generated for any m. The initial ordering is lexicographic.
-
object
BundledMinimizers
Object to manage minimizer files that are stored directly on the classpath (e.g.
Object to manage minimizer files that are stored directly on the classpath (e.g. in the same jar)
- object CanonicalPriorities extends Serializable
-
object
Forward extends Orientation with Product with Serializable
Forward orientated (canonical) k-mers, i.e.
Forward orientated (canonical) k-mers, i.e. those that are lexicographically prior to their reverse complement. During normalized k-mer counting, k-mers are flipped to the canonical orientation if necessary.
-
object
Frequency extends MinimizerOrdering with Product with Serializable
Ordering by frequency (rare to common)
-
object
Given extends MinimizerOrdering with Product with Serializable
A user-specified ordering
-
object
Lexicographic extends MinimizerOrdering with Product with Serializable
Lexicographic (alphabetical) ordering
- object MinSplitter extends Serializable
- object MinTable extends Serializable
- object MinimizerPositions
-
object
Orderings
Routines for creating minimizer orderings.
- object SampledFrequencies extends Serializable
-
object
Unchanged extends Orientation with Product with Serializable
Both forward and reverse oriented k-mers