Private API Reference
FASTX.FASTA.Record
— MethodFASTX.FASTA.Record(ps::Pseudoread; prefix::AbstractString="", is_consensus::Bool=false)
Specialized constructor for outputting Pseudoread
s to FASTA.Record
s that can be written to files.
Arguments
ps::Pseudoread
: The modified sequence and read window to be converted into the sequence of the new record
Keywords
prefix::AbstractString=""
: A string to start the sequence identifier with, usually based on the reference sequence ofps
is_consensus::Bool=false
: Normally, the new identifier of the record is a combination of theprefix
and the SHA1 hash of the alternate sequence. Setis_consensus
totrue
to instead use the word"CONSENSUS"
in place of the hash
SequenceVariation.Haplotype
— MethodSequenceVariation.Haplotype(
query::Union{SAM.Record,BAM.Record}, reference::NucleotideSeq
) -> SequenceVariation.Haplotype
Specialized constructor that allows converting the alignment in a XAM.Record
into a Haplotype
.
HapLink._cigar
— Method_cigar(var::Variation{S,T}) where {S,T}
Returns a CIGAR operation for var
. Only supports insertions and deletions.
See also _cigar_between
HapLink._cigar_between
— Method_cigar_between(x::Variation{S,T}, y::Variation{S,T}) where {S,T}
Returns a CIGAR operation for the (assumed) matching bases between x
and y
.
See also _cigar
HapLink._indexed_reader
— Method_indexed_reader(bam::Union{AbstractPath,AbstractString}, int::Interval)
Provides an iterator over records in bam
that overlap with int
. Note that if no index file is available for bam
, then the return value will fall back to an iterator of all records in bam
.
HapLink._lendiff
— Method_lendiff(ps::Pseudoread)
Gets the difference between the number of bases within the read window of ps
on the reference sequence from the number of bases within the read window on the mutated sequence, taking into account insertions and deletions.
HapLink._phrederror
— Method_phrederror(quality::Number)
Converts a PHRED33-scaled error number into the expected fractional error of basecall
HapLink._pos_to_edge
— Method_pos_to_edge(pos::Number)
Converts pos
from a number between 0 (beginning) and 1 (end) to a number ranging from 0 (beginning) to 1 (middle) to 0 (end), i.e. convert a relative position to a relative distance from the edge.
HapLink._posin
— Method_posin(ps::Pseudoread, v::Variation)
Determines if the positions that make up v
are wholly contained by ps
HapLink._push_filter!
— Function_push_filter!(
vc::VariationCall,
label::Char,
value::Union{Nothing,Number},
filter::Function=(var, val) -> true,
)
Adds a FILTER entry to vc
of the form "$label$value"
if filter
returns true.
Arguments
vc::VariationCall
: TheVariationCall
to annotatelabel::Char
: The first character of the filter text to addvalue::Union{Nothing,Number}
: The value to comparevc
against, and to append to the filter text. If set tonothing
,_push_filter!
will return without evaluating or adding any filters, which may be useful for processing multiple inputsfilter::Function=(var, val) -> true
: A function handle to determine if a filter should be applied or not. Note that this function must returntrue
if and only if the filter should be added tovc
. The function will be passedvc
andvalue
. Defaults to always applying filters regardless of the values ofvc
andvalue
.
HapLink.comonicon_install
— Methodcomonicon_install(;kwargs...)
Install the CLI manually. This will use the default configuration in Comonicon.toml
, if it exists. For more detailed reference, please refer to Comonicon documentation.
HapLink.comonicon_install_path
— Methodcomonicon_install_path(;[yes=false])
Install the PATH
and FPATH
to your shell configuration file. You can use comonicon_install_path(;yes=true)
to skip interactive prompt. For more detailed reference, please refer to Comonicon documentation.
HapLink.magnitude
— Methodmagnitude(x::UnitRange)
Gets the difference between the last and first elements of x
Example
julia> using HapLink: magnitude
julia> magnitude(0:10)
10
HapLink.overlap
— Methodoverlap(x::UnitRange{S}, y::UnitRange{S}) where {S}
Finds the inclusive overlap interval of x
and y
Example
julia> using HapLink: overlap
julia> overlap(1:5, 3:10)
3:5
julia> overlap(2:4, 6:8)
6:5
julia> overlap(1:10, 2:9)
2:9
SequenceVariation.variations
— Methodvariations(vs::AbstractVector{Haplotype})
Extracts all SequenceVariation.Variation
s from vs
.
HapLink.findset
— Functionfindset(lst::AbstractArray{T}, comparator::Function) where {T}
Finds every possible set of items in lst
where comparator
returns true for the set.
Example
function divisible_by_same_number(x, i)
for j in 2:i
if all(y -> y % j == 0, x)
return true
end
end
return false
end
findset(1:12, x -> divisible_by_same_number(x, 5))
# output
6-element Vector{Vector{Int64}}:
[2, 4, 6, 8, 10, 12]
[6, 3, 9, 12]
[5, 10]
[1]
[7]
[11]