Utility
Types
PanGraph.Graphs.Utility.Record
— Typestruct Record
seq::Array{UInt8}
name::String
meta::String
end
A record obtained when parsing a single entry of a FASTA file.
PanGraph.Graphs.Utility.Score
— Typestruct Score <: AbstractArray{Float64,2}
rows::Int
cols::Int
band::NamedTuple{(:lower, :upper)}
data::Array{Float64}
offset::Array{Int}
starts::Array{Int}
stops::Array{Int}
end
Store information about a banded pairwise alignment.
PanGraph.Graphs.Utility.cost
— Constantcost = (
open = -6.0,
extend = -1.0,
band = (
lower = Inf,
upper = Inf,
),
gap = k -> k == 0 ? 0 : cost.open + cost.extend*(k-1),
match = (c₁, c₂) -> 6.0*(c₁ == c₂) - 3.0,
)
cost
are the default dynamic alignment parameters used.
Functions
PanGraph.Graphs.Utility.align
— Methodalign(seq₁::Array{UInt8}, seq₂::Array{UInt8}, cost::Score)
Perform a pairwise alignment using Needleman-Wunsch style dynamic programming between seq₁
and seq₂
given cost
. The cost is defined by the Score structure.
PanGraph.Graphs.Utility.cigar
— Methodcigar(seq₁::Array{UInt8}, seq₂::Array{UInt8})
Given two sequences, seq₁
and seq₂
, perform a pairwise banded alignment and return the cigar string of alignment.
PanGraph.Graphs.Utility.columns
— Methodcolumns(s; nc=80)
Partition string s
into an array of strings such that no string is longer than nc
characters.
PanGraph.Graphs.Utility.enforce_cutoff!
— Methodenforce_cutoff!(a::Alignment, χ)
Ensure that the alignment a
does not have insertion or deletion segments larger than χ
. Return the list of segments created by parsing the alignment such that all segments are larger than χ
.
PanGraph.Graphs.Utility.hamming_align
— Methodhamming_align(qry::Array{UInt8,1}, ref::Array{UInt8,1})
Perform a simple alignment of qry
to ref
by minimizing hamming distance. Useful for fast, approximate alignments of small sequences.
PanGraph.Graphs.Utility.random_id
— Methodrandom_id(;len=10, alphabet=UInt8[])
Generate a random string of length len
drawn from letters in alphabet
.
PanGraph.Graphs.Utility.read_fasta
— Methodread_fasta(io::IO)
Parse a FASTA file from IO stream io
. Return an iterator over all records.
PanGraph.Graphs.Utility.read_mmseqs2
— Methodread_mmseqs2(io::IO)
Parse a simil-PAF file produced by mmseq2 from IO stream io
. Return an iterator over all pairwise alignments.
PanGraph.Graphs.Utility.read_paf
— Methodread_paf(io::IO)
Parse a PAF file from IO stream io
. Return an iterator over all pairwise alignments.
PanGraph.Graphs.Utility.uncigar
— Methoduncigar(cg::String)
Return an interator over intervals of alignment defined by cigar string cg
.
PanGraph.Graphs.Utility.write_fasta
— Methodwrite_fasta(io::IO, name, seq)
Output a single FASTA record with sequence seq
and name name
to IO stream io
.
PanGraph.Graphs.reverse_complement!
— Methodreverse_complement!(hit::Hit)
Reverse complement the qry of Hit in place.
PanGraph.Graphs.reverse_complement
— Methodreverse_complement(seq::Array{UInt8})
Return a newly allocated sequence array that is the reverse complement of seq
.