vg
tools for working with variation graphs
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
vg Namespace Reference

Namespaces

 algorithms
 
 io
 
 subcommand
 
 temp_file
 
 unittest
 

Classes

class  Aligner
 
class  AlignerClient
 
struct  Alignment
 
class  AlignmentChainModel
 
class  AlignmentChainModelVertex
 
struct  Annotation
 
struct  AppendHaplotypeCommand
 
struct  AugmentedGraph
 
class  BandedGlobalAligner
 
class  BaseAligner
 
class  BaseMapper
 
class  BaseOption
 
struct  BasePileup
 
struct  BenchmarkResult
 
class  BitString
 
class  BitStringTree
 
struct  BREAKPOINT
 
class  CachedPackedTraversalSupportFinder
 
struct  CactusSide
 
class  CactusSnarlFinder
 
struct  ChainIterator
 
class  Colors
 
struct  CompletedTranscriptPath
 
class  ComponentMinDistanceClusterer
 
class  Configurable
 
class  ConfigurableParser
 
struct  Connection
 An edge in a MultipathAlignment between Subpaths that may not be contiguous in the graph. More...
 
class  connection_t
 
class  ConsistencyCalculator
 
struct  ConstructedChunk
 
class  Constructor
 
class  DagifiedGraph
 
class  Deconstructor
 
struct  DeleteHaplotypeCommand
 
class  DepthMap
 
class  DinucleotideMachine
 
class  discrete_distribution
 We provide a partial discrete_distribution implementation that is just the parts we need. More...
 
class  DistanceHeuristic
 
class  DozeuInterface
 
class  DozeuPinningOverlay
 
struct  Edge
 
struct  EdgePileup
 Keep pileup-like record for reads that span edges. More...
 
struct  Edit
 
class  edit_t
 
struct  EditedTranscriptPath
 
struct  endianness
 
class  ExhaustiveTraversalFinder
 
struct  Exon
 
class  ExtraNodeGraph
 
class  FeatureSet
 
class  Filter
 
class  FixedGenotypePriorCalculator
 
class  FlowCaller
 
class  FlowSort
 
class  FlowTraversalFinder
 
class  FragmentLengthDistribution
 
class  FragmentLengthStatistics
 
class  Funnel
 
class  GAFOutputCaller
 
class  GaplessExtender
 
struct  GaplessExtension
 
class  GBWTTraversalFinder
 
class  GenomeState
 
struct  GenomeStateCommand
 
struct  Genotype
 Describes a genotype at a particular locus. More...
 
class  GenotypeLikelihoodCalculator
 
class  GenotypePriorCalculator
 
class  Genotyper
 
class  GFFReader
 
struct  GFFRecord
 
struct  Graph
 
class  GraphCaller
 
class  GraphSynchronizer
 
class  GreedyMinDistanceClusterer
 
class  GSSWAligner
 
class  HandleGraphSnarlFinder
 
class  HaplotypeIndexer
 
class  hash_map
 
class  hash_map< K *, V >
 
class  hash_set
 
class  hash_set< K * >
 
class  Homogenizer
 
class  HTSAlignmentEmitter
 
class  IdentityOverlay
 
struct  IDScanner
 
class  IncrementalSubgraph
 
struct  IncrementIter
 
class  Index
 
class  IndexedVG
 
class  IndexManager
 
class  indexOpenException
 
struct  InsertHaplotypeCommand
 
class  IntegratedSnarlFinder
 
struct  is_instantiation_of
 
struct  is_instantiation_of< Predicate< PredicateArgs... >, Predicate >
 
class  JoinedSpliceGraph
 
class  keyNotFoundException
 
struct  kmer_t
 
struct  KmerMatch
 Used to serialize kmer matches. More...
 
struct  KmerPosition
 
class  LegacyCaller
 
struct  LocationSupport
 Support pinned to a location, which can be either a node or an edge. More...
 
struct  Locus
 Describes a genetic locus with multiple possible alleles, a genotype, and observational support. More...
 
class  Mapper
 
struct  Mapping
 
class  mapping_t
 
class  MaximalExactMatch
 
class  MCMCCaller
 
class  MCMCGenotyper
 
class  MEMChainModel
 
class  MEMChainModelVertex
 
class  MEMClusterer
 
class  MemoizingGraph
 
class  MinDistanceClusterer
 
class  MinimizerMapper
 
class  MinimumDistanceIndex
 
struct  MIPayload
 
class  MSAConverter
 
class  multipath_alignment_t
 
struct  MultipathAlignment
 
class  MultipathAlignmentEmitter
 
class  MultipathAlignmentGraph
 
class  MultipathMapper
 
struct  MultipathProblem
 
class  NameMapper
 
class  NestedTraversalFinder
 
class  NetGraph
 
class  NGSSimulator
 
class  NoAlignmentInBandException
 
struct  Node
 Nodes store sequence data. More...
 
struct  NodePileup
 
class  NodeSide
 
class  NodeTraversal
 
class  normal_distribution
 
class  NullClusterer
 
class  NullMaskingGraph
 
class  Option
 
class  Option< vector< Item >, Parser >
 
class  OptionInterface
 
class  OptionValueParser
 
class  OptionValueParser< vector< Item > >
 
class  OrientedDistanceClusterer
 
class  OrientedDistanceMeasurer
 
class  PackedTraversalSupportFinder
 
class  Packer
 
class  Packers
 
class  pair_hash_map
 
class  pair_hash_set
 
class  PairedEndMapper
 
struct  Path
 
class  path_mapping_t
 
class  path_t
 
class  PathBasedTraversalFinder
 
struct  PathBranch
 
class  PathChunker
 
class  PathComponentIndex
 
struct  PathIndex
 
class  PathNode
 
class  PathOrientedDistanceMeasurer
 
class  PathRestrictedTraversalFinder
 
class  Paths
 
class  PathSubgraph
 
class  PathSubgraphOverlay
 
class  PathTraversalFinder
 
class  PhasedGenome
 
class  PhaseUnfolder
 
class  Pictographs
 
struct  Pileup
 Bundle up Node and Edge pileups. More...
 
class  PoissonSupportSnarlCaller
 
struct  Position
 
class  position_t
 
struct  PositionIDScanner
 
class  Progressive
 
class  QualAdjAligner
 
class  QualAdjXdropAligner
 
struct  Range
 This defines a range of values to test, from start to <=end, going up by step. More...
 
class  RareVariantSimplifier
 
class  RatioSupportSnarlCaller
 
class  ReadFilter
 
class  ReadRestrictedTraversalFinder
 
struct  Region
 
class  RegionExpander
 
struct  ReplaceLocalHaplotypeCommand
 
struct  ReplaceSnarlHaplotypeCommand
 
class  RepresentativeTraversalFinder
 
class  ReverseGraph
 
class  Sampler
 
class  ShuffledPairs
 
class  SimpleConsistencyCalculator
 
class  SimpleTraversalSupportCalculator
 
class  SmallBitset
 
class  SmallSnarlSimplifier
 
struct  Snarl
 Describes a subgraph that is connected to the rest of the graph by two nodes. More...
 
class  SnarlCaller
 
class  SnarlFinder
 
class  SnarlManager
 
class  SnarlMinDistance
 
class  SnarlOrientedDistanceMeasurer
 
class  SnarlSeedClusterer
 
class  SnarlState
 
struct  SnarlTraversal
 
class  SourceSinkOverlay
 
class  SplicedHTSAlignmentEmitter
 
class  SpliceMotifs
 
class  SpliceRegion
 
class  SRPE
 
class  SSWAligner
 
struct  state_hash
 
class  StrandSplitGraph
 
class  StreamIndex
 
class  StreamIndexBase
 
class  StreamSorter
 
class  string_hash_map
 
class  string_hash_set
 
class  SubgraphOverlay
 
class  SubHandleGraph
 
struct  Subpath
 A non-branching path of a MultipathAlignment. More...
 
class  subpath_t
 
struct  Support
 Aggregates information about the reads supporting an allele. More...
 
struct  SupportAugmentedGraph
 Augmented Graph that holds some Support annotation data specific to vg call. More...
 
class  SupportBasedSnarlCaller
 
class  SupportRestrictedTraversalFinder
 
class  Surjector
 
struct  SwapHaplotypesCommand
 
class  TargetValueSearch
 
class  TipAnchoredMaxDistance
 
struct  Transcript
 
class  Transcriptome
 
struct  TranscriptPath
 
struct  Translation
 
class  Translator
 
class  TraversalFinder
 
class  TraversalSupportCalculator
 
class  TraversalSupportFinder
 
struct  Tree
 
struct  TreeNode
 
class  TreeSubgraph
 
class  TrivialTraversalFinder
 
class  TVSClusterer
 
class  uniform_int_distribution
 
class  uniform_real_distribution
 
class  VariantAdder
 
class  VcfBuffer
 
class  VCFGenotyper
 
class  VCFOutputCaller
 
class  VcfRecordConverter
 
class  VcfRecordFilter
 
class  VCFTraversalFinder
 
class  Version
 Class for holding vg version and build environment information. More...
 
class  VG
 
class  VGset
 
struct  Visit
 Describes a step of a walk through a Snarl either on a node or through a child Snarl. More...
 
class  Viz
 
struct  walk_t
 Record a <=k-length walk in the context of a graph. More...
 
struct  wang_hash
 
struct  wang_hash< handle_t >
 
struct  wang_hash< NodeSide >
 
struct  wang_hash< NodeTraversal >
 hash function for NodeTraversals More...
 
struct  wang_hash< path_handle_t >
 
struct  wang_hash< std::pair< A, B > >
 
struct  wang_hash< T * >
 
struct  wang_hash< T, typename std::enable_if< std::is_integral< T >::value >::type >
 
class  Watchdog
 
class  WideningPRNG
 
class  WindowedVcfBuffer
 
struct  WrappingPositionScanner
 
class  XdropAligner
 

Typedefs

using benchtime = chrono::nanoseconds
 We define a duration type for expressing benchmark times in. More...
 
typedef unordered_set< handle_tHandleSet
 
typedef unordered_map< handle_t, int > Handle2Component
 
typedef std::map< id_t, std::vector< Edge * > > EdgeMapping
 
using handle_t = handlegraph::handle_t
 
using nid_t = handlegraph::nid_t
 
using path_handle_t = handlegraph::path_handle_t
 
using step_handle_t = handlegraph::step_handle_t
 
using edge_t = handlegraph::edge_t
 
using HandleGraph = handlegraph::HandleGraph
 
using RankedHandleGraph = handlegraph::RankedHandleGraph
 
using MutableHandleGraph = handlegraph::MutableHandleGraph
 
using PathHandleGraph = handlegraph::PathHandleGraph
 
using PathPositionHandleGraph = handlegraph::PathPositionHandleGraph
 
using MutablePathHandleGraph = handlegraph::MutablePathHandleGraph
 
using MutablePathMutableHandleGraph = handlegraph::MutablePathMutableHandleGraph
 
using DeletableHandleGraph = handlegraph::DeletableHandleGraph
 
using MutablePathDeletableHandleGraph = handlegraph::MutablePathDeletableHandleGraph
 
using SerializableHandleGraph = handlegraph::SerializableHandleGraph
 
using VectorizableHandleGraph = handlegraph::VectorizableHandleGraph
 
using thread_t = vector< gbwt::node_type >
 
typedef std::pair< uint32_t, int32_t > pareto_point
 
using Chain = vector< pair< const Snarl *, bool > >
 
using real_t = long double
 
using GAMIndex = StreamIndex< Alignment >
 Define a GAM index as a stream index over a stream of Alignments. More...
 
using GAMSorter = StreamSorter< Alignment >
 
typedef vector< gbwt::node_type > exon_nodes_t
 
typedef vector< gbwt::size_type > thread_ids_t
 
typedef handlegraph::nid_t id_t
 
typedef size_t off_t
 
typedef std::tuple< id_t, bool, off_tpos_t
 

Enumerations

enum  MappingQualityMethod { Approx, Exact, Adaptive, None }
 
enum  SnarlType { UNCLASSIFIED = 0, ULTRABUBBLE = 1, UNARY = 2 }
 Enumeration of the classifications of snarls. More...
 

Functions

int hts_for_each (string &filename, function< void(Alignment &)> lambda, const PathPositionHandleGraph *graph)
 
int hts_for_each (string &filename, function< void(Alignment &)> lambda)
 
int hts_for_each_parallel (string &filename, function< void(Alignment &)> lambda, const PathPositionHandleGraph *graph)
 
int hts_for_each_parallel (string &filename, function< void(Alignment &)> lambda)
 
bam_hdr_t * hts_file_header (string &filename, string &header)
 
bam_hdr_t * hts_string_header (string &header, map< string, int64_t > &path_length, map< string, string > &rg_sample)
 
bool get_next_alignment_from_fastq (gzFile fp, char *buffer, size_t len, Alignment &alignment)
 
bool get_next_interleaved_alignment_pair_from_fastq (gzFile fp, char *buffer, size_t len, Alignment &mate1, Alignment &mate2)
 
bool get_next_alignment_pair_from_fastqs (gzFile fp1, gzFile fp2, char *buffer, size_t len, Alignment &mate1, Alignment &mate2)
 
size_t fastq_unpaired_for_each_parallel (const string &filename, function< void(Alignment &)> lambda)
 
size_t fastq_paired_interleaved_for_each_parallel (const string &filename, function< void(Alignment &, Alignment &)> lambda)
 
size_t fastq_paired_two_files_for_each_parallel (const string &file1, const string &file2, function< void(Alignment &, Alignment &)> lambda)
 
size_t fastq_paired_interleaved_for_each_parallel_after_wait (const string &filename, function< void(Alignment &, Alignment &)> lambda, function< bool(void)> single_threaded_until_true)
 
size_t fastq_paired_two_files_for_each_parallel_after_wait (const string &file1, const string &file2, function< void(Alignment &, Alignment &)> lambda, function< bool(void)> single_threaded_until_true)
 
size_t fastq_unpaired_for_each (const string &filename, function< void(Alignment &)> lambda)
 
size_t fastq_paired_interleaved_for_each (const string &filename, function< void(Alignment &, Alignment &)> lambda)
 
size_t fastq_paired_two_files_for_each (const string &file1, const string &file2, function< void(Alignment &, Alignment &)> lambda)
 
void parse_rg_sample_map (char *hts_header, map< string, string > &rg_sample)
 
string alignment_to_sam_internal (const Alignment &alignment, const string &refseq, const int32_t refpos, const bool refrev, const vector< pair< int, char >> &cigar, const string &mateseq, const int32_t matepos, bool materev, const int32_t tlen, bool paired, const int32_t tlen_max)
 
int32_t determine_flag (const Alignment &alignment, const string &refseq, const int32_t refpos, const bool refrev, const string &mateseq, const int32_t matepos, bool materev, const int32_t tlen, bool paired, const int32_t tlen_max)
 Returns the SAM bit-coded flag for alignment with. More...
 
string alignment_to_sam (const Alignment &alignment, const string &refseq, const int32_t refpos, const bool refrev, const vector< pair< int, char >> &cigar, const string &mateseq, const int32_t matepos, bool materev, const int32_t tlen, const int32_t tlen_max)
 
string alignment_to_sam (const Alignment &alignment, const string &refseq, const int32_t refpos, const bool refrev, const vector< pair< int, char >> &cigar)
 
bam1_t * alignment_to_bam_internal (bam_hdr_t *header, const Alignment &alignment, const string &refseq, const int32_t refpos, const bool refrev, const vector< pair< int, char >> &cigar, const string &mateseq, const int32_t matepos, bool materev, const int32_t tlen, bool paired, const int32_t tlen_max)
 
bam1_t * alignment_to_bam (bam_hdr_t *bam_header, const Alignment &alignment, const string &refseq, const int32_t refpos, const bool refrev, const vector< pair< int, char >> &cigar, const string &mateseq, const int32_t matepos, bool materev, const int32_t tlen, const int32_t tlen_max)
 
bam1_t * alignment_to_bam (bam_hdr_t *bam_header, const Alignment &alignment, const string &refseq, const int32_t refpos, const bool refrev, const vector< pair< int, char >> &cigar)
 
string cigar_string (const vector< pair< int, char > > &cigar)
 
string mapping_string (const string &source, const Mapping &mapping)
 
void append_cigar_operation (const int length, const char operation, vector< pair< int, char >> &cigar)
 
void mapping_cigar (const Mapping &mapping, vector< pair< int, char >> &cigar)
 
int64_t cigar_mapping (const bam1_t *b, Mapping *mapping)
 
void mapping_against_path (Alignment &alignment, const bam1_t *b, char *chr, const PathPositionHandleGraph *graph, bool on_reverse_strand)
 
vector< pair< int, char > > cigar_against_path (const Alignment &alignment, bool on_reverse_strand, int64_t &pos, size_t path_len, size_t softclip_suppress)
 
pair< int32_t, int32_t > compute_template_lengths (const int64_t &pos1, const vector< pair< int, char >> &cigar1, const int64_t &pos2, const vector< pair< int, char >> &cigar2)
 
int32_t sam_flag (const Alignment &alignment, bool on_reverse_strand, bool paired)
 
Alignment bam_to_alignment (const bam1_t *b, map< string, string > &rg_sample, const bam_hdr_t *bh, const PathPositionHandleGraph *graph)
 
Alignment bam_to_alignment (const bam1_t *b, map< string, string > &rg_sample)
 
int alignment_to_length (const Alignment &a)
 
int alignment_from_length (const Alignment &a)
 
Alignment strip_from_start (const Alignment &aln, size_t drop)
 
Alignment strip_from_end (const Alignment &aln, size_t drop)
 
Alignment trim_alignment (const Alignment &aln, const Position &pos1, const Position &pos2)
 
vector< Alignmentalignment_ends (const Alignment &aln, size_t len1, size_t len2)
 
Alignment alignment_middle (const Alignment &aln, int len)
 
vector< Alignmentreverse_complement_alignments (const vector< Alignment > &alns, const function< int64_t(int64_t)> &node_length)
 
Alignment reverse_complement_alignment (const Alignment &aln, const function< int64_t(id_t)> &node_length)
 
void reverse_complement_alignment_in_place (Alignment *aln, const function< int64_t(id_t)> &node_length)
 
Alignment merge_alignments (const vector< Alignment > &alns)
 
Alignmentextend_alignment (Alignment &a1, const Alignment &a2, bool debug)
 
Alignment merge_alignments (const Alignment &a1, const Alignment &a2, bool debug)
 
void translate_nodes (Alignment &a, const unordered_map< id_t, pair< id_t, bool > > &ids, const std::function< size_t(int64_t)> &node_length)
 
void flip_nodes (Alignment &a, const set< int64_t > &ids, const std::function< size_t(int64_t)> &node_length)
 
int non_match_start (const Alignment &alignment)
 
int non_match_end (const Alignment &alignment)
 
int softclip_start (const Alignment &alignment)
 
int softclip_end (const Alignment &alignment)
 
int softclip_trim (Alignment &alignment)
 
int query_overlap (const Alignment &aln1, const Alignment &aln2)
 
int edit_count (const Alignment &alignment)
 
size_t to_length_after_pos (const Alignment &aln, const Position &pos)
 
size_t from_length_after_pos (const Alignment &aln, const Position &pos)
 
size_t to_length_before_pos (const Alignment &aln, const Position &pos)
 
size_t from_length_before_pos (const Alignment &aln, const Position &pos)
 
const string hash_alignment (const Alignment &aln)
 
Alignment simplify (const Alignment &a, bool trim_internal_deletions)
 
void normalize_alignment (Alignment &alignment)
 Merge adjacent edits of the same type and convert all N matches to mismatches. More...
 
bool uses_Us (const Alignment &alignment)
 
void convert_alignment_char (Alignment &alignment, char from, char to)
 
void convert_Us_to_Ts (Alignment &alignment)
 Replaces any U's in the sequence or the Path with T's. More...
 
void convert_Ts_to_Us (Alignment &alignment)
 Replaces any T's in the sequence or the Path with U's. More...
 
map< id_t, int > alignment_quality_per_node (const Alignment &aln)
 
string middle_signature (const Alignment &aln, int len)
 
pair< string, string > middle_signature (const Alignment &aln1, const Alignment &aln2, int len)
 
string signature (const Alignment &aln)
 
pair< string, string > signature (const Alignment &aln1, const Alignment &aln2)
 
void parse_bed_regions (istream &bedstream, const PathPositionHandleGraph *graph, vector< Alignment > *out_alignments)
 
void parse_gff_regions (istream &gffstream, const PathPositionHandleGraph *graph, vector< Alignment > *out_alignments)
 
Position alignment_start (const Alignment &aln)
 
Position alignment_end (const Alignment &aln)
 
map< string,vector< pair< size_t, bool > > > alignment_refpos_to_path_offsets (const Alignment &aln)
 return the path offsets as cached in the alignment More...
 
void alignment_set_distance_to_correct (Alignment &aln, const Alignment &base)
 annotate the first alignment with its minimum distance to the second in their annotated paths More...
 
void alignment_set_distance_to_correct (Alignment &aln, const map< string, vector< pair< size_t, bool > > > &base_offsets)
 
bool alignment_is_valid (Alignment &aln, const HandleGraph *hgraph)
 check to make sure edits on the alignment's path don't assume incorrect node lengths or ids More...
 
Alignment target_alignment (const PathPositionHandleGraph *graph, const string &name, size_t pos1, size_t pos2, const string &feature, bool is_reverse, Mapping &cigar_mapping)
 
Alignment target_alignment (const PathPositionHandleGraph *graph, const string &name, size_t pos1, size_t pos2, const string &feature, bool is_reverse)
 
int fastq_for_each (string &filename, function< void(Alignment &)> lambda)
 
void write_alignment_to_file (const Alignment &aln, const string &filename)
 
void mapping_cigar (const Mapping &mapping, vector< pair< int, char > > &cigar)
 
void cigar_mapping (const bam1_t *b, Mapping &mapping)
 
void mapping_against_path (Alignment &alignment, const bam1_t *b, const PathPositionHandleGraph *graph, bool on_reverse_strand)
 
template<typename AnnotationType , typename Annotated >
AnnotationType get_annotation (const Annotated &annotated, const string &name)
 
template<typename AnnotationType , typename Annotated >
AnnotationType get_annotation (Annotated *annotated, const string &name)
 
template<typename AnnotationType , typename Annotated >
void set_annotation (Annotated *annotated, const string &name, const AnnotationType &annotation)
 
template<typename AnnotationType , typename Annotated >
void set_annotation (Annotated &annotated, const string &name, const AnnotationType &annotation)
 
template<typename Annotated >
void clear_annotation (Annotated *annotated, const string &name)
 Clear the annotation with the given name. More...
 
template<typename Annotated >
void clear_annotation (Annotated &annotated, const string &name)
 Clear the annotation with the given name. More...
 
template<typename Annotated >
void for_each_basic_annotation (const Annotated &annotated, const function< void(const string &)> null_lambda, const function< void(const string &, double)> double_lambda, const function< void(const string &, bool)> bool_lambda, const function< void(const string &, const string &)> string_lambda)
 
template<typename T >
value_cast (const google::protobuf::Value &value)
 Cast a Protobuf generic Value to any type. More...
 
template<typename T >
google::protobuf::Value value_cast (const T &wrap)
 Cast any type to a generic Protobuf value. More...
 
template<>
bool value_cast< bool > (const google::protobuf::Value &value)
 
template<>
double value_cast< double > (const google::protobuf::Value &value)
 
template<>
string value_cast< string > (const google::protobuf::Value &value)
 
template<>
google::protobuf::Value value_cast< bool > (const bool &wrap)
 
template<>
google::protobuf::Value value_cast< double > (const double &wrap)
 
template<>
google::protobuf::Value value_cast< string > (const string &wrap)
 
template<>
google::protobuf::Value value_cast< size_t > (const size_t &wrap)
 
template<>
google::protobuf::Value value_cast< int > (const int &wrap)
 
template<typename Container >
Container value_cast (const google::protobuf::Value &value)
 Cast a Protobuf generic Value to any type. More...
 
template<typename Container >
google::protobuf::Value value_cast (const Container &wrap)
 
void augment (MutablePathMutableHandleGraph *graph, const string &gam_path, const string &aln_format, vector< Translation > *out_translations, const string &gam_out_path, bool embed_paths, bool break_at_ends, bool remove_softclips, bool filter_out_of_graph_alignments, double min_baseq, double min_mapq, Packer *packer, size_t min_bp_coverage, double max_frac_n)
 
void augment (MutablePathMutableHandleGraph *graph, vector< Path > &path_vector, const string &aln_format, vector< Translation > *out_translations, const string &gam_out_path, bool embed_paths, bool break_at_ends, bool remove_softclips, bool filter_out_of_graph_alignments, double min_baseq, double min_mapq, Packer *packer, size_t min_bp_coverage, double max_frac_n)
 
void augment_impl (MutablePathMutableHandleGraph *graph, function< void(function< void(Alignment &)>, bool, bool)> iterate_gam, const string &aln_format, vector< Translation > *out_translation, const string &gam_out_path, bool embed_paths, bool break_at_ends, bool remove_soft_clips, bool filter_out_of_graph_alignments, double min_baseq, double min_mapq, Packer *packer, size_t min_bp_coverage, double max_frac_n)
 Generic version used to implement the above three methods.
More...
 
double get_avg_baseq (const Edit &edit, const string &base_quals, size_t position_in_read)
 
void find_breakpoints (const Path &path, unordered_map< id_t, set< pos_t >> &breakpoints, bool break_ends, const string &base_quals, double min_baseq, double max_frac_n)
 
unordered_map< id_t, set< pos_t > > forwardize_breakpoints (const HandleGraph *graph, const unordered_map< id_t, set< pos_t >> &breakpoints)
 Flips the breakpoints onto the forward strand. More...
 
void find_packed_breakpoints (const Path &path, Packer &packed_breakpoints, bool break_ends=true, const string &base_quals="", double min_baseq=0, double max_frac_n=1.)
 Like "find_breakpoints", but store in packed structure (better for large gams and enables coverage filter) More...
 
unordered_map< id_t, set< pos_t > > filter_breakpoints_by_coverage (const Packer &packed_breakpoints, size_t min_bp_coverage)
 
path_handle_t add_path_to_graph (MutablePathHandleGraph *graph, const Path &path)
 
map< pos_t, id_tensure_breakpoints (MutableHandleGraph *graph, const unordered_map< id_t, set< pos_t >> &breakpoints)
 
bool simplify_filtered_edits (HandleGraph *graph, Alignment &aln, Path &path, const map< pos_t, id_t > &node_translation, const unordered_map< id_t, size_t > &orig_node_sizes, double min_baseq, double max_frac_n)
 
Path add_nodes_and_edges (MutableHandleGraph *graph, const Path &path, const map< pos_t, id_t > &node_translation, unordered_map< pair< pos_t, string >, vector< id_t >> &added_seqs, unordered_map< id_t, Path > &added_nodes, const unordered_map< id_t, size_t > &orig_node_sizes, size_t max_node_size=1024)
 This version doesn't require a set of dangling sides to populate
More...
 
Path add_nodes_and_edges (MutableHandleGraph *graph, const Path &path, const map< pos_t, id_t > &node_translation, unordered_map< pair< pos_t, string >, vector< id_t >> &added_seqs, unordered_map< id_t, Path > &added_nodes, const unordered_map< id_t, size_t > &orig_node_sizes, set< NodeSide > &dangling, size_t max_node_size)
 
vector< Translationmake_translation (const HandleGraph *graph, const map< pos_t, id_t > &node_translation, const unordered_map< id_t, Path > &added_nodes, const unordered_map< id_t, size_t > &orig_node_sizes)
 Produce a graph Translation object from information about the editing process. More...
 
ostream & operator<< (ostream &out, const BenchmarkResult &result)
 
void benchmark_control ()
 
BenchmarkResult run_benchmark (const string &name, size_t iterations, const function< void(void)> &under_test)
 
BenchmarkResult run_benchmark (const string &name, size_t iterations, const function< void(void)> &setup, const function< void(void)> &under_test)
 
void build_gcsa_lcp (const HandleGraph &graph, gcsa::GCSA *&gcsa, gcsa::LCPArray *&lcp, int kmer_size, size_t doubling_steps, size_t size_limit, const string &base_file_name)
 
void * mergeNodeObjects (void *a, void *b)
 
void getReachableBridges2 (stCactusEdgeEnd *edgeEnd1, stHash *bridgeEndsToBridgeNodes, stList *bridgeEnds)
 
void getReachableBridges (stCactusEdgeEnd *edgeEnd1, stList *bridgeEnds)
 
void addArbitraryTelomerePair (vector< stCactusEdgeEnd * > ends, stList *telomeres)
 
pair< stCactusGraph *, stList * > handle_graph_to_cactus (const PathHandleGraph &graph, const unordered_set< string > &hint_paths, bool single_component)
 
VG cactus_to_vg (stCactusGraph *cactus_graph)
 
VG cactusify (VG &graph)
 
vector< pair< gcsa::node_type, size_t > > mem_node_start_positions (const HandleGraph &graph, const vg::MaximalExactMatch &mem)
 get the handles that a mem covers More...
 
bdsg::HashGraph cluster_subgraph_containing (const HandleGraph &base, const Alignment &aln, const vector< vg::MaximalExactMatch > &cluster, const GSSWAligner *aligner)
 return a containing subgraph connecting the mems More...
 
bdsg::HashGraph cluster_subgraph_walk (const HandleGraph &base, const Alignment &aln, const vector< vg::MaximalExactMatch > &mems, double expansion)
 
template<typename T >
bool convert (const std::string &s, T &r)
 
template<typename T >
std::string convert (const T &r)
 
void stacktrace_manually (ostream &out, int signalNumber, void *ip, void **bp)
 
void emit_stacktrace (int signalNumber, siginfo_t *signalInfo, void *signalContext)
 Emit a stack trace when something bad happens. Add as a signal handler with sigaction. More...
 
void enable_crash_handling ()
 Main should call this to turn on our stack tracing support. More...
 
double entropy (const string &st)
 
double entropy (const char *st, size_t len)
 
template<class Element >
void in_place_subvector (std::vector< Element > &vec, size_t head, size_t tail)
 
void set_score (GaplessExtension &extension, const Aligner *aligner)
 
void match_initial (GaplessExtension &match, const std::string &seq, gbwtgraph::GBWTGraph::view_type target)
 
size_t match_forward (GaplessExtension &match, const std::string &seq, gbwtgraph::GBWTGraph::view_type target, uint32_t mismatch_limit)
 
void match_backward (GaplessExtension &match, const std::string &seq, gbwtgraph::GBWTGraph::view_type target, uint32_t mismatch_limit)
 
void handle_full_length (const HandleGraph &graph, std::vector< GaplessExtension > &result, double overlap_threshold)
 
void remove_duplicates (std::vector< GaplessExtension > &result)
 
void find_mismatches (const std::string &seq, const gbwtgraph::CachedGBWTGraph &graph, std::vector< GaplessExtension > &result)
 
size_t interval_length (std::pair< size_t, size_t > interval)
 
std::vector< handle_tget_path (const std::vector< handle_t > &first, handle_t second)
 
std::vector< handle_tget_path (handle_t first, const std::vector< handle_t > &second)
 
std::vector< handle_tget_path (const std::vector< handle_t > &first, gbwt::node_type second)
 
std::vector< handle_tget_path (gbwt::node_type reverse_first, const std::vector< handle_t > &second)
 
bool trim_mismatches (GaplessExtension &extension, const gbwtgraph::CachedGBWTGraph &graph, const Aligner &aligner)
 
std::vector< std::string > parseGenotypes (const std::string &vcf_line, size_t num_samples)
 
gbwt::vector_type extract_as_gbwt_path (const PathHandleGraph &graph, const std::string &path_name)
 Extract a path as a GBWT path. More...
 
gbwt::vector_type path_predecessors (const PathHandleGraph &graph, const std::string &path_name)
 
gbwt::size_type gbwt_node_width (const HandleGraph &graph)
 Determine the node width in bits for the GBWT nodes based on the given graph. More...
 
void finish_gbwt_constuction (gbwt::GBWTBuilder &builder, const std::vector< std::string > &sample_names, const std::vector< std::string > &contig_names, size_t haplotype_count, bool print_metadata)
 Finish GBWT construction and optionally print the metadata. More...
 
std::string insert_gbwt_path (MutablePathHandleGraph &graph, const gbwt::GBWT &gbwt_index, gbwt::size_type id)
 
Path extract_gbwt_path (const HandleGraph &graph, const gbwt::GBWT &gbwt_index, gbwt::size_type id)
 
std::string thread_name (const gbwt::GBWT &gbwt_index, gbwt::size_type id)
 
gbwt::GBWT get_gbwt (const std::vector< gbwt::vector_type > &paths)
 Transform the paths into a GBWT index. Primarily for testing. More...
 
handle_t gbwt_to_handle (const HandleGraph &graph, gbwt::node_type node)
 Convert gbwt::node_type to handle_t. More...
 
pos_t gbwt_to_pos (gbwt::node_type node, size_t offset)
 Convert gbwt::node_type and an offset as size_t to pos_t. More...
 
gbwt::node_type handle_to_gbwt (const HandleGraph &graph, handle_t handle)
 Convert handle_t to gbwt::node_type. More...
 
gbwt::node_type pos_to_gbwt (pos_t pos)
 Extract gbwt::node_type from pos_t. More...
 
gbwt::node_type mapping_to_gbwt (const Mapping &mapping)
 Convert Mapping to gbwt::node_type. More...
 
gbwt::vector_type path_to_gbwt (const Path &path)
 Convert Path to a GBWT path. More...
 
SnarlTraversal get_traversal_of_snarl (VG &graph, const Snarl *snarl, const SnarlManager &manager, const Path &path)
 
string traversal_to_string (VG &graph, const SnarlTraversal &path)
 
Support make_support (double forward, double reverse, double quality)
 
double total (const Support &support)
 
Support support_min (const Support &a, const Support &b)
 
Support support_max (const Support &a, const Support &b)
 
Support flip (const Support &to_flip)
 
Support operator+ (const Support &one, const Support &other)
 
Supportoperator+= (Support &one, const Support &other)
 
bool operator< (const Support &a, const Support &b)
 
bool operator> (const Support &a, const Support &b)
 
ostream & operator<< (ostream &stream, const Support &support)
 
string to_vcf_genotype (const Genotype &gt)
 
template<typename Scalar >
Support operator* (const Support &support, const Scalar &scale)
 
template<typename Scalar >
Supportoperator*= (Support &support, const Scalar &scale)
 
template<typename Scalar >
Support operator* (const Scalar &scale, const Support &support)
 
template<typename Scalar >
Support operator/ (const Support &support, const Scalar &scale)
 
template<typename Scalar >
Supportoperator/= (Support &support, const Scalar &scale)
 
string allele_to_string (VG &graph, const Path &allele)
 
template<typename T >
void set_intersection (const unordered_set< T > &set_1, const unordered_set< T > &set_2, unordered_set< T > *out_intersection)
 
void graph_to_gfa (const unique_ptr< PathHandleGraph > &graph, ostream &out)
 Export the given VG graph to the given GFA file. More...
 
void sort_by_id_dedup_and_clean (Graph &graph)
 remove duplicates and sort by id More...
 
void remove_duplicates (Graph &graph)
 remove duplicate nodes and edges More...
 
void remove_duplicate_edges (Graph &graph)
 remove duplicate edges More...
 
void remove_duplicate_nodes (Graph &graph)
 remove duplicate nodes More...
 
void remove_orphan_edges (Graph &graph)
 remove edges that link to a node that is not in the graph More...
 
void sort_by_id (Graph &graph)
 order the nodes and edges in the graph by id More...
 
void sort_nodes_by_id (Graph &graph)
 order the nodes in the graph by id More...
 
void sort_edges_by_id (Graph &graph)
 order the edges in the graph by id pairs More...
 
bool is_id_sortable (const Graph &graph)
 returns true if the graph is id-sortable (no reverse links) More...
 
bool has_inversion (const Graph &graph)
 returns true if we find an edge that may specify an inversion More...
 
void flip_doubly_reversed_edges (Graph &graph)
 clean up doubly-reversed edges More...
 
void from_handle_graph (const HandleGraph &from, Graph &to)
 
void from_path_handle_graph (const PathHandleGraph &from, Graph &to)
 
void trace_haplotypes_and_paths (const PathHandleGraph &source, const gbwt::GBWT &haplotype_database, vg::id_t start_node, int extend_distance, Graph &out_graph, map< string, int > &out_thread_frequencies, bool expand_graph)
 
void output_haplotype_counts (ostream &annotation_ostream, vector< pair< thread_t, int >> &haplotype_list)
 
Graph output_graph_with_embedded_paths (vector< pair< thread_t, int >> &haplotype_list, const HandleGraph &source)
 
void output_graph_with_embedded_paths (ostream &subgraph_ostream, vector< pair< thread_t, int >> &haplotype_list, const HandleGraph &source, bool json)
 
void thread_to_graph_spanned (thread_t &t, Graph &g, const HandleGraph &source)
 
void add_thread_nodes_to_set (thread_t &t, set< int64_t > &nodes)
 
void add_thread_edges_to_set (thread_t &t, set< pair< int, int > > &edges)
 
void construct_graph_from_nodes_and_edges (Graph &g, const HandleGraph &source, set< int64_t > &nodes, set< pair< int, int > > &edges)
 
Path path_from_thread_t (thread_t &t, const HandleGraph &source)
 
vector< pair< thread_t, int > > list_haplotypes (const HandleGraph &source, const gbwt::GBWT &haplotype_database, gbwt::node_type start_node, int extend_distance)
 
unique_ptr< AlignmentEmitterget_alignment_emitter (const string &filename, const string &format, const map< string, int64_t > &path_length, size_t max_threads, const HandleGraph *graph)
 
void node_path_position (nid_t id, string &path_name, int64_t &position, bool backward, int64_t &offset)
 
void index_positions (VG &graph, map< long, Node * > &node_path, map< long, Edge * > &edge_path)
 
void for_each_kmer (const HandleGraph &graph, size_t k, const function< void(const kmer_t &)> &lambda, id_t head_id=0, id_t tail_id=0)
 Iterate over all the kmers in the graph, running lambda on each. More...
 
ostream & operator<< (ostream &out, const kmer_t &kmer)
 Print a kmer_t to a stream. More...
 
void kmer_to_gcsa_kmers (const kmer_t &kmer, const gcsa::Alphabet &alpha, const function< void(const gcsa::KMer &)> &lambda)
 Convert the kmer_t to a set of gcsa2 binary kmers which are exposed via a callback. More...
 
gcsa::byte_type encode_chars (const vector< char > &chars, const gcsa::Alphabet &alpha)
 Encode the chars into the gcsa2 byte. More...
 
void write_gcsa_kmers (const HandleGraph &graph, int kmer_size, ostream &out, size_t &size_limit, id_t head_id, id_t tail_id)
 
string write_gcsa_kmers_to_tmpfile (const HandleGraph &graph, int kmer_size, size_t &size_limit, id_t head_id, id_t tail_id, const string &base_file_name)
 
int sub_overlaps_of_first_aln (const vector< Alignment > &alns, float overlap_fraction)
 
set< pos_tgcsa_nodes_to_positions (const vector< gcsa::node_type > &nodes)
 
const int balanced_stride (int read_length, int kmer_size, int stride)
 
const vector< string > balanced_kmers (const string &seq, const int kmer_size, const int stride)
 
pair< int64_t, int64_t > mem_min_oriented_distances (const MaximalExactMatch &m1, const MaximalExactMatch &m2)
 
bool operator== (const MaximalExactMatch &m1, const MaximalExactMatch &m2)
 
bool operator< (const MaximalExactMatch &m1, const MaximalExactMatch &m2)
 
ostream & operator<< (ostream &out, const MaximalExactMatch &mem)
 
const string mems_to_json (const vector< MaximalExactMatch > &mems)
 
vector< string::const_iterator > cluster_cover (const vector< MaximalExactMatch > &cluster)
 
int cluster_coverage (const vector< MaximalExactMatch > &cluster)
 
bool mems_overlap (const MaximalExactMatch &mem1, const MaximalExactMatch &mem2)
 
int mems_overlap_length (const MaximalExactMatch &mem1, const MaximalExactMatch &mem2)
 
bool clusters_overlap_in_read (const vector< MaximalExactMatch > &cluster1, const vector< MaximalExactMatch > &cluster2)
 
int clusters_overlap_length (const vector< MaximalExactMatch > &cluster1, const vector< MaximalExactMatch > &cluster2)
 
vector< pos_tcluster_nodes (const vector< MaximalExactMatch > &cluster)
 
bool clusters_overlap_in_graph (const vector< MaximalExactMatch > &cluster1, const vector< MaximalExactMatch > &cluster2)
 
vector< MaximalExactMatchtranslate_mems (const vector< MaximalExactMatch > &mems, const unordered_map< id_t, pair< id_t, bool > > &trans)
 
string get_proc_status_value (const string &name)
 Get the string value for a field in /proc/self/status by name, or "" if unsupported or not found. More...
 
size_t get_max_rss_kb ()
 Get the max RSS usage ever, in kb, or 0 if unsupported. More...
 
size_t get_max_vmem_kb ()
 Get the max virtual memory size ever, in kb, or 0 if unsupported. More...
 
size_t get_current_vmem_kb ()
 Get the current virtual memory size, in kb, or 0 if unsupported. More...
 
void find_pareto_frontier (std::vector< pareto_point > &v)
 
int32_t gap_penalty (size_t length, const Aligner *aligner)
 
int32_t mismatch_penalty (size_t n, const Aligner *aligner)
 
int32_t gap_penalty (size_t start, size_t limit, const Aligner *aligner)
 
int32_t flank_penalty (size_t length, const std::vector< pareto_point > &frontier, const Aligner *aligner)
 
void topologically_order_subpaths (multipath_alignment_t &multipath_aln)
 Put subpaths in topological order (assumed to be true for other algorithms) More...
 
void remove_empty_subpaths (multipath_alignment_t &multipath_aln)
 
void identify_start_subpaths (multipath_alignment_t &multipath_aln)
 
tuple< MultipathProblem, int64_t, int32_t > run_multipath_dp (const multipath_alignment_t &multipath_aln, bool subpath_global=false)
 
template<typename TracebackIterator >
void populate_path_from_traceback (const multipath_alignment_t &multipath_aln, const MultipathProblem &problem, TracebackIterator traceback_start, TracebackIterator traceback_end, Path *output)
 
int32_t optimal_alignment_internal (const multipath_alignment_t &multipath_aln, Alignment *aln_out, bool subpath_global)
 
void optimal_alignment (const multipath_alignment_t &multipath_aln, Alignment &aln_out, bool subpath_global)
 
int32_t optimal_alignment_score (const multipath_alignment_t &multipath_aln, bool subpath_global)
 
vector< Alignmentoptimal_alignments (const multipath_alignment_t &multipath_aln, size_t count)
 
vector< Alignmentoptimal_alignments_with_disjoint_subpaths (const multipath_alignment_t &multipath_aln, size_t count)
 
vector< Alignmenthaplotype_consistent_alignments (const multipath_alignment_t &multipath_aln, const haplo::ScoreProvider &score_provider, size_t soft_count, size_t hard_count, bool optimal_first)
 
pair< int64_t, int64_t > aligned_interval (const multipath_alignment_t &multipath_aln)
 The indexes on the read sequence of the portion of the read that is aligned outside of soft clips. More...
 
void rev_comp_subpath (const subpath_t &subpath, const function< int64_t(int64_t)> &node_length, subpath_t &rev_comp_out)
 
void rev_comp_multipath_alignment (const multipath_alignment_t &multipath_aln, const function< int64_t(int64_t)> &node_length, multipath_alignment_t &rev_comp_out)
 
void rev_comp_multipath_alignment_in_place (multipath_alignment_t *multipath_aln, const function< int64_t(int64_t)> &node_length)
 
void convert_multipath_alignment_char (multipath_alignment_t &multipath_aln, char from, char to)
 
void convert_Us_to_Ts (multipath_alignment_t &multipath_aln)
 Replaces all U's in the sequence and the aligned Paths with T's. More...
 
void convert_Ts_to_Us (multipath_alignment_t &multipath_aln)
 Replaces all T's in the sequence and the aligned Paths with U's. More...
 
void to_proto_multipath_alignment (const multipath_alignment_t &multipath_aln, MultipathAlignment &proto_multipath_aln_out)
 Convert an STL-based multipath_alignment_t to a protobuf MultipathAlignment. More...
 
void from_proto_multipath_alignment (const MultipathAlignment &proto_multipath_aln, multipath_alignment_t &multipath_aln_out)
 Convert a protobuf MultipathAlignment to an STL-based multipath_alignment_t. More...
 
void to_multipath_alignment (const Alignment &aln, multipath_alignment_t &multipath_aln_out)
 
template<class ProtoAlignment >
void transfer_from_proto_annotation (const ProtoAlignment &from, multipath_alignment_t &to)
 
template<class ProtoAlignment >
void transfer_to_proto_annotation (const multipath_alignment_t &from, ProtoAlignment &to)
 
void transfer_read_metadata (const MultipathAlignment &from, multipath_alignment_t &to)
 
void transfer_read_metadata (const multipath_alignment_t &from, MultipathAlignment &to)
 
void transfer_read_metadata (const multipath_alignment_t &from, multipath_alignment_t &to)
 
void transfer_read_metadata (const Alignment &from, multipath_alignment_t &to)
 
void transfer_read_metadata (const multipath_alignment_t &from, Alignment &to)
 
void transfer_read_metadata (const Alignment &from, Alignment &to)
 
void transfer_proto_metadata (const Alignment &from, MultipathAlignment &to)
 
void transfer_proto_metadata (const MultipathAlignment &from, Alignment &to)
 
void merge_non_branching_subpaths (multipath_alignment_t &multipath_aln)
 Merges non-branching paths in a multipath alignment in place. More...
 
vector< vector< int64_t > > connected_components (const multipath_alignment_t &multipath_aln)
 
void extract_sub_multipath_alignment (const multipath_alignment_t &multipath_aln, const vector< int64_t > &subpath_indexes, multipath_alignment_t &sub_multipath_aln)
 
void append_multipath_alignment (multipath_alignment_t &multipath_aln, const multipath_alignment_t &to_append)
 Add the subpaths of one multipath alignment onto another. More...
 
vector< tuple< int64_t, int64_t, int64_t, int64_t > > search_multipath_alignment (const multipath_alignment_t &multipath_aln, const pos_t &graph_pos, int64_t seq_pos)
 
pair< tuple< int64_t, int64_t, int64_t, int64_t >, tuple< int64_t, int64_t, int64_t > > trace_path (const multipath_alignment_t &multipath_aln, const Path &path, int64_t subpath_idx, int64_t mapping_idx, int64_t edit_idx, int64_t base_idx)
 
bool validate_multipath_alignment (const multipath_alignment_t &multipath_aln, const HandleGraph &handle_graph)
 
void view_multipath_alignment (ostream &out, const multipath_alignment_t &multipath_aln, const HandleGraph &handle_graph)
 Send a formatted string representation of the multipath_alignment_t into the ostream. More...
 
void view_multipath_alignment_as_dot (ostream &out, const multipath_alignment_t &multipath_aln, bool show_graph=false)
 Converts a multipath_alignment_t to a GraphViz Dot representation, output to the given ostream. More...
 
string debug_string (const connection_t &connection)
 
string debug_string (const subpath_t &subpath)
 
string debug_string (const multipath_alignment_t &multipath_aln)
 
NodeSide node_start (id_t id)
 Produce the start NodeSide of a Node. More...
 
NodeSide node_end (id_t id)
 Produce the end NodeSide of a Node. More...
 
ostream & operator<< (ostream &out, const NodeSide &nodeside)
 Print a NodeSide to a stream. More...
 
ostream & operator<< (ostream &out, const NodeTraversal &nodetraversal)
 Print the given NodeTraversal. More...
 
ostream & operator<< (ostream &out, mapping_t mapping)
 Allow a mapping_t to be printed, for debugging purposes. More...
 
Pathappend_path (Path &a, const Path &b)
 
int path_to_length (const Path &path)
 
int path_from_length (const Path &path)
 
int mapping_to_length (const Mapping &m)
 
int mapping_from_length (const Mapping &m)
 
int softclip_start (const Mapping &mapping)
 
int softclip_end (const Mapping &mapping)
 
Position first_path_position (const Path &path)
 
Position last_path_position (const Path &path)
 
int to_length (const Mapping &m)
 
int from_length (const Mapping &m)
 
Pathextend_path (Path &path1, const Path &path2)
 
Path concat_paths (const Path &path1, const Path &path2)
 
Path simplify (const Path &p, bool trim_internal_deletions)
 
Mapping concat_mappings (const Mapping &m, const Mapping &n, bool trim_internal_deletions)
 
Mapping simplify (const Mapping &m, bool trim_internal_deletions)
 
Mapping merge_adjacent_edits (const Mapping &m)
 Merge adjacent edits of the same type. More...
 
Path trim_hanging_ends (const Path &p)
 
bool mapping_ends_in_deletion (const Mapping &m)
 
bool mapping_starts_in_deletion (const Mapping &m)
 
bool mapping_is_total_deletion (const Mapping &m)
 
bool mapping_is_simple_match (const Mapping &m)
 
bool path_is_simple_match (const Path &p)
 
const string mapping_sequence (const Mapping &mp, const string &node_seq)
 
const string mapping_sequence (const Mapping &mp, const Node &n)
 
string path_sequence (const HandleGraph &graph, const Path &path)
 
Mapping reverse_complement_mapping (const Mapping &m, const function< int64_t(id_t)> &node_length)
 
void reverse_complement_mapping_in_place (Mapping *m, const function< int64_t(id_t)> &node_length)
 
Path reverse_complement_path (const Path &path, const function< int64_t(id_t)> &node_length)
 
void reverse_complement_path_in_place (Path *path, const function< int64_t(id_t)> &node_length)
 
pair< Mapping, Mappingcut_mapping (const Mapping &m, const Position &pos)
 
pair< mapping_t, mapping_tcut_mapping (const mapping_t &m, const Position &pos)
 
pair< Mapping, Mappingcut_mapping_offset (const Mapping &m, size_t offset)
 
pair< mapping_t, mapping_tcut_mapping_offset (const mapping_t &m, size_t offset)
 
pair< Mapping, Mappingcut_mapping (const Mapping &m, size_t offset)
 
pair< mapping_t, mapping_tcut_mapping (const mapping_t &m, size_t offset)
 
pair< Path, Pathcut_path (const Path &path, const Position &pos)
 
pair< Path, Pathcut_path (const Path &path, size_t offset)
 
bool maps_to_node (const Path &p, id_t id)
 
Position path_start_position (const Path &path)
 
string path_to_string (Path p)
 
Position path_end_position (const Path &path)
 
bool adjacent_mappings (const Mapping &m1, const Mapping &m2)
 
bool mapping_is_match (const Mapping &m)
 
double divergence (const Mapping &m)
 
double identity (const Path &path)
 
void decompose (const Path &path, map< pos_t, int > &ref_positions, map< pos_t, Edit > &edits)
 
double overlap (const Path &p1, const Path &p2)
 
void translate_node_ids (Path &path, const unordered_map< id_t, id_t > &translator)
 Switches the node ids in the path to the ones indicated by the translator. More...
 
void translate_node_ids (Path &path, const unordered_map< id_t, id_t > &translator, id_t cut_node, size_t bases_removed, bool from_right)
 
void translate_oriented_node_ids (Path &path, const unordered_map< id_t, pair< id_t, bool >> &translator)
 Switches the node ids and orientations in the path to the ones indicated by the translator. More...
 
void translate_oriented_node_ids (Path &path, const function< pair< id_t, bool >(id_t)> &translator)
 Switches node ids and orientations in the path to the ones indicated by the translator. More...
 
void translate_node_ids (path_t &path, const unordered_map< id_t, id_t > &translator)
 
void translate_oriented_node_ids (path_t &path, const unordered_map< id_t, pair< id_t, bool >> &translator)
 
void translate_oriented_node_ids (path_t &path, const function< pair< id_t, bool >(id_t)> &translator)
 
pos_t initial_position (const Path &path)
 
pos_t final_position (const Path &path)
 
Path path_from_node_traversals (const list< NodeTraversal > &traversals)
 
void remove_paths (Graph &graph, const function< bool(const string &)> &paths_to_take, std::list< Path > *matching)
 
Path path_from_path_handle (const PathHandleGraph &graph, path_handle_t path_handle)
 
Alignment alignment_from_path (const HandleGraph &graph, const Path &path)
 
void from_proto_edit (const Edit &proto_edit, edit_t &edit)
 
void to_proto_edit (const edit_t &edit, Edit &proto_edit)
 
void from_proto_mapping (const Mapping &proto_mapping, path_mapping_t &mapping)
 
void to_proto_mapping (const path_mapping_t &mapping, Mapping &proto_mapping)
 
void from_proto_path (const Path &proto_path, path_t &path)
 
void to_proto_path (const path_t &path, Path &proto_path)
 
int mapping_from_length (const path_mapping_t &mapping)
 
int path_from_length (const path_t &path)
 
int mapping_to_length (const path_mapping_t &mapping)
 
int path_to_length (const path_t &path)
 
void reverse_complement_mapping_in_place (path_mapping_t *m, const function< int64_t(id_t)> &node_length)
 
path_mapping_t reverse_complement_mapping (const path_mapping_t &m, const function< int64_t(id_t)> &node_length)
 
path_t reverse_complement_path (const path_t &path, const function< int64_t(id_t)> &node_length)
 
void reverse_complement_path_in_place (path_t *path, const function< int64_t(id_t)> &node_length)
 
pos_t initial_position (const path_t &path)
 
pos_t final_position (const path_t &path)
 
string debug_string (const path_t &path)
 
string debug_string (const path_mapping_t &mapping)
 
string debug_string (const edit_t &edit)
 
Pathincrement_node_mapping_ids (Path &p, id_t inc)
 
const Paths paths_from_graph (Graph &g)
 
Path merge_adjacent_edits (const Path &m)
 Merge adjacent edits of the same type. More...
 
vg::id_t path_node (const vector< pair< vg::id_t, bool >> &path, size_t i)
 
vg::id_t path_node (const gbwt::vector_type &path, size_t i)
 
size_t path_size (const vector< pair< vg::id_t, bool >> &path)
 
size_t path_size (const gbwt::vector_type &path)
 
bool path_reverse (const vector< pair< vg::id_t, bool >> &path, size_t i)
 
bool path_reverse (const gbwt::vector_type &path, size_t i)
 
std::ostream & operator<< (std::ostream &out, PathBranch branch)
 
template<class PathType >
bool verify_path (const PathType &path, MutableHandleGraph &unfolded, const hash_map< vg::id_t, std::vector< vg::id_t >> &reverse_mapping)
 
template<class Decoder >
void printId (vg::id_t id)
 
PhaseUnfolder::path_type canonical_orientation (const PhaseUnfolder::path_type &path, bool &from_border, bool &to_border)
 
pos_t make_pos_t (const Position &pos)
 Convert a Position to a (much smaller) pos_t. More...
 
pos_t make_pos_t (const position_t &pos)
 
pos_t make_pos_t (gcsa::node_type node)
 Create a pos_t from a gcsa node. More...
 
Position make_position (const pos_t &pos)
 Convert a pos_t to a Position. More...
 
Position make_position (id_t id, bool is_rev, off_t off)
 Create a Position from a Node ID, an orientation flag, and an offset along that strand of the node. More...
 
Position make_position (gcsa::node_type node)
 Make a Position from a gcsa node. More...
 
Position reverse (const Position &pos, size_t node_length)
 
pair< int64_t, int64_t > min_oriented_distances (const unordered_map< path_handle_t, vector< pair< size_t, bool > > > &path_offsets1, const unordered_map< path_handle_t, vector< pair< size_t, bool > > > &path_offsets2)
 Find the min distance in the path offsets where the path orientation is the same and different. More...
 
string debug_string (const position_t &pos)
 
void preflight_check ()
 
pair_hash_set< edge_tfind_edges_to_prune (const HandleGraph &graph, size_t k, size_t edge_max)
 Iterate over all the walks up to length k, adding edges which. More...
 
ostream & operator<< (ostream &os, const ReadFilter::Counts &counts)
 
void parse_region (const string &target, string &name, int64_t &start, int64_t &end)
 
void parse_bed_regions (const string &bed_path, vector< Region > &out_regions, vector< string > *out_names)
 
void parse_region (string &region, Region &out_region)
 
pos_t position_at (PathPositionHandleGraph *xgidx, const string &path_name, const size_t &path_offset, bool is_reverse)
 
int64_t min_not_minus_one (int64_t n1, int64_t n2)
 
string to_string (const HandleGraph &graph, handle_t handle)
 
string to_string (const HandleGraph &graph, edge_t edge)
 
bool start_backward (const Chain &chain)
 
bool end_backward (const Chain &chain)
 
Visit get_start_of (const Chain &chain)
 
Visit get_end_of (const Chain &chain)
 
ChainIterator chain_begin (const Chain &chain)
 
ChainIterator chain_end (const Chain &chain)
 
ChainIterator chain_rbegin (const Chain &chain)
 
ChainIterator chain_rend (const Chain &chain)
 
ChainIterator chain_rcbegin (const Chain &chain)
 
ChainIterator chain_rcend (const Chain &chain)
 
ChainIterator chain_begin_from (const Chain &chain, const Snarl *start_snarl, bool snarl_orientation)
 
ChainIterator chain_end_from (const Chain &chain, const Snarl *start_snarl, bool snarl_orientation)
 
edge_t to_edge (const handlegraph::HandleGraph &graph, const Visit &v1, const Visit &v2)
 Make an edge_t from a pair of visits. More...
 
bool operator== (const Visit &a, const Visit &b)
 
bool operator!= (const Visit &a, const Visit &b)
 
bool operator< (const Visit &a, const Visit &b)
 
ostream & operator<< (ostream &out, const Visit &visit)
 
bool operator== (const SnarlTraversal &a, const SnarlTraversal &b)
 
bool operator!= (const SnarlTraversal &a, const SnarlTraversal &b)
 
bool operator< (const SnarlTraversal &a, const SnarlTraversal &b)
 
bool operator== (const Snarl &a, const Snarl &b)
 
bool operator!= (const Snarl &a, const Snarl &b)
 
bool operator< (const Snarl &a, const Snarl &b)
 
ostream & operator<< (ostream &out, const Snarl &snarl)
 
NodeTraversal to_node_traversal (const Visit &visit, const VG &graph)
 
NodeTraversal to_rev_node_traversal (const Visit &visit, const VG &graph)
 
NodeSide to_left_side (const Visit &visit)
 Converts a Visit to a node or snarl into a NodeSide for its left side. More...
 
NodeSide to_right_side (const Visit &visit)
 Converts a Visit to a node or snarl into a NodeSide for its right side. More...
 
Visit to_visit (const NodeTraversal &node_traversal)
 Converts a NodeTraversal to a Visit. More...
 
Visit to_visit (const Mapping &mapping, bool make_full_node_match=false)
 
Visit to_visit (id_t node_id, bool is_reverse)
 Make a Visit from a node ID and an orientation. More...
 
Visit to_visit (const Snarl &snarl)
 Make a Visit from a snarl to traverse. More...
 
Visit to_visit (const handlegraph::HandleGraph &graph, const handle_t &handle)
 Make a Visit from a handle in a HandleGraph. More...
 
Visit reverse (const Visit &visit)
 Get the reversed version of a visit. More...
 
Visit to_rev_visit (const NodeTraversal &node_traversal)
 Converts a NodeTraversal to a Visit in the opposite orientation. More...
 
Mapping to_mapping (const Visit &visit, std::function< size_t(id_t)> node_length)
 
Mapping to_mapping (const Visit &visit, const HandleGraph &vg)
 
Alignment to_alignment (const SnarlTraversal &trav, const HandleGraph &graph)
 Convert a snarl traversal into an alignment. More...
 
void transfer_boundary_info (const Snarl &from, Snarl &to)
 Copies the boundary Visits from one Snarl into another. More...
 
NodeTraversal to_node_traversal (const Visit &visit, VG &graph)
 
NodeTraversal to_rev_node_traversal (const Visit &visit, VG &graph)
 
multipath_alignment_t from_hit (const Alignment &alignment, const HandleGraph &graph, const pos_t &hit_pos, const MaximalExactMatch &mem, const GSSWAligner &scorer)
 
More...
 
tuple< pos_t, int64_t, int32_t > trimmed_end (const Alignment &aln, int64_t len, bool from_end, const HandleGraph &graph, const GSSWAligner &aligner)
 
bool trim_path (path_t *path, bool from_left, int64_t mapping_idx, int64_t edit_idx, int64_t base_idx)
 
pair< pair< Path, int32_t >, pair< Path, int32_t > > split_splice_segment (const Alignment &splice_segment, int64_t splice_junction_idx, const GSSWAligner &scorer, const HandleGraph &graph)
 
multipath_alignment_t && fuse_spliced_alignments (const Alignment &alignment, multipath_alignment_t &&left_mp_aln, multipath_alignment_t &&right_mp_aln, int64_t left_bridge_point, const Alignment &splice_segment, int64_t splice_junction_idx, int32_t splice_score, const GSSWAligner &scorer, const HandleGraph &graph)
 
double median (std::vector< int > &v)
 
void wellford_update (size_t &count, double &mean, double &M2, double new_val)
 
pair< double, double > wellford_mean_var (size_t count, double mean, double M2, bool sample_variance)
 
double phi (double x1, double x2)
 
double normal_inverse_cdf (double quantile)
 Inverse CDF of a standard normal distribution. Must have 0 < quantile < 1. More...
 
double slope (const std::vector< double > &x, const std::vector< double > &y)
 
double fit_zipf (const vector< double > &y)
 
double fit_fixed_shape_max_exponential (const vector< double > &x, double shape, double tolerance=1e-8)
 Returns the MLE rate parameter for the distribution of (shape) iid exponential RVs. More...
 
double fit_fixed_rate_max_exponential (const vector< double > &x, double rate, double tolerance=1e-8)
 Returns the MLE estimate for the number of iid exponential RVs the data are maxima of. More...
 
pair< double, double > fit_max_exponential (const vector< double > &x, double tolerance=1e-8)
 Returns the MLE rate and shape parameters of a max exponential. More...
 
double max_exponential_log_likelihood (const vector< double > &x, double rate, double shape, double location=0.0)
 The log likelihood of a max exponential with the given parameters on the given data. More...
 
pair< double, double > fit_weibull (const vector< double > &x)
 Returns an estimate of the rate and shape parameters of a Weibull distribution. More...
 
tuple< double, double, double > fit_offset_weibull (const vector< double > &x, double tolerance=1e-8)
 Returns an estimate of the rate, shape, and location (minimum value) of a 3-parameter Weibull distribution. More...
 
double weibull_log_likelihood (const vector< double > &x, double scale, double shape, double location=0.0)
 Returns the log likelihood of some data generated by a Weibull distribution. More...
 
double golden_section_search (const function< double(double)> &f, double x_min, double x_max, double tolerance=1e-8)
 Returns a local maximum of a function within an interval. More...
 
double phred_to_prob (uint8_t phred)
 Convert 8-bit Phred quality score to probability of wrongness, using a lookup table. More...
 
double phred_for_at_least_one (size_t p, size_t n)
 
double prob_for_at_least_one (size_t p, size_t n)
 
vector< vector< double > > transpose (const vector< vector< double >> &A)
 A shitty set of linear algebra functions. More...
 
vector< vector< double > > matrix_multiply (const vector< vector< double >> &A, const vector< vector< double >> &B)
 
vector< double > matrix_multiply (const vector< vector< double >> &A, const vector< double > &b)
 
vector< vector< double > > matrix_invert (const vector< vector< double >> &A)
 
vector< double > regress (const vector< vector< double >> &X, vector< double > &y)
 Returns the coefficients of a regression (does not automatically compute constant) More...
 
template<typename T >
double stdev (const T &v)
 
double add_log (double log_x, double log_y)
 
double subtract_log (double log_x, double log_y)
 
double ln_to_log10 (double ln)
 
double log10_to_ln (double l10)
 
double log10_add_one (double x)
 
double add_log10 (double i, double j)
 
template<typename T >
normal_pdf (T x, T m, T s)
 
double prob_to_logprob (double prob)
 Convert a probability to a natural log probability. More...
 
double logprob_to_prob (double logprob)
 Convert natural log probability to a probability. More...
 
double logprob_add (double logprob1, double logprob2)
 
double logprob_invert (double logprob)
 Invert a logprob, and get the probability of its opposite. More...
 
double phred_to_prob (double phred)
 Convert floating point Phred quality score to probability of wrongness. More...
 
double prob_to_phred (double prob)
 Convert probability of wrongness to integer Phred quality score. More...
 
double phred_to_logprob (int phred)
 Convert a Phred quality score directly to a natural log probability of wrongness. More...
 
double logprob_to_phred (double logprob)
 Convert a natural log probability of wrongness directly to a Phred quality score. More...
 
double logprob_geometric_mean (double lnprob1, double lnprob2)
 Take the geometric mean of two logprobs. More...
 
double phred_geometric_mean (double phred1, double phred2)
 Take the geometric mean of two phred-encoded probabilities. More...
 
double phred_add (double phred1, double phred2)
 
template<typename Collection >
Collection::value_type logprob_sum (const Collection &collection)
 
template<typename Iterator >
std::iterator_traits< Iterator >::value_type phred_sum (const Iterator &begin_it, const Iterator &end_it)
 
template<typename Collection >
Collection::value_type phred_sum (const Collection &collection)
 
double max_exponential_cdf (double x, double rate, double shape, double location=0.0)
 Return the CDF of a max exponential with the given parameters. More...
 
double weibull_cdf (double x, double scale, double shape, double location=0.0)
 Return the CDF of a max exponential with the given parameters. More...
 
real_t gamma_ln (real_t x)
 
real_t factorial_ln (int n)
 
real_t pow_ln (real_t m, int n)
 
real_t choose_ln (int n, int k)
 
real_t multinomial_choose_ln (int n, vector< int > k)
 
real_t poisson_prob_ln (int observed, real_t expected)
 
template<typename ProbIn >
real_t multinomial_sampling_prob_ln (const vector< ProbIn > &probs, const vector< int > &obs)
 
template<typename ProbIn >
real_t binomial_cmf_ln (ProbIn success_logprob, size_t trials, size_t successes)
 
template<typename ProbIn >
real_t geometric_sampling_prob_ln (ProbIn success_logprob, size_t trials)
 
template<typename Iter >
bool advance_split (Iter start, Iter end)
 
template<typename ProbIn >
real_t multinomial_censored_sampling_prob_ln (const vector< ProbIn > &probs, const unordered_map< vector< bool >, int > &obs)
 
real_t ewens_af_prob_ln (const vector< int > &a, real_t theta)
 
auto operator<< (ostream &out, const BitString &bs)
 Allow BitStrings to be printed for debugging. More...
 
bool is_match (const Translation &translation)
 
pos_t make_pos_t (id_t id, bool is_rev, off_t off)
 Create a pos_t from a Node ID, an orientation flag, and an offset along that strand of the node. More...
 
id_t id (const pos_t &pos)
 Extract the id of the node a pos_t is on. More...
 
bool is_rev (const pos_t &pos)
 Return true if a pos_t is on the reverse strand of its node. More...
 
off_t offset (const pos_t &pos)
 Get the offset along the selected strand of the node from a pos_t. More...
 
id_tget_id (pos_t &pos)
 Get a reference to the Node ID of a pos_t. More...
 
bool & get_is_rev (pos_t &pos)
 Get a reference to the reverse flag of a pos_t. More...
 
off_tget_offset (pos_t &pos)
 Get a reference to the offset field of a pos_t, which counts along the selected strand of the node. More...
 
bool is_empty (const pos_t &pos)
 Return true if a pos_t is unset. More...
 
pos_t reverse (const pos_t &pos, size_t node_length)
 
pos_t reverse_base_pos (const pos_t &pos, size_t node_length)
 Reverse a pos_t and get a pos_t at the same base, going the other direction. More...
 
std::ostream & operator<< (std::ostream &out, const pos_t &pos)
 Print a pos_t to a stream. More...
 
char reverse_complement (const char &c)
 
string reverse_complement (const string &seq)
 
void reverse_complement_in_place (string &seq)
 
bool is_all_n (const string &seq)
 
double get_fraction_of_ns (const string &seq)
 
int get_thread_count (void)
 
void choose_good_thread_count ()
 
std::vector< std::string > & split_delims (const std::string &s, const std::string &delims, std::vector< std::string > &elems)
 
std::vector< std::string > split_delims (const std::string &s, const std::string &delims)
 
const std::string sha1sum (const std::string &data)
 
const std::string sha1head (const std::string &data, size_t head)
 
string wrap_text (const string &str, size_t width)
 
bool is_number (const std::string &s)
 
bool isATGC (const char &b)
 Return true if a character is an uppercase A, C, G, or T, and false otherwise. More...
 
bool allATGC (const string &s)
 
bool allATGCN (const string &s)
 
string nonATGCNtoN (const string &s)
 
string allAmbiguousToN (const string &s)
 
string toUppercase (const string &s)
 
void write_fasta_sequence (const std::string &name, const std::string &sequence, ostream &os, size_t width)
 
string get_or_make_variant_id (const vcflib::Variant &variant)
 
string make_variant_id (const vcflib::Variant &variant)
 
vector< size_t > range_vector (size_t begin, size_t end)
 
bool have_input_file (int &optind, int argc, char **argv)
 Return true if there's a command line argument (i.e. input file name) waiting to be processed. More...
 
void get_input_file (int &optind, int argc, char **argv, function< void(istream &)> callback)
 
string get_input_file_name (int &optind, int argc, char **argv)
 
string get_output_file_name (int &optind, int argc, char **argv)
 
void get_input_file (const string &file_name, function< void(istream &)> callback)
 
pair< string, string > split_ext (const string &filename)
 Split off the extension from a filename and return both parts. More...
 
bool file_exists (const string &filename)
 
void create_ref_allele (vcflib::Variant &variant, const std::string &allele)
 
int add_alt_allele (vcflib::Variant &variant, const std::string &allele)
 
size_t integer_power (uint64_t base, uint64_t exponent)
 Computes base^exponent in log(exponent) time. More...
 
size_t modular_exponent (uint64_t base, uint64_t exponent, uint64_t modulus)
 
default_random_engine random_sequence_gen (102)
 
string random_sequence (size_t length)
 Returns a uniformly random DNA sequence of the given length. More...
 
string pseudo_random_sequence (size_t length, uint64_t seed)
 Returns a uniformly random DNA sequence sequence deterministically from a seed. More...
 
string replace_in_string (string subject, const string &search, const string &replace)
 
string percent_url_encode (const string &seq)
 Escape "%" to "%25". More...
 
unordered_map< id_t, pair< id_t, bool > > overlay_node_translations (const unordered_map< id_t, pair< id_t, bool >> &over, const unordered_map< id_t, pair< id_t, bool >> &under)
 Compose the translations from two graph operations, both of which involved oriented transformations. More...
 
unordered_map< id_t, pair< id_t, bool > > overlay_node_translations (const unordered_map< id_t, id_t > &over, const unordered_map< id_t, pair< id_t, bool >> &under)
 Compose the translations from two graph operations, the first of which involved oriented transformations. More...
 
unordered_map< id_t, pair< id_t, bool > > overlay_node_translations (const unordered_map< id_t, pair< id_t, bool >> &over, const unordered_map< id_t, id_t > &under)
 Compose the translations from two graph operations, the second of which involved oriented transformations. More...
 
unordered_map< id_t, id_toverlay_node_translations (const unordered_map< id_t, id_t > &over, const unordered_map< id_t, id_t > &under)
 Compose the translations from two graph operations, neither of which involved oriented transformations. More...
 
template<>
bool parse (const string &arg, double &dest)
 
template<>
bool parse (const string &arg, std::regex &dest)
 
bool is_number (const string &s)
 
template<typename T , typename V >
set< T > map_keys_to_set (const map< T, V > &m)
 
template<typename T >
vector< T > pmax (const std::vector< T > &a, const std::vector< T > &b)
 
template<typename T >
vector< T > vpmax (const std::vector< std::vector< T >> &vv)
 
template<typename Collection >
Collection::value_type sum (const Collection &collection)
 
template<template< class T, class A=std::allocator< T >> class Container, typename Input , typename Output >
Container< Output > map_over (const Container< Input > &in, const std::function< Output(const Input &)> &lambda)
 
template<template< class T, class A=std::allocator< T >> class Container, typename Item >
Container< const Item * > pointerfy (const Container< Item > &in)
 
vector< size_t > range_vector (size_t end)
 
size_t integer_power (size_t x, size_t power)
 
template<class RandomIt >
void deterministic_shuffle (RandomIt begin, RandomIt end, const uint32_t &seed)
 
template<class RandomIt >
void deterministic_shuffle (RandomIt begin, RandomIt end, const string &seed)
 
string make_shuffle_seed (const Alignment &aln)
 Make seeds for Alignments based on their sequences. More...
 
string make_shuffle_seed (const Alignment *aln)
 Make seeds for Alignments based on their sequences. More...
 
string make_shuffle_seed (const pair< Alignment, Alignment > *alns)
 Make seeds for pairs of Alignments based on their concatenated sequences. More...
 
template<class RandomIt >
void deterministic_shuffle (RandomIt begin, RandomIt end)
 Do a deterministic shuffle with automatic seed determination. More...
 
template<class RandomIt , class Compare , class MakeSeed >
void sort_shuffling_ties (RandomIt begin, RandomIt end, Compare comp, MakeSeed seed)
 
template<class RandomIt , class Compare >
void sort_shuffling_ties (RandomIt begin, RandomIt end, Compare comp)
 
template<typename Result >
Result parse (const string &arg)
 
template<typename Result >
Result parse (const char *arg)
 
template<typename Result >
bool parse (const string &arg, Result &dest)
 
template<typename Result >
bool parse (const string &arg, typename enable_if< sizeof(Result)<=sizeof(long long) &&is_integral< Result >::value &&is_signed< Result >::value, Result >::type &dest)
 
void genotype_svs (VG *graph, string gamfile, string refpath)
 
void variant_recall (VG *graph, vcflib::VariantCallFile *vars, FastaReference *ref_genome, vector< FastaReference * > insertions, string gamfile, bool isIndex)
 
tuple< double, double, double > hash_to_rgb (const string &str, double min_sum)
 
size_t wang_hash_64 (size_t key)
 
template<typename Result >
bool parse (const string &arg, typename enable_if< is_instantiation_of< Result, Range >::value, Result >::type &dest)
 Parse a range as start[:end[:step]]. More...
 

Variables

const char *const BAM_DNA_LOOKUP = "=ACMGRSVTWYHKDBN"
 
const char * var = "VG_FULL_TRACEBACK"
 
bool fullTrace = false
 
constexpr size_t PRUNE_THREAD_BUFFER_SIZE = 1024 * 1024
 

Typedef Documentation

◆ benchtime

using vg::benchtime = typedef chrono::nanoseconds

We define a duration type for expressing benchmark times in.

◆ Chain

using vg::Chain = typedef vector<pair<const Snarl*, bool> >

Snarls are defined at the Protobuf level, but here is how we define chains as real objects.

A chain is a sequence of Snarls, in either normal (false) or reverse (true) orientation.

The SnarlManager is going to have one official copy of each chain stored, and it will give you a pointer to it on demand.

◆ DeletableHandleGraph

◆ edge_t

◆ EdgeMapping

typedef std::map<id_t, std::vector<Edge*> > vg::EdgeMapping

◆ exon_nodes_t

typedef vector<gbwt::node_type> vg::exon_nodes_t

◆ GAMIndex

Define a GAM index as a stream index over a stream of Alignments.

◆ GAMSorter

◆ Handle2Component

typedef unordered_map<handle_t, int> vg::Handle2Component

◆ handle_t

◆ HandleGraph

◆ HandleSet

typedef unordered_set<handle_t> vg::HandleSet

◆ id_t

Represents a Node ID. ID type is a 64-bit signed int.

◆ MutableHandleGraph

◆ MutablePathDeletableHandleGraph

◆ MutablePathHandleGraph

◆ MutablePathMutableHandleGraph

◆ nid_t

using vg::nid_t = typedef handlegraph::nid_t

◆ off_t

typedef size_t vg::off_t

Represents an offset along the sequence of a Node. Offsets are size_t.

◆ pareto_point

typedef std::pair<uint32_t, int32_t> vg::pareto_point

◆ path_handle_t

◆ PathHandleGraph

◆ PathPositionHandleGraph

◆ pos_t

typedef std::tuple<id_t, bool, off_t> vg::pos_t

Represents an oriented position on a Node. Position type: id, direction, offset. Offset is counted as for as prorobuf Position, from the node's first base on the forward strand, and from its last base on the reverse strand.

◆ RankedHandleGraph

◆ real_t

using vg::real_t = typedef long double

◆ SerializableHandleGraph

◆ step_handle_t

◆ thread_ids_t

typedef vector<gbwt::size_type> vg::thread_ids_t

◆ thread_t

using vg::thread_t = typedef vector<gbwt::node_type>

◆ VectorizableHandleGraph

Enumeration Type Documentation

◆ MappingQualityMethod

Enumerator
Approx 
Exact 
Adaptive 
None 

◆ SnarlType

Enumeration of the classifications of snarls.

Enumerator
UNCLASSIFIED 
ULTRABUBBLE 
UNARY 

Function Documentation

◆ add_alt_allele()

int vg::add_alt_allele ( vcflib::Variant &  variant,
const std::string &  allele 
)

Add a new alt allele to a vcflib Variant, since apaprently there's no method for that already.

If that allele already exists in the variant, does not add it again.

Retuerns the allele number (0, 1, 2, etc.) corresponding to the given allele string in the given variant.

◆ add_log()

double vg::add_log ( double  log_x,
double  log_y 
)
inline

◆ add_log10()

double vg::add_log10 ( double  i,
double  j 
)
inline

Return the log of the sum of two log10-transformed values without taking them out of log space.

◆ add_nodes_and_edges() [1/2]

Path vg::add_nodes_and_edges ( MutableHandleGraph graph,
const Path path,
const map< pos_t, id_t > &  node_translation,
unordered_map< pair< pos_t, string >, vector< id_t >> &  added_seqs,
unordered_map< id_t, Path > &  added_nodes,
const unordered_map< id_t, size_t > &  orig_node_sizes,
set< NodeSide > &  dangling,
size_t  max_node_size = 1024 
)

Given a path on nodes that may or may not exist, and a map from start position in the old graph to a node in the current graph, add all the new sequence and edges required by the path. The given path must not contain adjacent perfect match edits in the same mapping, or any deletions on the start or end of mappings (the removal of which can be accomplished with the Path::simplify() function).

Outputs (and caches for subsequent calls) novel node runs in added_seqs, and Paths describing where novel nodes translate back to in the original graph in added_nodes. Also needs a map of the original sizes of nodes deleted from the original graph, for reverse complementing. If dangling is nonempty, left edges of nodes created for initial inserts will connect to the specified sides. At the end, dangling is populated with the side corresponding to the last edit in the path.

Returns a fully embedded version of the path, after all node insertions, divisions, and translations.

◆ add_nodes_and_edges() [2/2]

Path vg::add_nodes_and_edges ( MutableHandleGraph graph,
const Path path,
const map< pos_t, id_t > &  node_translation,
unordered_map< pair< pos_t, string >, vector< id_t >> &  added_seqs,
unordered_map< id_t, Path > &  added_nodes,
const unordered_map< id_t, size_t > &  orig_node_sizes,
size_t  max_node_size 
)

This version doesn't require a set of dangling sides to populate

◆ add_path_to_graph()

path_handle_t vg::add_path_to_graph ( MutablePathHandleGraph graph,
const Path path 
)

Add a path to the graph. This is like VG::extend, and expects a path with no edits, and for all the nodes and edges in the path to exist exactly in the graph

◆ add_thread_edges_to_set()

void vg::add_thread_edges_to_set ( thread_t t,
set< pair< int, int > > &  edges 
)

◆ add_thread_nodes_to_set()

void vg::add_thread_nodes_to_set ( thread_t t,
set< int64_t > &  nodes 
)

◆ addArbitraryTelomerePair()

void vg::addArbitraryTelomerePair ( vector< stCactusEdgeEnd * >  ends,
stList *  telomeres 
)

Finds an arbitrary pair of telomeres in a Cactus graph, which are are either a pair of bridge edge ends or a pair of chain edge ends, oriented such that they form a pair of boundaries.

Mostly copied from the pinchesAndCacti unit tests.

◆ adjacent_mappings()

bool vg::adjacent_mappings ( const Mapping m1,
const Mapping m2 
)

◆ advance_split()

template<typename Iter >
bool vg::advance_split ( Iter  start,
Iter  end 
)

Given a split of items across a certain number of categories, as ints between the two given bidirectional iterators, advance to the next split and return true. If there is no next split, leave the collection unchanged and return false.

◆ aligned_interval()

pair< int64_t, int64_t > vg::aligned_interval ( const multipath_alignment_t multipath_aln)

The indexes on the read sequence of the portion of the read that is aligned outside of soft clips.

◆ alignment_end()

Position vg::alignment_end ( const Alignment aln)

◆ alignment_ends()

vector< Alignment > vg::alignment_ends ( const Alignment aln,
size_t  len1,
size_t  len2 
)

◆ alignment_from_length()

int vg::alignment_from_length ( const Alignment a)

◆ alignment_from_path()

Alignment vg::alignment_from_path ( const HandleGraph graph,
const Path path 
)

◆ alignment_is_valid()

bool vg::alignment_is_valid ( Alignment aln,
const HandleGraph hgraph 
)

check to make sure edits on the alignment's path don't assume incorrect node lengths or ids

◆ alignment_middle()

Alignment vg::alignment_middle ( const Alignment aln,
int  len 
)

◆ alignment_quality_per_node()

map< id_t, int > vg::alignment_quality_per_node ( const Alignment aln)

◆ alignment_refpos_to_path_offsets()

map< string,vector< pair< size_t, bool > > > vg::alignment_refpos_to_path_offsets ( const Alignment aln)

return the path offsets as cached in the alignment

◆ alignment_set_distance_to_correct() [1/2]

void vg::alignment_set_distance_to_correct ( Alignment aln,
const Alignment base 
)

annotate the first alignment with its minimum distance to the second in their annotated paths

◆ alignment_set_distance_to_correct() [2/2]

void vg::alignment_set_distance_to_correct ( Alignment aln,
const map< string, vector< pair< size_t, bool > > > &  base_offsets 
)

◆ alignment_start()

Position vg::alignment_start ( const Alignment aln)

◆ alignment_to_bam() [1/2]

bam1_t * vg::alignment_to_bam ( bam_hdr_t *  bam_header,
const Alignment alignment,
const string &  refseq,
const int32_t  refpos,
const bool  refrev,
const vector< pair< int, char >> &  cigar 
)

Convert an unpaired Alignment to a BAM record. If the alignment is unmapped, refpos must be -1. Otherwise, refpos must be the position on the reference sequence to which the alignment is aligned. Similarly, refseq must be the sequence aligned to, or "" if unaligned.

Remember to clean up with bam_destroy1(b);

◆ alignment_to_bam() [2/2]

bam1_t * vg::alignment_to_bam ( bam_hdr_t *  bam_header,
const Alignment alignment,
const string &  refseq,
const int32_t  refpos,
const bool  refrev,
const vector< pair< int, char >> &  cigar,
const string &  mateseq,
const int32_t  matepos,
bool  materev,
const int32_t  tlen,
const int32_t  tlen_max = 0 
)

Convert a paired Alignment to a BAM record. If the alignment is unmapped, refpos must be -1. Otherwise, refpos must be the position on the reference sequence to which the alignment is aligned. Similarly, refseq must be the sequence aligned to, or "" if unaligned. The mateseq and matepos fields must be set similarly for the mate. Note that mateseq must not be "=". If tlen_max is given, it is a limit on the magnitude of tlen to consider the read properly paired.

Remember to clean up with bam_destroy1(b);

◆ alignment_to_bam_internal()

bam1_t* vg::alignment_to_bam_internal ( bam_hdr_t *  header,
const Alignment alignment,
const string &  refseq,
const int32_t  refpos,
const bool  refrev,
const vector< pair< int, char >> &  cigar,
const string &  mateseq,
const int32_t  matepos,
bool  materev,
const int32_t  tlen,
bool  paired,
const int32_t  tlen_max 
)

◆ alignment_to_length()

int vg::alignment_to_length ( const Alignment a)

◆ alignment_to_sam() [1/2]

string vg::alignment_to_sam ( const Alignment alignment,
const string &  refseq,
const int32_t  refpos,
const bool  refrev,
const vector< pair< int, char >> &  cigar 
)

Convert an unpaired Alignment to a SAM record. If the alignment is unmapped, refpos must be -1. Otherwise, refpos must be the position on the reference sequence to which the alignment is aligned. Similarly, refseq must be the sequence aligned to, or "" if unaligned.

◆ alignment_to_sam() [2/2]

string vg::alignment_to_sam ( const Alignment alignment,
const string &  refseq,
const int32_t  refpos,
const bool  refrev,
const vector< pair< int, char >> &  cigar,
const string &  mateseq,
const int32_t  matepos,
bool  materev,
const int32_t  tlen,
const int32_t  tlen_max = 0 
)

Convert a paired Alignment to a SAM record. If the alignment is unmapped, refpos must be -1. Otherwise, refpos must be the position on the reference sequence to which the alignment is aligned. Similarly, refseq must be the sequence aligned to, or "" if unaligned. The mateseq and matepos fields must be set similarly for the mate. Note that mateseq must not be "=". If tlen_max is given, it is a limit on the magnitude of tlen to consider the read properly paired.

◆ alignment_to_sam_internal()

string vg::alignment_to_sam_internal ( const Alignment alignment,
const string &  refseq,
const int32_t  refpos,
const bool  refrev,
const vector< pair< int, char >> &  cigar,
const string &  mateseq,
const int32_t  matepos,
bool  materev,
const int32_t  tlen,
bool  paired,
const int32_t  tlen_max 
)

◆ allAmbiguousToN()

string vg::allAmbiguousToN ( const string &  s)

Convert known IUPAC ambiguity codes (which we don't support) to N (which we do), while leaving any other garbage to trigger validation checks later.

◆ allATGC()

bool vg::allATGC ( const string &  s)

◆ allATGCN()

bool vg::allATGCN ( const string &  s)

◆ allele_to_string()

string vg::allele_to_string ( VG graph,
const Path allele 
)

Turn the given path into an allele. Drops the first and last mappings and looks up the sequences for the nodes of the others.

◆ append_cigar_operation()

void vg::append_cigar_operation ( const int  length,
const char  operation,
vector< pair< int, char >> &  cigar 
)
inline

◆ append_multipath_alignment()

void vg::append_multipath_alignment ( multipath_alignment_t multipath_aln,
const multipath_alignment_t to_append 
)

Add the subpaths of one multipath alignment onto another.

◆ append_path()

Path & vg::append_path ( Path a,
const Path b 
)

◆ augment() [1/2]

void vg::augment ( MutablePathMutableHandleGraph graph,
const string &  gam_path,
const string &  aln_format = "GAM",
vector< Translation > *  out_translation = nullptr,
const string &  gam_out_path = "",
bool  embed_paths = false,
bool  break_at_ends = false,
bool  remove_soft_clips = false,
bool  filter_out_of_graph_alignments = false,
double  min_baseq = 0,
double  min_mapq = 0,
Packer packer = nullptr,
size_t  min_bp_coverage = 0,
double  max_frac_n = 1. 
)

Edit the graph to include all the sequence and edges added by the given paths. Can handle paths that visit nodes in any orientation. Note that this method sorts the graph and rebuilds the path index, so it should not be called in a loop.

if gam_path is "-", then stdin used if gam_out_path is "-", then stdout used If gam_out_path is not empty, the paths will be modified to reflect their embedding in the modified graph and written to the path. aln_format used to toggle between GAM and GAF If out_translation is not null, a list of translations, one per node existing after the edit, describing how each new or conserved node is embedded in the old graph. if embed_paths is true, then the augmented alignemnents will be saved as embededed paths in the graph in order to add it back to the graph. If break_at_ends is true, nodes will be broken at the ends of paths that start/end woth perfect matches, so the paths can be added to the vg graph's paths object. If soft_clip is true, soft clips will be removed from the input paths before processing, and the dangling ends won't end up in the graph If filter_out_of_graph_alignments is true, some extra time will be taken to check if all nodes in the alignment are in the graph. If they aren't, then it will be ignored If an edit sequence's avg base quality is less than min_baseq it will be ignored (considered a match) If an alignment's mapping quality is less than min_mapq it is ignored A packer is required for all non-mapq filters If a breakpoint has less than min_bp_coverage it is not included in the graph Edits with more than max_frac_n N content will be ignored

◆ augment() [2/2]

void vg::augment ( MutablePathMutableHandleGraph graph,
vector< Path > &  path_vector,
const string &  aln_format = "GAM",
vector< Translation > *  out_translation = nullptr,
const string &  gam_out_path = "",
bool  embed_paths = false,
bool  break_at_ends = false,
bool  remove_soft_clips = false,
bool  filter_out_of_graph_alignments = false,
double  min_baseq = 0,
double  min_mapq = 0,
Packer packer = nullptr,
size_t  min_bp_coverage = 0,
double  max_frac_n = 1. 
)

Like above, but operates on a vector of Alignments, instead of a file (Note: It is best to use file interface to stream large numbers of alignments to save memory)

◆ augment_impl()

void vg::augment_impl ( MutablePathMutableHandleGraph graph,
function< void(function< void(Alignment &)>, bool, bool)>  iterate_gam,
const string &  aln_format,
vector< Translation > *  out_translations,
const string &  gam_out_path,
bool  embed_paths,
bool  break_at_ends,
bool  remove_softclips,
bool  filter_out_of_graph_alignments,
double  min_baseq,
double  min_mapq,
Packer packer,
size_t  min_bp_coverage,
double  max_frac_n 
)

Generic version used to implement the above three methods.

◆ balanced_kmers()

const vector< string > vg::balanced_kmers ( const string &  seq,
const int  kmer_size,
const int  stride 
)

◆ balanced_stride()

const int vg::balanced_stride ( int  read_length,
int  kmer_size,
int  stride 
)

◆ bam_to_alignment() [1/2]

Alignment vg::bam_to_alignment ( const bam1_t *  b,
map< string, string > &  rg_sample 
)

◆ bam_to_alignment() [2/2]

Alignment vg::bam_to_alignment ( const bam1_t *  b,
map< string, string > &  rg_sample,
const bam_hdr_t *  bh,
const PathPositionHandleGraph graph 
)

◆ benchmark_control()

void vg::benchmark_control ( )

The benchmark control function, designed to take some amount of time that might vary with CPU load.

◆ binomial_cmf_ln()

template<typename ProbIn >
real_t vg::binomial_cmf_ln ( ProbIn  success_logprob,
size_t  trials,
size_t  successes 
)

Compute the probability of having the given number of successes or fewer in the given number of trials, with the given success probability. Returns the resulting log probability.

◆ build_gcsa_lcp()

void vg::build_gcsa_lcp ( const HandleGraph graph,
gcsa::GCSA *&  gcsa,
gcsa::LCPArray *&  lcp,
int  kmer_size,
size_t  doubling_steps,
size_t  size_limit,
const string &  base_file_name 
)

◆ cactus_to_vg()

VG vg::cactus_to_vg ( stCactusGraph *  cactus_graph)

◆ cactusify()

VG vg::cactusify ( VG graph)

◆ canonical_orientation()

PhaseUnfolder::path_type vg::canonical_orientation ( const PhaseUnfolder::path_type path,
bool &  from_border,
bool &  to_border 
)

◆ chain_begin()

ChainIterator vg::chain_begin ( const Chain chain)

We define free functions for getting iterators forward and backward through chains.

◆ chain_begin_from()

ChainIterator vg::chain_begin_from ( const Chain chain,
const Snarl start_snarl,
bool  snarl_orientation 
)

We also define a function for getting the ChainIterator (forward or reverse complement) for a chain starting with a given snarl in the given inward orientation. Only works for bounding snarls of the chain.

◆ chain_end()

ChainIterator vg::chain_end ( const Chain chain)

◆ chain_end_from()

ChainIterator vg::chain_end_from ( const Chain chain,
const Snarl start_snarl,
bool  snarl_orientation 
)

And the end iterator for the chain (forward or reverse complement) viewed from a given snarl in the given inward orientation. Only works for bounding snarls of the chain, and should be the same bounding snarl as was used for chain_begin_from.

◆ chain_rbegin()

ChainIterator vg::chain_rbegin ( const Chain chain)

◆ chain_rcbegin()

ChainIterator vg::chain_rcbegin ( const Chain chain)

We also define some reverse complement iterators, which go from right to left through the chains, but give us the reverse view. For ecample, if all the snarls are oriented forward in the chain, we will iterate through the snarls in reverse order, with each individual snarl also reversed.

◆ chain_rcend()

ChainIterator vg::chain_rcend ( const Chain chain)

◆ chain_rend()

ChainIterator vg::chain_rend ( const Chain chain)

◆ choose_good_thread_count()

void vg::choose_good_thread_count ( )

Decide on and apply a sensible OMP thread count. Pay attention to OMP_NUM_THREADS if set, the "hardware concurrency", and container limit information that may be available in /proc.

◆ choose_ln()

real_t vg::choose_ln ( int  n,
int  k 
)
inline

Compute the number of ways to select k items from a collection of n distinguishable items, ignoring order. Returns the natural log of the (integer) result.

◆ cigar_against_path()

vector< pair< int, char > > vg::cigar_against_path ( const Alignment alignment,
bool  on_reverse_strand,
int64_t &  pos,
size_t  path_len,
size_t  softclip_suppress 
)

Create a CIGAR from the given Alignment. If softclip_suppress is nonzero, suppress softclips up to that length. This will necessitate adjusting pos, which is why it is passed by reference.

◆ cigar_mapping() [1/2]

void vg::cigar_mapping ( const bam1_t *  b,
Mapping mapping 
)

◆ cigar_mapping() [2/2]

int64_t vg::cigar_mapping ( const bam1_t *  b,
Mapping mapping 
)

◆ cigar_string()

string vg::cigar_string ( const vector< pair< int, char > > &  cigar)

◆ clear_annotation() [1/2]

template<typename Annotated >
void vg::clear_annotation ( Annotated &  annotated,
const string &  name 
)
inline

Clear the annotation with the given name.

◆ clear_annotation() [2/2]

template<typename Annotated >
void vg::clear_annotation ( Annotated *  annotated,
const string &  name 
)
inline

Clear the annotation with the given name.

◆ cluster_cover()

vector< string::const_iterator > vg::cluster_cover ( const vector< MaximalExactMatch > &  cluster)

◆ cluster_coverage()

int vg::cluster_coverage ( const vector< MaximalExactMatch > &  cluster)

◆ cluster_nodes()

vector< pos_t > vg::cluster_nodes ( const vector< MaximalExactMatch > &  cluster)

◆ cluster_subgraph_containing()

bdsg::HashGraph vg::cluster_subgraph_containing ( const HandleGraph base,
const Alignment aln,
const vector< vg::MaximalExactMatch > &  cluster,
const GSSWAligner aligner 
)

return a containing subgraph connecting the mems

◆ cluster_subgraph_walk()

bdsg::HashGraph vg::cluster_subgraph_walk ( const HandleGraph base,
const Alignment aln,
const vector< vg::MaximalExactMatch > &  mems,
double  expansion 
)

return a subgraph for a cluster of MEMs from the given alignment use walking to get the hits

◆ clusters_overlap_in_graph()

bool vg::clusters_overlap_in_graph ( const vector< MaximalExactMatch > &  cluster1,
const vector< MaximalExactMatch > &  cluster2 
)

◆ clusters_overlap_in_read()

bool vg::clusters_overlap_in_read ( const vector< MaximalExactMatch > &  cluster1,
const vector< MaximalExactMatch > &  cluster2 
)

◆ clusters_overlap_length()

int vg::clusters_overlap_length ( const vector< MaximalExactMatch > &  cluster1,
const vector< MaximalExactMatch > &  cluster2 
)

◆ compute_template_lengths()

pair< int32_t, int32_t > vg::compute_template_lengths ( const int64_t &  pos1,
const vector< pair< int, char >> &  cigar1,
const int64_t &  pos2,
const vector< pair< int, char >> &  cigar2 
)

Work out the TLEN values for two reads. The magnitude is the distance between the outermost aligned bases, and the sign is positive for the leftmost read and negative for the rightmost.

◆ concat_mappings()

Mapping vg::concat_mappings ( const Mapping m,
const Mapping n,
bool  trim_internal_deletions 
)

◆ concat_paths()

Path vg::concat_paths ( const Path path1,
const Path path2 
)

◆ connected_components()

vector< vector< int64_t > > vg::connected_components ( const multipath_alignment_t multipath_aln)

Returns a vector whose elements are vectors with the indexes of the Subpaths in each connected component. An unmapped multipath_alignment_t with no subpaths produces an empty vector.

◆ construct_graph_from_nodes_and_edges()

void vg::construct_graph_from_nodes_and_edges ( Graph g,
const HandleGraph source,
set< int64_t > &  nodes,
set< pair< int, int > > &  edges 
)

◆ convert() [1/2]

template<typename T >
bool vg::convert ( const std::string &  s,
T &  r 
)

◆ convert() [2/2]

template<typename T >
std::string vg::convert ( const T &  r)

◆ convert_alignment_char()

void vg::convert_alignment_char ( Alignment alignment,
char  from,
char  to 
)

◆ convert_multipath_alignment_char()

void vg::convert_multipath_alignment_char ( multipath_alignment_t multipath_aln,
char  from,
char  to 
)

◆ convert_Ts_to_Us() [1/2]

void vg::convert_Ts_to_Us ( Alignment alignment)

Replaces any T's in the sequence or the Path with U's.

◆ convert_Ts_to_Us() [2/2]

void vg::convert_Ts_to_Us ( multipath_alignment_t multipath_aln)

Replaces all T's in the sequence and the aligned Paths with U's.

◆ convert_Us_to_Ts() [1/2]

void vg::convert_Us_to_Ts ( Alignment alignment)

Replaces any U's in the sequence or the Path with T's.

◆ convert_Us_to_Ts() [2/2]

void vg::convert_Us_to_Ts ( multipath_alignment_t multipath_aln)

Replaces all U's in the sequence and the aligned Paths with T's.

◆ create_ref_allele()

void vg::create_ref_allele ( vcflib::Variant &  variant,
const std::string &  allele 
)

Create the reference allele for an empty vcflib Variant, since apaprently there's no method for that already. Must be called before any alt alleles are added.

◆ cut_mapping() [1/4]

pair< Mapping, Mapping > vg::cut_mapping ( const Mapping m,
const Position pos 
)

◆ cut_mapping() [2/4]

pair< Mapping, Mapping > vg::cut_mapping ( const Mapping m,
size_t  offset 
)

◆ cut_mapping() [3/4]

pair< mapping_t, mapping_t > vg::cut_mapping ( const mapping_t m,
const Position pos 
)

◆ cut_mapping() [4/4]

pair< mapping_t, mapping_t > vg::cut_mapping ( const mapping_t m,
size_t  offset 
)

◆ cut_mapping_offset() [1/2]

pair< Mapping, Mapping > vg::cut_mapping_offset ( const Mapping m,
size_t  offset 
)

◆ cut_mapping_offset() [2/2]

pair< mapping_t, mapping_t > vg::cut_mapping_offset ( const mapping_t m,
size_t  offset 
)

◆ cut_path() [1/2]

pair< Path, Path > vg::cut_path ( const Path path,
const Position pos 
)

◆ cut_path() [2/2]

pair< Path, Path > vg::cut_path ( const Path path,
size_t  offset 
)

◆ debug_string() [1/7]

string vg::debug_string ( const connection_t connection)

◆ debug_string() [2/7]

string vg::debug_string ( const edit_t edit)

◆ debug_string() [3/7]

string vg::debug_string ( const multipath_alignment_t multipath_aln)

◆ debug_string() [4/7]

string vg::debug_string ( const path_mapping_t mapping)

◆ debug_string() [5/7]

string vg::debug_string ( const path_t path)

◆ debug_string() [6/7]

string vg::debug_string ( const position_t pos)

◆ debug_string() [7/7]

string vg::debug_string ( const subpath_t subpath)

◆ decompose()

void vg::decompose ( const Path path,
map< pos_t, int > &  ref_positions,
map< pos_t, Edit > &  edits 
)

◆ determine_flag()

int32_t vg::determine_flag ( const Alignment alignment,
const string &  refseq,
const int32_t  refpos,
const bool  refrev,
const string &  mateseq,
const int32_t  matepos,
bool  materev,
const int32_t  tlen,
bool  paired,
const int32_t  tlen_max 
)

Returns the SAM bit-coded flag for alignment with.

◆ deterministic_shuffle() [1/3]

template<class RandomIt >
void vg::deterministic_shuffle ( RandomIt  begin,
RandomIt  end 
)

Do a deterministic shuffle with automatic seed determination.

◆ deterministic_shuffle() [2/3]

template<class RandomIt >
void vg::deterministic_shuffle ( RandomIt  begin,
RandomIt  end,
const string &  seed 
)

Given a pair of random access iterators defining a range, deterministically shuffle the contents of the range based on the given string seed.

◆ deterministic_shuffle() [3/3]

template<class RandomIt >
void vg::deterministic_shuffle ( RandomIt  begin,
RandomIt  end,
const uint32_t &  seed 
)

Given a pair of random access iterators defining a range, deterministically shuffle the contents of the range based on the given integer seed.

◆ divergence()

double vg::divergence ( const Mapping m)

◆ edit_count()

int vg::edit_count ( const Alignment alignment)

◆ emit_stacktrace()

void vg::emit_stacktrace ( int  signalNumber,
siginfo_t *  signalInfo,
void *  signalContext 
)

Emit a stack trace when something bad happens. Add as a signal handler with sigaction.

◆ enable_crash_handling()

void vg::enable_crash_handling ( )

Main should call this to turn on our stack tracing support.

◆ encode_chars()

gcsa::byte_type vg::encode_chars ( const vector< char > &  chars,
const gcsa::Alphabet &  alpha 
)

Encode the chars into the gcsa2 byte.

◆ end_backward()

bool vg::end_backward ( const Chain chain)

Return true if the last snarl in the given chain is backward relative to the chain.

◆ ensure_breakpoints()

map< pos_t, id_t > vg::ensure_breakpoints ( MutableHandleGraph graph,
const unordered_map< id_t, set< pos_t >> &  breakpoints 
)

Take a map from node ID to a set of offsets at which new nodes should start (which may include 0 and 1-past-the-end, which should be ignored), break the specified nodes at those positions. Returns a map from old node start position to new node pointer in the graph. Note that the caller will have to crear and rebuild path rank data.

Returns a map from old node start position to new node. This map contains some entries pointing to null, for positions past the ends of original nodes. It also maps from positions on either strand of the old node to the same new node pointer; the new node's forward strand is always the same as the old node's forward strand.

◆ entropy() [1/2]

double vg::entropy ( const char *  st,
size_t  len 
)

◆ entropy() [2/2]

double vg::entropy ( const string &  st)

◆ ewens_af_prob_ln()

real_t vg::ewens_af_prob_ln ( const vector< int > &  a,
real_t  theta 
)
inline

◆ extend_alignment()

Alignment & vg::extend_alignment ( Alignment a1,
const Alignment a2,
bool  debug 
)

◆ extend_path()

Path & vg::extend_path ( Path path1,
const Path path2 
)

◆ extract_as_gbwt_path()

gbwt::vector_type vg::extract_as_gbwt_path ( const PathHandleGraph graph,
const std::string &  path_name 
)

Extract a path as a GBWT path.

◆ extract_gbwt_path()

Path vg::extract_gbwt_path ( const HandleGraph graph,
const gbwt::GBWT &  gbwt_index,
gbwt::size_type  id 
)

Extract a GBWT thread as a path in the given graph. NOTE: id is a gbwt path id, not a gbwt sequence id.

◆ extract_sub_multipath_alignment()

void vg::extract_sub_multipath_alignment ( const multipath_alignment_t multipath_aln,
const vector< int64_t > &  subpath_indexes,
multipath_alignment_t sub_multipath_aln 
)

Extract the multipath_alignment_t consisting of the Subpaths with the given indexes into a new multipath_alignment_t object

◆ factorial_ln()

real_t vg::factorial_ln ( int  n)
inline

Calculate the natural log of the factorial of the given integer. TODO: replace with a cache or giant lookup table from Freebayes.

◆ fastq_for_each()

int vg::fastq_for_each ( string &  filename,
function< void(Alignment &)>  lambda 
)

◆ fastq_paired_interleaved_for_each()

size_t vg::fastq_paired_interleaved_for_each ( const string &  filename,
function< void(Alignment &, Alignment &)>  lambda 
)

◆ fastq_paired_interleaved_for_each_parallel()

size_t vg::fastq_paired_interleaved_for_each_parallel ( const string &  filename,
function< void(Alignment &, Alignment &)>  lambda 
)

◆ fastq_paired_interleaved_for_each_parallel_after_wait()

size_t vg::fastq_paired_interleaved_for_each_parallel_after_wait ( const string &  filename,
function< void(Alignment &, Alignment &)>  lambda,
function< bool(void)>  single_threaded_until_true 
)

◆ fastq_paired_two_files_for_each()

size_t vg::fastq_paired_two_files_for_each ( const string &  file1,
const string &  file2,
function< void(Alignment &, Alignment &)>  lambda 
)

◆ fastq_paired_two_files_for_each_parallel()

size_t vg::fastq_paired_two_files_for_each_parallel ( const string &  file1,
const string &  file2,
function< void(Alignment &, Alignment &)>  lambda 
)

◆ fastq_paired_two_files_for_each_parallel_after_wait()

size_t vg::fastq_paired_two_files_for_each_parallel_after_wait ( const string &  file1,
const string &  file2,
function< void(Alignment &, Alignment &)>  lambda,
function< bool(void)>  single_threaded_until_true 
)

◆ fastq_unpaired_for_each()

size_t vg::fastq_unpaired_for_each ( const string &  filename,
function< void(Alignment &)>  lambda 
)

◆ fastq_unpaired_for_each_parallel()

size_t vg::fastq_unpaired_for_each_parallel ( const string &  filename,
function< void(Alignment &)>  lambda 
)

◆ file_exists()

bool vg::file_exists ( const string &  filename)

Determine if a file exists. Only works for files readable by the current user.

◆ filter_breakpoints_by_coverage()

unordered_map< id_t, set< pos_t > > vg::filter_breakpoints_by_coverage ( const Packer packed_breakpoints,
size_t  min_bp_coverage 
)

Filters the breakpoints by coverage, and converts them back from the Packer to the STL map expected by following methods

◆ final_position() [1/2]

pos_t vg::final_position ( const Path path)

◆ final_position() [2/2]

pos_t vg::final_position ( const path_t path)

◆ find_breakpoints()

void vg::find_breakpoints ( const Path path,
unordered_map< id_t, set< pos_t >> &  breakpoints,
bool  break_ends = true,
const string &  base_quals = "",
double  min_baseq = 0,
double  max_frac_n = 1. 
)

Find all the points at which a Path enters or leaves nodes in the graph. Adds them to the given map by node ID of sets of bases in the node that will need to become the starts of new nodes.

If break_ends is true, emits breakpoints at the ends of the path, even if it starts/ends with perfect matches. Find all the points at which a Path enters or leaves nodes in the graph. Adds them to the given map by node ID of sets of bases in the node that will need to become the starts of new nodes.

If break_ends is true, emits breakpoints at the ends of the path, even if it starts/ends with perfect matches.

◆ find_edges_to_prune()

pair_hash_set< edge_t > vg::find_edges_to_prune ( const HandleGraph graph,
size_t  k,
size_t  edge_max 
)

Iterate over all the walks up to length k, adding edges which.

◆ find_mismatches()

void vg::find_mismatches ( const std::string &  seq,
const gbwtgraph::CachedGBWTGraph &  graph,
std::vector< GaplessExtension > &  result 
)

◆ find_packed_breakpoints()

void vg::find_packed_breakpoints ( const Path path,
Packer packed_breakpoints,
bool  break_ends,
const string &  base_quals,
double  min_baseq,
double  max_frac_n 
)

Like "find_breakpoints", but store in packed structure (better for large gams and enables coverage filter)

◆ find_pareto_frontier()

void vg::find_pareto_frontier ( std::vector< pareto_point > &  v)

◆ finish_gbwt_constuction()

void vg::finish_gbwt_constuction ( gbwt::GBWTBuilder &  builder,
const std::vector< std::string > &  sample_names,
const std::vector< std::string > &  contig_names,
size_t  haplotype_count,
bool  print_metadata 
)

Finish GBWT construction and optionally print the metadata.

◆ first_path_position()

Position vg::first_path_position ( const Path path)

◆ fit_fixed_rate_max_exponential()

double vg::fit_fixed_rate_max_exponential ( const vector< double > &  x,
double  rate,
double  tolerance 
)

Returns the MLE estimate for the number of iid exponential RVs the data are maxima of.

◆ fit_fixed_shape_max_exponential()

double vg::fit_fixed_shape_max_exponential ( const vector< double > &  x,
double  shape,
double  tolerance 
)

Returns the MLE rate parameter for the distribution of (shape) iid exponential RVs.

◆ fit_max_exponential()

pair< double, double > vg::fit_max_exponential ( const vector< double > &  x,
double  tolerance 
)

Returns the MLE rate and shape parameters of a max exponential.

◆ fit_offset_weibull()

tuple< double, double, double > vg::fit_offset_weibull ( const vector< double > &  x,
double  tolerance 
)

Returns an estimate of the rate, shape, and location (minimum value) of a 3-parameter Weibull distribution.

◆ fit_weibull()

pair< double, double > vg::fit_weibull ( const vector< double > &  x)

Returns an estimate of the rate and shape parameters of a Weibull distribution.

◆ fit_zipf()

double vg::fit_zipf ( const vector< double > &  y)

◆ flank_penalty()

int32_t vg::flank_penalty ( size_t  length,
const std::vector< pareto_point > &  frontier,
const Aligner aligner 
)

◆ flip()

Support vg::flip ( const Support to_flip)

Flip the orientations of a Support.

◆ flip_doubly_reversed_edges()

void vg::flip_doubly_reversed_edges ( Graph graph)

clean up doubly-reversed edges

◆ flip_nodes()

void vg::flip_nodes ( Alignment a,
const set< int64_t > &  ids,
const std::function< size_t(int64_t)> &  node_length 
)

◆ for_each_basic_annotation()

template<typename Annotated >
void vg::for_each_basic_annotation ( const Annotated &  annotated,
const function< void(const string &)>  null_lambda,
const function< void(const string &, double)>  double_lambda,
const function< void(const string &, bool)>  bool_lambda,
const function< void(const string &, const string &)>  string_lambda 
)

Apply a lambda to all annotations, except for Struct and ListValue annotations (which cannot be easily typed without exposing ugly Protobuf internals

◆ for_each_kmer()

void vg::for_each_kmer ( const HandleGraph graph,
size_t  k,
const function< void(const kmer_t &)> &  lambda,
id_t  head_id,
id_t  tail_id 
)

Iterate over all the kmers in the graph, running lambda on each.

◆ forwardize_breakpoints()

unordered_map< id_t, set< pos_t > > vg::forwardize_breakpoints ( const HandleGraph graph,
const unordered_map< id_t, set< pos_t >> &  breakpoints 
)

Flips the breakpoints onto the forward strand.

◆ from_handle_graph()

void vg::from_handle_graph ( const HandleGraph from,
Graph to 
)

◆ from_hit()

multipath_alignment_t vg::from_hit ( const Alignment alignment,
const HandleGraph graph,
const pos_t hit_pos,
const MaximalExactMatch mem,
const GSSWAligner scorer 
)

◆ from_length()

int vg::from_length ( const Mapping m)

◆ from_length_after_pos()

size_t vg::from_length_after_pos ( const Alignment aln,
const Position pos 
)

◆ from_length_before_pos()

size_t vg::from_length_before_pos ( const Alignment aln,
const Position pos 
)

◆ from_path_handle_graph()

void vg::from_path_handle_graph ( const PathHandleGraph from,
Graph to 
)

◆ from_proto_edit()

void vg::from_proto_edit ( const Edit proto_edit,
edit_t edit 
)

◆ from_proto_mapping()

void vg::from_proto_mapping ( const Mapping proto_mapping,
path_mapping_t mapping 
)

◆ from_proto_multipath_alignment()

void vg::from_proto_multipath_alignment ( const MultipathAlignment proto_multipath_aln,
multipath_alignment_t multipath_aln_out 
)

Convert a protobuf MultipathAlignment to an STL-based multipath_alignment_t.

◆ from_proto_path()

void vg::from_proto_path ( const Path proto_path,
path_t path 
)

◆ fuse_spliced_alignments()

multipath_alignment_t && vg::fuse_spliced_alignments ( const Alignment alignment,
multipath_alignment_t &&  left_mp_aln,
multipath_alignment_t &&  right_mp_aln,
int64_t  left_bridge_point,
const Alignment splice_segment,
int64_t  splice_junction_idx,
int32_t  splice_score,
const GSSWAligner scorer,
const HandleGraph graph 
)

◆ gamma_ln()

real_t vg::gamma_ln ( real_t  x)
inline

Calculate the natural log of the gamma function of the given argument.

◆ gap_penalty() [1/2]

int32_t vg::gap_penalty ( size_t  length,
const Aligner aligner 
)

◆ gap_penalty() [2/2]

int32_t vg::gap_penalty ( size_t  start,
size_t  limit,
const Aligner aligner 
)

◆ gbwt_node_width()

gbwt::size_type vg::gbwt_node_width ( const HandleGraph graph)

Determine the node width in bits for the GBWT nodes based on the given graph.

◆ gbwt_to_handle()

handle_t vg::gbwt_to_handle ( const HandleGraph graph,
gbwt::node_type  node 
)
inline

Convert gbwt::node_type to handle_t.

◆ gbwt_to_pos()

pos_t vg::gbwt_to_pos ( gbwt::node_type  node,
size_t  offset 
)
inline

Convert gbwt::node_type and an offset as size_t to pos_t.

◆ gcsa_nodes_to_positions()

set< pos_t > vg::gcsa_nodes_to_positions ( const vector< gcsa::node_type > &  nodes)

◆ genotype_svs()

void vg::genotype_svs ( VG graph,
string  gamfile,
string  refpath 
)

Takes a graph and two GAMs, one tumor and one normal Locates existing variation supported by the tumor and annotate it with a path Then overlay the normal sample Use a depthmap of snarltraversal transforms, one for tumor, one for normal which we can use to count the normal and tumor alleles void somatic_genotyper(VG* graph, string tumorgam, string normalgam);

Do smart augment, maintaining a depth map for tumor/normal perfect matches and then editing in all of the SV reads (after normalization) with a T/N_ prefix Then, get our Snarls count reads supporting each and genotype void somatic_caller_genotyper(VG* graph, string tumorgam, string normalgam);

◆ geometric_sampling_prob_ln()

template<typename ProbIn >
real_t vg::geometric_sampling_prob_ln ( ProbIn  success_logprob,
size_t  trials 
)

Get the log probability for sampling the given value from a geometric distribution with the given success log probability. The geometric distribution is the distribution of the number of trials, with a given success probability, required to observe a single success.

◆ get_alignment_emitter()

unique_ptr< AlignmentEmitter > vg::get_alignment_emitter ( const string &  filename,
const string &  format,
const map< string, int64_t > &  path_length,
size_t  max_threads,
const HandleGraph graph = nullptr 
)

Get an AlignmentEmitter that can emit to the given file (or "-") in the given format. A table of contig lengths is required for HTSlib formats. Automatically applies per-thread buffering, but needs to know how many OMP threads will be in use. If the alignments are spliced at known splice sites (i.e. edges in the graph), the graph can be provided in order to form spliced CIGAR strings for the HTSlib formats. Note: it must be castable to PathPositionHandleGraph to be used for splicing Other output formats except GAF (for which it's required) ignore the graph.

◆ get_annotation() [1/2]

template<typename AnnotationType , typename Annotated >
AnnotationType vg::get_annotation ( Annotated *  annotated,
const string &  name 
)
inline

Get the annotation with the given name and return it. If not present, returns the Protobuf default value for the annotation type. The value may be a primitive type or an entire Protobuf object. It is undefined behavior to read a value out into a different type than it was stored with.

◆ get_annotation() [2/2]

template<typename AnnotationType , typename Annotated >
AnnotationType vg::get_annotation ( const Annotated &  annotated,
const string &  name 
)
inline

Get the annotation with the given name and return it. If not present, returns the Protobuf default value for the annotation type. The value may be a primitive type or an entire Protobuf object. It is undefined behavior to read a value out into a different type than it was stored with.

◆ get_avg_baseq()

double vg::get_avg_baseq ( const Edit edit,
const string &  base_quals,
size_t  position_in_read 
)

Compute the average base quality of an edit. If the edit has no sequence or there are no base_quals given, then double_max is returned.

◆ get_current_vmem_kb()

size_t vg::get_current_vmem_kb ( )

Get the current virtual memory size, in kb, or 0 if unsupported.

◆ get_end_of()

Visit vg::get_end_of ( const Chain chain)

Get the outward-facing end Visit for a chain.

◆ get_fraction_of_ns()

double vg::get_fraction_of_ns ( const string &  seq)

Return the number of Ns as a fraction of the total sequence length (or 0 if the sequence is empty)

◆ get_gbwt()

gbwt::GBWT vg::get_gbwt ( const std::vector< gbwt::vector_type > &  paths)

Transform the paths into a GBWT index. Primarily for testing.

◆ get_id()

id_t& vg::get_id ( pos_t pos)
inline

Get a reference to the Node ID of a pos_t.

◆ get_input_file() [1/2]

void vg::get_input_file ( const string &  file_name,
function< void(istream &)>  callback 
)

Get a callback with an istream& to an open file. Handles "-" as a filename as indicating standard input. The reference passed is guaranteed to be valid only until the callback returns.

◆ get_input_file() [2/2]

void vg::get_input_file ( int &  optind,
int  argc,
char **  argv,
function< void(istream &)>  callback 
)

Get a callback with an istream& to an open file if a file name argument is present after the parsed options, or print an error message and exit if one is not. Handles "-" as a filename as indicating standard input. The reference passed is guaranteed to be valid only until the callback returns. Bumps up optind to the next argument if a filename is found.

◆ get_input_file_name()

string vg::get_input_file_name ( int &  optind,
int  argc,
char **  argv 
)

Parse out the name of an input file (i.e. the next positional argument), or throw an error. File name must be nonempty, but may be "-" or may not exist.

◆ get_is_rev()

bool& vg::get_is_rev ( pos_t pos)
inline

Get a reference to the reverse flag of a pos_t.

◆ get_max_rss_kb()

size_t vg::get_max_rss_kb ( )

Get the max RSS usage ever, in kb, or 0 if unsupported.

◆ get_max_vmem_kb()

size_t vg::get_max_vmem_kb ( )

Get the max virtual memory size ever, in kb, or 0 if unsupported.

◆ get_next_alignment_from_fastq()

bool vg::get_next_alignment_from_fastq ( gzFile  fp,
char *  buffer,
size_t  len,
Alignment alignment 
)

◆ get_next_alignment_pair_from_fastqs()

bool vg::get_next_alignment_pair_from_fastqs ( gzFile  fp1,
gzFile  fp2,
char *  buffer,
size_t  len,
Alignment mate1,
Alignment mate2 
)

◆ get_next_interleaved_alignment_pair_from_fastq()

bool vg::get_next_interleaved_alignment_pair_from_fastq ( gzFile  fp,
char *  buffer,
size_t  len,
Alignment mate1,
Alignment mate2 
)

◆ get_offset()

off_t& vg::get_offset ( pos_t pos)
inline

Get a reference to the offset field of a pos_t, which counts along the selected strand of the node.

◆ get_or_make_variant_id()

string vg::get_or_make_variant_id ( const vcflib::Variant &  variant)

◆ get_output_file_name()

string vg::get_output_file_name ( int &  optind,
int  argc,
char **  argv 
)

Parse out the name of an output file (i.e. the next positional argument), or throw an error. File name must be nonempty.

◆ get_path() [1/4]

std::vector<handle_t> vg::get_path ( const std::vector< handle_t > &  first,
gbwt::node_type  second 
)

◆ get_path() [2/4]

std::vector<handle_t> vg::get_path ( const std::vector< handle_t > &  first,
handle_t  second 
)

◆ get_path() [3/4]

std::vector<handle_t> vg::get_path ( gbwt::node_type  reverse_first,
const std::vector< handle_t > &  second 
)

◆ get_path() [4/4]

std::vector<handle_t> vg::get_path ( handle_t  first,
const std::vector< handle_t > &  second 
)

◆ get_proc_status_value()

string vg::get_proc_status_value ( const string &  name)

Get the string value for a field in /proc/self/status by name, or "" if unsupported or not found.

◆ get_start_of()

Visit vg::get_start_of ( const Chain chain)

Get the inward-facing start Visit for a chain.

◆ get_thread_count()

int vg::get_thread_count ( void  )

Return the number of threads that OMP will produce for a parallel section. TODO: Assumes that this is the same for every parallel section.

◆ get_traversal_of_snarl()

SnarlTraversal vg::get_traversal_of_snarl ( VG graph,
const Snarl snarl,
const SnarlManager manager,
const Path path 
)

Given a path (which may run either direction through a snarl, or not touch the ends at all), collect a list of NodeTraversals in order for the part of the path that is inside the snarl, in the same orientation as the path.

◆ getReachableBridges()

void vg::getReachableBridges ( stCactusEdgeEnd *  edgeEnd1,
stList *  bridgeEnds 
)

Get the bridge ends that form boundary pairs with edgeEnd1. Duplicated from the pinchesAndCacti tests.

◆ getReachableBridges2()

void vg::getReachableBridges2 ( stCactusEdgeEnd *  edgeEnd1,
stHash *  bridgeEndsToBridgeNodes,
stList *  bridgeEnds 
)

Get the bridge ends that form boundary pairs with edgeEnd1, using the given getBridgeEdgeEndsToBridgeNodes hash map. Duplicated from the pinchesAndCacti tests.

◆ golden_section_search()

double vg::golden_section_search ( const function< double(double)> &  f,
double  x_min,
double  x_max,
double  tolerance 
)

Returns a local maximum of a function within an interval.

◆ graph_to_gfa()

void vg::graph_to_gfa ( const unique_ptr< PathHandleGraph > &  graph,
ostream &  out 
)

Export the given VG graph to the given GFA file.

◆ handle_full_length()

void vg::handle_full_length ( const HandleGraph graph,
std::vector< GaplessExtension > &  result,
double  overlap_threshold 
)

◆ handle_graph_to_cactus()

pair< stCactusGraph *, stList * > vg::handle_graph_to_cactus ( const PathHandleGraph graph,
const unordered_set< string > &  hint_paths,
bool  single_component 
)

◆ handle_to_gbwt()

gbwt::node_type vg::handle_to_gbwt ( const HandleGraph graph,
handle_t  handle 
)
inline

Convert handle_t to gbwt::node_type.

◆ haplotype_consistent_alignments()

vector< Alignment > vg::haplotype_consistent_alignments ( const multipath_alignment_t multipath_aln,
const haplo::ScoreProvider score_provider,
size_t  soft_count,
size_t  hard_count,
bool  optimal_first = false 
)

Finds all alignments consistent with haplotypes available by incremental search with the given haplotype score provider. Pads to a certain count with haplotype-inconsistent alignments that are population-scorable (i.e. use only edges used by some haplotype in the index), and then with unscorable alignments if scorable ones are unavailable. This may result in an empty vector.

Output Alignments may not be unique. The input multipath_alignment_t may have exponentially many ways to spell the same Alignment, and we will look at all of them. We also may have duplicates of the optimal alignment if we are asked to produce it unconsitionally.

Note: Assumes that each subpath's Path object uses one Mapping per node and that start subpaths have been identified

Args: multipath_aln multipath alignment to find optimal paths through score_provider a haplo::ScoreProvider that supports incremental search over its haplotype database (such as a GBWTScoreProvider) soft_count maximum number of haplotype-inconsistent alignments to pad to hard_count maximum number of alignments, including haplotype-consistent (0 if no limit) optimal_first always compute and return first the optimal alignment, even if not haplotype-consistent

◆ has_inversion()

bool vg::has_inversion ( const Graph graph)

returns true if we find an edge that may specify an inversion

◆ hash_alignment()

const string vg::hash_alignment ( const Alignment aln)

◆ hash_to_rgb()

tuple< double, double, double > vg::hash_to_rgb ( const string &  str,
double  min_sum 
)

◆ have_input_file()

bool vg::have_input_file ( int &  optind,
int  argc,
char **  argv 
)

Return true if there's a command line argument (i.e. input file name) waiting to be processed.

◆ hts_file_header()

bam_hdr_t * vg::hts_file_header ( string &  filename,
string &  header 
)

◆ hts_for_each() [1/2]

int vg::hts_for_each ( string &  filename,
function< void(Alignment &)>  lambda 
)

◆ hts_for_each() [2/2]

int vg::hts_for_each ( string &  filename,
function< void(Alignment &)>  lambda,
const PathPositionHandleGraph graph 
)

◆ hts_for_each_parallel() [1/2]

int vg::hts_for_each_parallel ( string &  filename,
function< void(Alignment &)>  lambda 
)

◆ hts_for_each_parallel() [2/2]

int vg::hts_for_each_parallel ( string &  filename,
function< void(Alignment &)>  lambda,
const PathPositionHandleGraph graph 
)

◆ hts_string_header()

bam_hdr_t * vg::hts_string_header ( string &  header,
map< string, int64_t > &  path_length,
map< string, string > &  rg_sample 
)

◆ id()

id_t vg::id ( const pos_t pos)
inline

Extract the id of the node a pos_t is on.

◆ identify_start_subpaths()

void vg::identify_start_subpaths ( multipath_alignment_t multipath_aln)

Finds the start subpaths (i.e. the source nodes of the multipath DAG) and stores them in the 'start' field of the multipath_alignment_t

◆ identity()

double vg::identity ( const Path path)

◆ in_place_subvector()

template<class Element >
void vg::in_place_subvector ( std::vector< Element > &  vec,
size_t  head,
size_t  tail 
)

◆ increment_node_mapping_ids()

Path& vg::increment_node_mapping_ids ( Path p,
id_t  inc 
)

◆ index_positions()

void vg::index_positions ( VG graph,
map< long, Node * > &  node_path,
map< long, Edge * > &  edge_path 
)

◆ initial_position() [1/2]

pos_t vg::initial_position ( const Path path)

◆ initial_position() [2/2]

pos_t vg::initial_position ( const path_t path)

◆ insert_gbwt_path()

std::string vg::insert_gbwt_path ( MutablePathHandleGraph graph,
const gbwt::GBWT &  gbwt_index,
gbwt::size_type  id 
)

Insert a GBWT thread into the graph and return its name. Returns an empty string on failure. NOTE: id is a gbwt path id, not a gbwt sequence id.

◆ integer_power() [1/2]

size_t vg::integer_power ( size_t  x,
size_t  power 
)

◆ integer_power() [2/2]

size_t vg::integer_power ( uint64_t  base,
uint64_t  exponent 
)

Computes base^exponent in log(exponent) time.

◆ interval_length()

size_t vg::interval_length ( std::pair< size_t, size_t >  interval)

◆ is_all_n()

bool vg::is_all_n ( const string &  seq)

Return True if the given string is entirely Ns of either case, and false otherwise.

◆ is_empty()

bool vg::is_empty ( const pos_t pos)
inline

Return true if a pos_t is unset.

◆ is_id_sortable()

bool vg::is_id_sortable ( const Graph graph)

returns true if the graph is id-sortable (no reverse links)

◆ is_match()

bool vg::is_match ( const Translation translation)

◆ is_number() [1/2]

bool vg::is_number ( const std::string &  s)

◆ is_number() [2/2]

bool vg::is_number ( const string &  s)

◆ is_rev()

bool vg::is_rev ( const pos_t pos)
inline

Return true if a pos_t is on the reverse strand of its node.

◆ isATGC()

bool vg::isATGC ( const char &  b)

Return true if a character is an uppercase A, C, G, or T, and false otherwise.

◆ kmer_to_gcsa_kmers()

void vg::kmer_to_gcsa_kmers ( const kmer_t kmer,
const gcsa::Alphabet &  alpha,
const function< void(const gcsa::KMer &)> &  lambda 
)

Convert the kmer_t to a set of gcsa2 binary kmers which are exposed via a callback.

◆ last_path_position()

Position vg::last_path_position ( const Path path)

◆ list_haplotypes()

vector< pair< thread_t, int > > vg::list_haplotypes ( const HandleGraph source,
const gbwt::GBWT &  haplotype_database,
gbwt::node_type  start_node,
int  extend_distance 
)

◆ ln_to_log10()

double vg::ln_to_log10 ( double  ln)
inline

Convert a number ln to the same number log 10.

◆ log10_add_one()

double vg::log10_add_one ( double  x)
inline

Given the log10 of a value, retunr the log10 of (that value plus one).

◆ log10_to_ln()

double vg::log10_to_ln ( double  l10)
inline

Convert a number log 10 to the same number ln.

◆ logprob_add()

double vg::logprob_add ( double  logprob1,
double  logprob2 
)
inline

Add two probabilities (expressed as logprobs) together and return the result as a logprob.

◆ logprob_geometric_mean()

double vg::logprob_geometric_mean ( double  lnprob1,
double  lnprob2 
)
inline

Take the geometric mean of two logprobs.

◆ logprob_invert()

double vg::logprob_invert ( double  logprob)
inline

Invert a logprob, and get the probability of its opposite.

◆ logprob_sum()

template<typename Collection >
Collection::value_type vg::logprob_sum ( const Collection &  collection)

Compute the sum of the values in a collection, where the values are log probabilities and the result is the log of the total probability. Items must be convertible to/from doubles for math.

◆ logprob_to_phred()

double vg::logprob_to_phred ( double  logprob)
inline

Convert a natural log probability of wrongness directly to a Phred quality score.

◆ logprob_to_prob()

double vg::logprob_to_prob ( double  logprob)
inline

Convert natural log probability to a probability.

◆ make_pos_t() [1/4]

pos_t vg::make_pos_t ( const Position pos)

Convert a Position to a (much smaller) pos_t.

◆ make_pos_t() [2/4]

pos_t vg::make_pos_t ( const position_t pos)

◆ make_pos_t() [3/4]

pos_t vg::make_pos_t ( gcsa::node_type  node)

Create a pos_t from a gcsa node.

◆ make_pos_t() [4/4]

pos_t vg::make_pos_t ( id_t  id,
bool  is_rev,
off_t  off 
)
inline

Create a pos_t from a Node ID, an orientation flag, and an offset along that strand of the node.

◆ make_position() [1/3]

Position vg::make_position ( const pos_t pos)

Convert a pos_t to a Position.

◆ make_position() [2/3]

Position vg::make_position ( gcsa::node_type  node)

Make a Position from a gcsa node.

◆ make_position() [3/3]

Position vg::make_position ( id_t  id,
bool  is_rev,
off_t  off 
)

Create a Position from a Node ID, an orientation flag, and an offset along that strand of the node.

◆ make_shuffle_seed() [1/3]

string vg::make_shuffle_seed ( const Alignment aln)
inline

Make seeds for Alignments based on their sequences.

◆ make_shuffle_seed() [2/3]

string vg::make_shuffle_seed ( const Alignment aln)
inline

Make seeds for Alignments based on their sequences.

◆ make_shuffle_seed() [3/3]

string vg::make_shuffle_seed ( const pair< Alignment, Alignment > *  alns)
inline

Make seeds for pairs of Alignments based on their concatenated sequences.

◆ make_support()

Support vg::make_support ( double  forward,
double  reverse,
double  quality 
)

TBD Create a Support for the given forward and reverse coverage and quality.

◆ make_translation()

vector< Translation > vg::make_translation ( const HandleGraph graph,
const map< pos_t, id_t > &  node_translation,
const unordered_map< id_t, Path > &  added_nodes,
const unordered_map< id_t, size_t > &  orig_node_sizes 
)

Produce a graph Translation object from information about the editing process.

◆ make_variant_id()

string vg::make_variant_id ( const vcflib::Variant &  variant)

◆ map_keys_to_set()

template<typename T , typename V >
set<T> vg::map_keys_to_set ( const map< T, V > &  m)

◆ map_over()

template<template< class T, class A=std::allocator< T >> class Container, typename Input , typename Output >
Container<Output> vg::map_over ( const Container< Input > &  in,
const std::function< Output(const Input &)> &  lambda 
)

We have a transforming map function that we can chain.

◆ mapping_against_path() [1/2]

void vg::mapping_against_path ( Alignment alignment,
const bam1_t *  b,
char *  chr,
const PathPositionHandleGraph graph,
bool  on_reverse_strand 
)

◆ mapping_against_path() [2/2]

void vg::mapping_against_path ( Alignment alignment,
const bam1_t *  b,
const PathPositionHandleGraph graph,
bool  on_reverse_strand 
)

◆ mapping_cigar() [1/2]

void vg::mapping_cigar ( const Mapping mapping,
vector< pair< int, char > > &  cigar 
)

◆ mapping_cigar() [2/2]

void vg::mapping_cigar ( const Mapping mapping,
vector< pair< int, char >> &  cigar 
)

◆ mapping_ends_in_deletion()

bool vg::mapping_ends_in_deletion ( const Mapping m)

◆ mapping_from_length() [1/2]

int vg::mapping_from_length ( const Mapping m)

◆ mapping_from_length() [2/2]

int vg::mapping_from_length ( const path_mapping_t mapping)

◆ mapping_is_match()

bool vg::mapping_is_match ( const Mapping m)

◆ mapping_is_simple_match()

bool vg::mapping_is_simple_match ( const Mapping m)

◆ mapping_is_total_deletion()

bool vg::mapping_is_total_deletion ( const Mapping m)

◆ mapping_sequence() [1/2]

const string vg::mapping_sequence ( const Mapping mp,
const Node n 
)

◆ mapping_sequence() [2/2]

const string vg::mapping_sequence ( const Mapping mp,
const string &  node_seq 
)

◆ mapping_starts_in_deletion()

bool vg::mapping_starts_in_deletion ( const Mapping m)

◆ mapping_string()

string vg::mapping_string ( const string &  source,
const Mapping mapping 
)

◆ mapping_to_gbwt()

gbwt::node_type vg::mapping_to_gbwt ( const Mapping mapping)
inline

Convert Mapping to gbwt::node_type.

◆ mapping_to_length() [1/2]

int vg::mapping_to_length ( const Mapping m)

◆ mapping_to_length() [2/2]

int vg::mapping_to_length ( const path_mapping_t mapping)

◆ maps_to_node()

bool vg::maps_to_node ( const Path p,
id_t  id 
)

◆ match_backward()

void vg::match_backward ( GaplessExtension match,
const std::string &  seq,
gbwtgraph::GBWTGraph::view_type  target,
uint32_t  mismatch_limit 
)

◆ match_forward()

size_t vg::match_forward ( GaplessExtension match,
const std::string &  seq,
gbwtgraph::GBWTGraph::view_type  target,
uint32_t  mismatch_limit 
)

◆ match_initial()

void vg::match_initial ( GaplessExtension match,
const std::string &  seq,
gbwtgraph::GBWTGraph::view_type  target 
)

◆ matrix_invert()

vector< vector< double > > vg::matrix_invert ( const vector< vector< double >> &  A)

◆ matrix_multiply() [1/2]

vector< double > vg::matrix_multiply ( const vector< vector< double >> &  A,
const vector< double > &  b 
)

◆ matrix_multiply() [2/2]

vector< vector< double > > vg::matrix_multiply ( const vector< vector< double >> &  A,
const vector< vector< double >> &  B 
)

◆ max_exponential_cdf()

double vg::max_exponential_cdf ( double  x,
double  rate,
double  shape,
double  location = 0.0 
)
inline

Return the CDF of a max exponential with the given parameters.

◆ max_exponential_log_likelihood()

double vg::max_exponential_log_likelihood ( const vector< double > &  x,
double  rate,
double  shape,
double  location 
)

The log likelihood of a max exponential with the given parameters on the given data.

◆ median()

double vg::median ( std::vector< int > &  v)

◆ mem_min_oriented_distances()

pair< int64_t, int64_t > vg::mem_min_oriented_distances ( const MaximalExactMatch m1,
const MaximalExactMatch m2 
)

◆ mem_node_start_positions()

vector< pair< gcsa::node_type, size_t > > vg::mem_node_start_positions ( const HandleGraph graph,
const vg::MaximalExactMatch mem 
)

get the handles that a mem covers

◆ mems_overlap()

bool vg::mems_overlap ( const MaximalExactMatch mem1,
const MaximalExactMatch mem2 
)

◆ mems_overlap_length()

int vg::mems_overlap_length ( const MaximalExactMatch mem1,
const MaximalExactMatch mem2 
)

◆ mems_to_json()

const string vg::mems_to_json ( const vector< MaximalExactMatch > &  mems)

◆ merge_adjacent_edits() [1/2]

Mapping vg::merge_adjacent_edits ( const Mapping m)

Merge adjacent edits of the same type.

◆ merge_adjacent_edits() [2/2]

Path vg::merge_adjacent_edits ( const Path m)

Merge adjacent edits of the same type.

◆ merge_alignments() [1/2]

Alignment vg::merge_alignments ( const Alignment a1,
const Alignment a2,
bool  debug 
)

◆ merge_alignments() [2/2]

Alignment vg::merge_alignments ( const vector< Alignment > &  alns)

◆ merge_non_branching_subpaths()

void vg::merge_non_branching_subpaths ( multipath_alignment_t multipath_aln)

Merges non-branching paths in a multipath alignment in place.

◆ mergeNodeObjects()

void* vg::mergeNodeObjects ( void *  a,
void *  b 
)

◆ middle_signature() [1/2]

string vg::middle_signature ( const Alignment aln,
int  len 
)

◆ middle_signature() [2/2]

pair< string, string > vg::middle_signature ( const Alignment aln1,
const Alignment aln2,
int  len 
)

◆ min_not_minus_one()

int64_t vg::min_not_minus_one ( int64_t  n1,
int64_t  n2 
)

◆ min_oriented_distances()

pair< int64_t, int64_t > vg::min_oriented_distances ( const unordered_map< path_handle_t, vector< pair< size_t, bool > > > &  path_offsets1,
const unordered_map< path_handle_t, vector< pair< size_t, bool > > > &  path_offsets2 
)

Find the min distance in the path offsets where the path orientation is the same and different.

◆ mismatch_penalty()

int32_t vg::mismatch_penalty ( size_t  n,
const Aligner aligner 
)

◆ modular_exponent()

size_t vg::modular_exponent ( uint64_t  base,
uint64_t  exponent,
uint64_t  modulus 
)

Computes base^exponent mod modulus in log(exponent) time without requiring more than 64 bits to represent exponentiated number

◆ multinomial_censored_sampling_prob_ln()

template<typename ProbIn >
real_t vg::multinomial_censored_sampling_prob_ln ( const vector< ProbIn > &  probs,
const unordered_map< vector< bool >, int > &  obs 
)

Get the log probability for sampling any actual set of category counts that is consistent with the constraints specified by obs, using the per-category probabilities defined in probs.

Obs maps from a vector of per-category flags (called a "class") to a number of items that might be in any of the flagged categories.

For example, if there are two equally likely categories, and one item flagged as potentially from either category, the probability of sampling a set of category counts consistent with that constraint is 1. If instead there are three equally likely categories, and one item flagged as potentially from two of the three but not the third, the probability of sampling a set of category counts consistent with that constraint is 2/3.

◆ multinomial_choose_ln()

real_t vg::multinomial_choose_ln ( int  n,
vector< int >  k 
)
inline

Compute the number of ways to select k_1, k_2, ... k_i items into i buckets from a collection of n distinguishable items, ignoring order. All of the items have to go into the buckets, so all k_i must sum to n. To compute choose you have to call this function with a 2-element vector, to represent the chosen and not-chosen buckets. Returns the natural log of the (integer) result.

TODO: Turns out we don't actually need this for the ambiguous multinomial after all.

◆ multinomial_sampling_prob_ln()

template<typename ProbIn >
real_t vg::multinomial_sampling_prob_ln ( const vector< ProbIn > &  probs,
const vector< int > &  obs 
)

Get the probability for sampling the counts in obs from a set of categories weighted by the probabilities in probs. Works for both double and real_t probabilities. Also works for binomials.

◆ node_end()

NodeSide vg::node_end ( id_t  id)
inline

Produce the end NodeSide of a Node.

◆ node_path_position()

void vg::node_path_position ( nid_t  id,
string &  path_name,
int64_t &  position,
bool  backward,
int64_t &  offset 
)

◆ node_start()

NodeSide vg::node_start ( id_t  id)
inline

Produce the start NodeSide of a Node.

◆ non_match_end()

int vg::non_match_end ( const Alignment alignment)

◆ non_match_start()

int vg::non_match_start ( const Alignment alignment)

◆ nonATGCNtoN()

string vg::nonATGCNtoN ( const string &  s)

◆ normal_inverse_cdf()

double vg::normal_inverse_cdf ( double  p)

Inverse CDF of a standard normal distribution. Must have 0 < quantile < 1.

◆ normal_pdf()

template<typename T >
T vg::normal_pdf ( x,
m,
s 
)

◆ normalize_alignment()

void vg::normalize_alignment ( Alignment alignment)

Merge adjacent edits of the same type and convert all N matches to mismatches.

◆ offset()

off_t vg::offset ( const pos_t pos)
inline

Get the offset along the selected strand of the node from a pos_t.

◆ operator!=() [1/3]

bool vg::operator!= ( const Snarl a,
const Snarl b 
)

Two Snarls are unequal if they are not equal.

◆ operator!=() [2/3]

bool vg::operator!= ( const SnarlTraversal a,
const SnarlTraversal b 
)

Two SnarlTraversals are unequal if they are not equal.

◆ operator!=() [3/3]

bool vg::operator!= ( const Visit a,
const Visit b 
)

Two Visits are unequal if they are not equal.

◆ operator*() [1/2]

template<typename Scalar >
Support vg::operator* ( const Scalar &  scale,
const Support support 
)

Scale a Support by a factor, the other way

◆ operator*() [2/2]

template<typename Scalar >
Support vg::operator* ( const Support support,
const Scalar &  scale 
)

Scale a Support by a factor.

◆ operator*=()

template<typename Scalar >
Support& vg::operator*= ( Support support,
const Scalar &  scale 
)

Scale a Support by a factor, in place.

◆ operator+()

Support vg::operator+ ( const Support one,
const Support other 
)

Add two Support values together, accounting for strand.

◆ operator+=()

Support & vg::operator+= ( Support one,
const Support other 
)

Add in a Support to another.

◆ operator/()

template<typename Scalar >
Support vg::operator/ ( const Support support,
const Scalar &  scale 
)

Divide a Support by a factor.

◆ operator/=()

template<typename Scalar >
Support& vg::operator/= ( Support support,
const Scalar &  scale 
)

Divide a Support by a factor, in place.

◆ operator<() [1/5]

bool vg::operator< ( const MaximalExactMatch m1,
const MaximalExactMatch m2 
)

◆ operator<() [2/5]

bool vg::operator< ( const Snarl a,
const Snarl b 
)

A Snarl is less than another Snarl if its type is smaller, or its start Visit is smaller, or its end Visit is smaller, or its parent is smaller.

◆ operator<() [3/5]

bool vg::operator< ( const SnarlTraversal a,
const SnarlTraversal b 
)

A SnalTraversal is less than another if it is a traversal of a smaller Snarl, or if its list of Visits has a smaller Visit first, or if its list of Visits is shorter.

◆ operator<() [4/5]

bool vg::operator< ( const Support a,
const Support b 
)

Support less-than, based on total coverage.

◆ operator<() [5/5]

bool vg::operator< ( const Visit a,
const Visit b 
)

A Visit is less than another Visit if it represents a traversal of a smaller node, or it represents a traversal of a smaller snarl, or it represents a traversal of the same node or snarl forward instead of backward.

◆ operator<<() [1/13]

ostream & vg::operator<< ( ostream &  os,
const ReadFilter::Counts counts 
)

◆ operator<<() [2/13]

ostream & vg::operator<< ( ostream &  out,
const BenchmarkResult result 
)

Benchmark results can be output to streams

◆ operator<<() [3/13]

ostream & vg::operator<< ( ostream &  out,
const BitString bs 
) -> ostream &

Allow BitStrings to be printed for debugging.

◆ operator<<() [4/13]

ostream & vg::operator<< ( ostream &  out,
const kmer_t kmer 
)

Print a kmer_t to a stream.

◆ operator<<() [5/13]

ostream& vg::operator<< ( ostream &  out,
const MaximalExactMatch mem 
)

◆ operator<<() [6/13]

ostream& vg::operator<< ( ostream &  out,
const NodeSide nodeside 
)
inline

Print a NodeSide to a stream.

◆ operator<<() [7/13]

ostream& vg::operator<< ( ostream &  out,
const NodeTraversal nodetraversal 
)
inline

Print the given NodeTraversal.

◆ operator<<() [8/13]

ostream & vg::operator<< ( ostream &  out,
const Snarl snarl 
)

A Snarl can be printed.

◆ operator<<() [9/13]

ostream & vg::operator<< ( ostream &  out,
const Visit visit 
)

A Visit can be printed.

◆ operator<<() [10/13]

ostream & vg::operator<< ( ostream &  out,
mapping_t  mapping 
)

Allow a mapping_t to be printed, for debugging purposes.

◆ operator<<() [11/13]

ostream & vg::operator<< ( ostream &  stream,
const Support support 
)

Allow printing a Support.

◆ operator<<() [12/13]

std::ostream& vg::operator<< ( std::ostream &  out,
const pos_t pos 
)
inline

Print a pos_t to a stream.

◆ operator<<() [13/13]

std::ostream& vg::operator<< ( std::ostream &  out,
PathBranch  branch 
)

◆ operator==() [1/4]

bool vg::operator== ( const MaximalExactMatch m1,
const MaximalExactMatch m2 
)

◆ operator==() [2/4]

bool vg::operator== ( const Snarl a,
const Snarl b 
)

Two Snarls are equal if their types are equal and their bounding Visits are equal and their parents are equal.

◆ operator==() [3/4]

bool vg::operator== ( const SnarlTraversal a,
const SnarlTraversal b 
)

Two SnarlTraversals are equal if their snarls are equal and they have the same number of visits and all their visits are equal.

◆ operator==() [4/4]

bool vg::operator== ( const Visit a,
const Visit b 
)

Two Visits are equal if they represent the same traversal of the same Node or Snarl.

◆ operator>()

bool vg::operator> ( const Support a,
const Support b 
)

Support greater-than, based on total coverage.

◆ optimal_alignment()

void vg::optimal_alignment ( const multipath_alignment_t multipath_aln,
Alignment aln_out,
bool  subpath_global = false 
)

Stores the highest scoring alignment contained in the multipath_alignment_t in an Alignment

Note: Assumes that each subpath's Path object uses one Mapping per node and that start subpaths have been identified

Args: multipath_aln multipath alignment to find optimal path through aln_out empty alignment to store optimal alignment in (data will be overwritten if not empty) subpath_global if true, only allows alignments that source subpath to sink subpath in the multipath DAG, else allows any start and end subpath

◆ optimal_alignment_internal()

int32_t vg::optimal_alignment_internal ( const multipath_alignment_t multipath_aln,
Alignment aln_out,
bool  subpath_global 
)

◆ optimal_alignment_score()

int32_t vg::optimal_alignment_score ( const multipath_alignment_t multipath_aln,
bool  subpath_global = false 
)

Returns the score of the highest scoring alignment contained in the multipath_alignment_t

Note: Assumes that each subpath's Path object uses one Mapping per node and that start subpaths have been identified

Args: multipath_aln multipath alignment to find optimal score in subpath_global if true, only allows alignments that source subpath to sink subpath in the multipath DAG, else allows any start and end subpath

◆ optimal_alignments()

vector< Alignment > vg::optimal_alignments ( const multipath_alignment_t multipath_aln,
size_t  count 
)

Returns the top k highest-scoring alignments contained in the multipath_alignment_t. Note that some or all of these may be duplicate Alignments, which were spelled out by tracebacks through different sequences of subpaths that shared alignment material.

If the best alignment is no alignment (i.e. the read is unmapped), returns an empty vector.

Note: Assumes that each subpath's Path object uses one Mapping per node and that start subpaths have been identified

Args: multipath_aln multipath alignment to find optimal paths through count maximum number of top alignments to return

◆ optimal_alignments_with_disjoint_subpaths()

vector< Alignment > vg::optimal_alignments_with_disjoint_subpaths ( const multipath_alignment_t multipath_aln,
size_t  count 
)

Finds k or fewer top-scoring alignments using only distinct subpaths. Asymmetrical: the optimal alignment for each end subpath is found, greedily, subject to the constraint, but the other subpaths are first-come first-serve. Also, distinct subpaths may not guarantee distinct actual alignments, so alignments may need deduplication.

If the best alignment is no alignment (i.e. the read is unmapped), returns an empty vector.

Note: Assumes that each subpath's Path object uses one Mapping per node and that start subpaths have been identified

Args: multipath_aln multipath alignment to find optimal paths through count maximum number of top alignments to return

◆ output_graph_with_embedded_paths() [1/2]

void vg::output_graph_with_embedded_paths ( ostream &  subgraph_ostream,
vector< pair< thread_t, int >> &  haplotype_list,
const HandleGraph source,
bool  json 
)

◆ output_graph_with_embedded_paths() [2/2]

Graph vg::output_graph_with_embedded_paths ( vector< pair< thread_t, int >> &  haplotype_list,
const HandleGraph source 
)

◆ output_haplotype_counts()

void vg::output_haplotype_counts ( ostream &  annotation_ostream,
vector< pair< thread_t, int >> &  haplotype_list 
)

◆ overlap()

double vg::overlap ( const Path p1,
const Path p2 
)

◆ overlay_node_translations() [1/4]

unordered_map< id_t, id_t > vg::overlay_node_translations ( const unordered_map< id_t, id_t > &  over,
const unordered_map< id_t, id_t > &  under 
)

Compose the translations from two graph operations, neither of which involved oriented transformations.

◆ overlay_node_translations() [2/4]

unordered_map< id_t, pair< id_t, bool > > vg::overlay_node_translations ( const unordered_map< id_t, id_t > &  over,
const unordered_map< id_t, pair< id_t, bool >> &  under 
)

Compose the translations from two graph operations, the first of which involved oriented transformations.

◆ overlay_node_translations() [3/4]

unordered_map< id_t, pair< id_t, bool > > vg::overlay_node_translations ( const unordered_map< id_t, pair< id_t, bool >> &  over,
const unordered_map< id_t, id_t > &  under 
)

Compose the translations from two graph operations, the second of which involved oriented transformations.

◆ overlay_node_translations() [4/4]

unordered_map< id_t, pair< id_t, bool > > vg::overlay_node_translations ( const unordered_map< id_t, pair< id_t, bool >> &  over,
const unordered_map< id_t, pair< id_t, bool >> &  under 
)

Compose the translations from two graph operations, both of which involved oriented transformations.

◆ parse() [1/7]

template<typename Result >
Result vg::parse ( const char *  arg)

Parse a command-line argument C string. Exits with an error if the string does not contain exactly an item fo the appropriate type.

◆ parse() [2/7]

template<typename Result >
Result vg::parse ( const string &  arg)

Parse a command-line argument string. Exits with an error if the string does not contain exactly an item fo the appropriate type.

◆ parse() [3/7]

template<>
bool vg::parse ( const string &  arg,
double &  dest 
)

◆ parse() [4/7]

template<typename Result >
bool vg::parse ( const string &  arg,
Result &  dest 
)

Parse the appropriate type from the string to the destination value. Return true if parsing is successful and false (or throw something) otherwise.

◆ parse() [5/7]

template<>
bool vg::parse ( const string &  arg,
std::regex &  dest 
)

◆ parse() [6/7]

template<typename Result >
bool vg::parse ( const string &  arg,
typename enable_if< is_instantiation_of< Result, Range >::value, Result >::type &  dest 
)
inline

Parse a range as start[:end[:step]].

◆ parse() [7/7]

template<typename Result >
bool vg::parse ( const string &  arg)

◆ parse_bed_regions() [1/2]

void vg::parse_bed_regions ( const string &  bed_path,
vector< Region > &  out_regions,
vector< string > *  out_names 
)

◆ parse_bed_regions() [2/2]

void vg::parse_bed_regions ( istream &  bedstream,
const PathPositionHandleGraph graph,
vector< Alignment > *  out_alignments 
)

Parse regions from the given BED file into Alignments in a vector. Reads the optional name, is_reverse, and score fields if present, and populates the relevant Alignment fields. Skips and warns about malformed or illegal BED records.

◆ parse_gff_regions()

void vg::parse_gff_regions ( istream &  gffstream,
const PathPositionHandleGraph graph,
vector< Alignment > *  out_alignments 
)

◆ parse_region() [1/2]

void vg::parse_region ( const string &  target,
string &  name,
int64_t &  start,
int64_t &  end 
)

◆ parse_region() [2/2]

void vg::parse_region ( string &  region,
Region out_region 
)
inline

◆ parse_rg_sample_map()

void vg::parse_rg_sample_map ( char *  hts_header,
map< string, string > &  rg_sample 
)

◆ parseGenotypes()

std::vector< std::string > vg::parseGenotypes ( const std::string &  vcf_line,
size_t  num_samples 
)

◆ path_end_position()

Position vg::path_end_position ( const Path path)

◆ path_from_length() [1/2]

int vg::path_from_length ( const Path path)

◆ path_from_length() [2/2]

int vg::path_from_length ( const path_t path)

◆ path_from_node_traversals()

Path vg::path_from_node_traversals ( const list< NodeTraversal > &  traversals)

◆ path_from_path_handle()

Path vg::path_from_path_handle ( const PathHandleGraph graph,
path_handle_t  path_handle 
)

◆ path_from_thread_t()

Path vg::path_from_thread_t ( thread_t t,
const HandleGraph source 
)

◆ path_is_simple_match()

bool vg::path_is_simple_match ( const Path p)

◆ path_node() [1/2]

vg::id_t vg::path_node ( const gbwt::vector_type &  path,
size_t  i 
)

◆ path_node() [2/2]

vg::id_t vg::path_node ( const vector< pair< vg::id_t, bool >> &  path,
size_t  i 
)

◆ path_predecessors()

gbwt::vector_type vg::path_predecessors ( const PathHandleGraph graph,
const std::string &  path_name 
)

◆ path_reverse() [1/2]

bool vg::path_reverse ( const gbwt::vector_type &  path,
size_t  i 
)

◆ path_reverse() [2/2]

bool vg::path_reverse ( const vector< pair< vg::id_t, bool >> &  path,
size_t  i 
)

◆ path_sequence()

string vg::path_sequence ( const HandleGraph graph,
const Path path 
)

◆ path_size() [1/2]

size_t vg::path_size ( const gbwt::vector_type &  path)

◆ path_size() [2/2]

size_t vg::path_size ( const vector< pair< vg::id_t, bool >> &  path)

◆ path_start_position()

Position vg::path_start_position ( const Path path)

◆ path_to_gbwt()

gbwt::vector_type vg::path_to_gbwt ( const Path path)
inline

Convert Path to a GBWT path.

◆ path_to_length() [1/2]

int vg::path_to_length ( const Path path)

◆ path_to_length() [2/2]

int vg::path_to_length ( const path_t path)

◆ path_to_string()

string vg::path_to_string ( Path  p)

◆ paths_from_graph()

const Paths vg::paths_from_graph ( Graph g)

◆ percent_url_encode()

string vg::percent_url_encode ( const string &  seq)

Escape "%" to "%25".

◆ phi()

double vg::phi ( double  x1,
double  x2 
)

◆ phred_add()

double vg::phred_add ( double  phred1,
double  phred2 
)
inline

Add two probabilities (expressed as phred scores) together and return the result as a phred score.

◆ phred_for_at_least_one()

double vg::phred_for_at_least_one ( size_t  p,
size_t  n 
)

Assume that we have n independent random events that occur with probability p each (p is interpreted as a real number between 0 at 0 and 1 at its maximum value). Return an approximate probability for at least one event occurring as a phred score.

n must be <= MAX_AT_LEAST_ONE_EVENTS.

Assume that we have n <= MAX_AT_LEAST_ONE_EVENTS independent events with probability p each. Let x be the AT_LEAST_ONE_PRECISION most significant bits of p. Then

phred_at_least_one[(n << AT_LEAST_ONE_PRECISION) + x]

is an approximate phred score of at least one event occurring.

We exploit the magical thread-safety of static local initialization to fill this in exactly once when needed.

◆ phred_geometric_mean()

double vg::phred_geometric_mean ( double  phred1,
double  phred2 
)
inline

Take the geometric mean of two phred-encoded probabilities.

◆ phred_sum() [1/2]

template<typename Collection >
Collection::value_type vg::phred_sum ( const Collection &  collection)

Compute the sum of the values in a collection, where the values are Phred scores and the result is the Phred score of the total probability. Items must be convertible to/from doubles for math.

◆ phred_sum() [2/2]

template<typename Iterator >
std::iterator_traits<Iterator>::value_type vg::phred_sum ( const Iterator &  begin_it,
const Iterator &  end_it 
)

Compute the sum of the values in a collection, represented by an iterator range, where the values are Phred scores and the result is the Phred score of the total probability. Items must be convertible to/from doubles for math.

◆ phred_to_logprob()

double vg::phred_to_logprob ( int  phred)
inline

Convert a Phred quality score directly to a natural log probability of wrongness.

◆ phred_to_prob() [1/2]

double vg::phred_to_prob ( double  phred)
inline

Convert floating point Phred quality score to probability of wrongness.

◆ phred_to_prob() [2/2]

double vg::phred_to_prob ( uint8_t  phred)

Convert 8-bit Phred quality score to probability of wrongness, using a lookup table.

◆ pmax()

template<typename T >
vector<T> vg::pmax ( const std::vector< T > &  a,
const std::vector< T > &  b 
)

◆ pointerfy()

template<template< class T, class A=std::allocator< T >> class Container, typename Item >
Container<const Item*> vg::pointerfy ( const Container< Item > &  in)

We have a wrapper of that to turn a container reference into a container of pointers.

◆ poisson_prob_ln()

real_t vg::poisson_prob_ln ( int  observed,
real_t  expected 
)
inline

Compute the log probability of a Poisson-distributed process: observed events in an interval where expected events happen on average.

◆ populate_path_from_traceback()

template<typename TracebackIterator >
void vg::populate_path_from_traceback ( const multipath_alignment_t multipath_aln,
const MultipathProblem problem,
TracebackIterator  traceback_start,
TracebackIterator  traceback_end,
Path output 
)

We define this helper to turn tracebacks through a DP problem into Paths that we can put in an Alignment. We use iterators to the start and past-the-end of the traceback (in some kind of list of int64_t subpath indexes) to define it.

◆ pos_to_gbwt()

gbwt::node_type vg::pos_to_gbwt ( pos_t  pos)
inline

Extract gbwt::node_type from pos_t.

◆ position_at()

pos_t vg::position_at ( PathPositionHandleGraph xgidx,
const string &  path_name,
const size_t &  path_offset,
bool  is_reverse 
)

We have a helper function to convert path positions and orientations to pos_t values.

We have a utility function for turning positions along paths, with orientations, into pos_ts. Remember that pos_t counts offset from the start of the reoriented node, while here we count offset from the beginning of the forward version of the path.

◆ pow_ln()

real_t vg::pow_ln ( real_t  m,
int  n 
)
inline

Raise a log probability to a power

◆ preflight_check()

void vg::preflight_check ( )

Run a preflight check to make sure that the system is usable for this build of vg. Aborts with a helpful message if this is not the case. We make sure to build it for a lowest-common-denominator architecture.

◆ printId()

template<class Decoder >
void vg::printId ( vg::id_t  id)

◆ prob_for_at_least_one()

double vg::prob_for_at_least_one ( size_t  p,
size_t  n 
)

Assume that we have n independent random events that occur with probability p each (p is interpreted as a real number between 0 at 0 and 1 at its maximum value). Return an approximate probability for at least one event occurring as a raw probability.

n must be <= MAX_AT_LEAST_ONE_EVENTS.

Assume that we have n <= MAX_AT_LEAST_ONE_EVENTS independent events with probability p each. Let x be the AT_LEAST_ONE_PRECISION most significant bits of p. Then

prob_at_least_one[(n << AT_LEAST_ONE_PRECISION) + x]

is an approximate probability of at least one event occurring.

We exploit the magical thread-safety of static local initialization to fill this in exactly once when needed.

◆ prob_to_logprob()

double vg::prob_to_logprob ( double  prob)
inline

Convert a probability to a natural log probability.

◆ prob_to_phred()

double vg::prob_to_phred ( double  prob)
inline

Convert probability of wrongness to integer Phred quality score.

◆ pseudo_random_sequence()

string vg::pseudo_random_sequence ( size_t  length,
uint64_t  seed 
)

Returns a uniformly random DNA sequence sequence deterministically from a seed.

◆ query_overlap()

int vg::query_overlap ( const Alignment aln1,
const Alignment aln2 
)

◆ random_sequence()

string vg::random_sequence ( size_t  length)

Returns a uniformly random DNA sequence of the given length.

◆ random_sequence_gen()

default_random_engine vg::random_sequence_gen ( 102  )

◆ range_vector() [1/2]

vector< size_t > vg::range_vector ( size_t  begin,
size_t  end 
)

◆ range_vector() [2/2]

vector<size_t> vg::range_vector ( size_t  end)
inline

◆ regress()

vector< double > vg::regress ( const vector< vector< double >> &  X,
vector< double > &  y 
)

Returns the coefficients of a regression (does not automatically compute constant)

◆ remove_duplicate_edges()

void vg::remove_duplicate_edges ( Graph graph)

remove duplicate edges

◆ remove_duplicate_nodes()

void vg::remove_duplicate_nodes ( Graph graph)

remove duplicate nodes

◆ remove_duplicates() [1/2]

void vg::remove_duplicates ( Graph graph)

remove duplicate nodes and edges

◆ remove_duplicates() [2/2]

void vg::remove_duplicates ( std::vector< GaplessExtension > &  result)

◆ remove_empty_subpaths()

void vg::remove_empty_subpaths ( multipath_alignment_t multipath_aln)

Removes subpaths that have no aligned bases and adds in any implied edges crossing through them Note: not updated for connections yet

◆ remove_orphan_edges()

void vg::remove_orphan_edges ( Graph graph)

remove edges that link to a node that is not in the graph

◆ remove_paths()

void vg::remove_paths ( Graph graph,
const function< bool(const string &)> &  paths_to_take,
std::list< Path > *  matching 
)

◆ replace_in_string()

string vg::replace_in_string ( string  subject,
const string &  search,
const string &  replace 
)

◆ rev_comp_multipath_alignment()

void vg::rev_comp_multipath_alignment ( const multipath_alignment_t multipath_aln,
const function< int64_t(int64_t)> &  node_length,
multipath_alignment_t rev_comp_out 
)

Stores the reverse complement of a multipath_alignment_t in another multipath_alignment_t

Args: multipath_aln multipath alignment to reverse complement node_length a function that returns the length of a node sequence from its node ID rev_comp_out empty multipath alignment to store reverse complement in (some data may be overwritten if not empty)

◆ rev_comp_multipath_alignment_in_place()

void vg::rev_comp_multipath_alignment_in_place ( multipath_alignment_t multipath_aln,
const function< int64_t(int64_t)> &  node_length 
)

Stores the reverse complement of a multipath_alignment_t in another multipath_alignment_t

Args: multipath_aln multipath alignment to reverse complement in place node_length a function that returns the length of a node sequence from its node ID

◆ rev_comp_subpath()

void vg::rev_comp_subpath ( const subpath_t subpath,
const function< int64_t(int64_t)> &  node_length,
subpath_t rev_comp_out 
)
inline

Stores the reverse complement of a Subpath in another Subpath

note: this is not included in the header because reversing a subpath without going through the multipath alignment can break invariants related to the edge lists

Args: subpath subpath to reverse complement node_length a function that returns the length of a node sequence from its node ID rev_comp_out empty subpath to store reverse complement in (data will be overwritten if not empty)

◆ reverse() [1/3]

pos_t vg::reverse ( const pos_t pos,
size_t  node_length 
)
inline

Reverse a pos_t and get a pos_t at the same point between bases, going the other direction. To get a pos_t to the same base, subtract 1 from the resulting offset or call reverse_base_pos().

◆ reverse() [2/3]

Position vg::reverse ( const Position pos,
size_t  node_length 
)

Reverse a Position and get a Position at the same point between bases, going the other direction. To get a Position to the same base, subtract 1 from the resulting offset.

◆ reverse() [3/3]

Visit vg::reverse ( const Visit visit)
inline

Get the reversed version of a visit.

◆ reverse_base_pos()

pos_t vg::reverse_base_pos ( const pos_t pos,
size_t  node_length 
)
inline

Reverse a pos_t and get a pos_t at the same base, going the other direction.

◆ reverse_complement() [1/2]

char vg::reverse_complement ( const char &  c)

◆ reverse_complement() [2/2]

string vg::reverse_complement ( const string &  seq)

◆ reverse_complement_alignment()

Alignment vg::reverse_complement_alignment ( const Alignment aln,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_alignment_in_place()

void vg::reverse_complement_alignment_in_place ( Alignment aln,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_alignments()

vector< Alignment > vg::reverse_complement_alignments ( const vector< Alignment > &  alns,
const function< int64_t(int64_t)> &  node_length 
)

◆ reverse_complement_in_place()

void vg::reverse_complement_in_place ( string &  seq)

◆ reverse_complement_mapping() [1/2]

Mapping vg::reverse_complement_mapping ( const Mapping m,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_mapping() [2/2]

path_mapping_t vg::reverse_complement_mapping ( const path_mapping_t m,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_mapping_in_place() [1/2]

void vg::reverse_complement_mapping_in_place ( Mapping m,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_mapping_in_place() [2/2]

void vg::reverse_complement_mapping_in_place ( path_mapping_t m,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_path() [1/2]

Path vg::reverse_complement_path ( const Path path,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_path() [2/2]

path_t vg::reverse_complement_path ( const path_t path,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_path_in_place() [1/2]

void vg::reverse_complement_path_in_place ( Path path,
const function< int64_t(id_t)> &  node_length 
)

◆ reverse_complement_path_in_place() [2/2]

void vg::reverse_complement_path_in_place ( path_t path,
const function< int64_t(id_t)> &  node_length 
)

◆ run_benchmark() [1/2]

BenchmarkResult vg::run_benchmark ( const string &  name,
size_t  iterations,
const function< void(void)> &  setup,
const function< void(void)> &  under_test 
)

Run a benchmark with a setup function.

◆ run_benchmark() [2/2]

BenchmarkResult vg::run_benchmark ( const string &  name,
size_t  iterations,
const function< void(void)> &  under_test 
)

Run the given function the given number of times, interleaved with runs of the control function, and return a BenchmarkResult describing its performance.

◆ run_multipath_dp()

tuple<MultipathProblem, int64_t, int32_t> vg::run_multipath_dp ( const multipath_alignment_t multipath_aln,
bool  subpath_global = false 
)

Internal helper function for running the dynamic programming problem represented by a multipath alignment. Returns the filled DP problem, the optimal ending subpath, or -1 if no subpath is optimal, and the optimal score, or 0 if no score is optimal. An option toggles whether the traceback should be global (a source to a sink in the multipath DAG) or local (starting and ending at any subpath)

◆ sam_flag()

int32_t vg::sam_flag ( const Alignment alignment,
bool  on_reverse_strand,
bool  paired 
)

◆ search_multipath_alignment()

vector< tuple< int64_t, int64_t, int64_t, int64_t > > vg::search_multipath_alignment ( const multipath_alignment_t multipath_aln,
const pos_t graph_pos,
int64_t  seq_pos 
)

Returns all of the positions where a given sequence index occurs at a given graph graph position (if any), where positions are represented as tuples of (subpath index, mapping index, edit index, index within edit)

◆ set_annotation() [1/2]

template<typename AnnotationType , typename Annotated >
void vg::set_annotation ( Annotated &  annotated,
const string &  name,
const AnnotationType &  annotation 
)
inline

Set the annotation with the given name to the given value. The value may be a primitive type or a vector of a primitive type.

◆ set_annotation() [2/2]

template<typename AnnotationType , typename Annotated >
void vg::set_annotation ( Annotated *  annotated,
const string &  name,
const AnnotationType &  annotation 
)
inline

Set the annotation with the given name to the given value. The value may be a primitive type or a vector of a primitive type.

◆ set_intersection()

template<typename T >
void vg::set_intersection ( const unordered_set< T > &  set_1,
const unordered_set< T > &  set_2,
unordered_set< T > *  out_intersection 
)
inline

◆ set_score()

void vg::set_score ( GaplessExtension extension,
const Aligner aligner 
)

◆ sha1head()

const std::string vg::sha1head ( const std::string &  data,
size_t  head 
)

◆ sha1sum()

const std::string vg::sha1sum ( const std::string &  data)

◆ signature() [1/2]

string vg::signature ( const Alignment aln)

◆ signature() [2/2]

pair< string, string > vg::signature ( const Alignment aln1,
const Alignment aln2 
)

◆ simplify() [1/3]

Alignment vg::simplify ( const Alignment a,
bool  trim_internal_deletions = true 
)

Simplifies the Path in the Alignment. Note that this removes deletions at the start and end of Mappings, so code that handles simplified Alignments needs to handle offsets on internal Mappings.

◆ simplify() [2/3]

Mapping vg::simplify ( const Mapping m,
bool  trim_internal_deletions = true 
)

Merge adjacent edits of the same type, strip leading and trailing deletion edits (while updating positions if necessary), and makes sure position is actually set.

◆ simplify() [3/3]

Path vg::simplify ( const Path p,
bool  trim_internal_deletions = true 
)

Simplify the path for addition as new material in the graph. Remove any mappings that are merely single deletions, merge adjacent edits of the same type, strip leading and trailing deletion edits on mappings, and make sure no mappings have missing positions.

◆ simplify_filtered_edits()

bool vg::simplify_filtered_edits ( HandleGraph graph,
Alignment aln,
Path path,
const map< pos_t, id_t > &  node_translation,
const unordered_map< id_t, size_t > &  orig_node_sizes,
double  min_baseq = 0,
double  max_frac_n = 1. 
)

Remove edits in our graph that don't correspond to breakpoints (ie were effectively filtered out due to insufficient coverage. This way, subsequent logic in add_nodes_and_edges can be run correctly. Returns true if at least one edit survived the filter.

◆ slope()

double vg::slope ( const std::vector< double > &  x,
const std::vector< double > &  y 
)

◆ softclip_end() [1/2]

int vg::softclip_end ( const Alignment alignment)

◆ softclip_end() [2/2]

int vg::softclip_end ( const Mapping mapping)

◆ softclip_start() [1/2]

int vg::softclip_start ( const Alignment alignment)

◆ softclip_start() [2/2]

int vg::softclip_start ( const Mapping mapping)

◆ softclip_trim()

int vg::softclip_trim ( Alignment alignment)

◆ sort_by_id()

void vg::sort_by_id ( Graph graph)

order the nodes and edges in the graph by id

◆ sort_by_id_dedup_and_clean()

void vg::sort_by_id_dedup_and_clean ( Graph graph)

remove duplicates and sort by id

◆ sort_edges_by_id()

void vg::sort_edges_by_id ( Graph graph)

order the edges in the graph by id pairs

◆ sort_nodes_by_id()

void vg::sort_nodes_by_id ( Graph graph)

order the nodes in the graph by id

◆ sort_shuffling_ties() [1/2]

template<class RandomIt , class Compare >
void vg::sort_shuffling_ties ( RandomIt  begin,
RandomIt  end,
Compare  comp 
)

Sort the items between the two given random-access iterators, as with std::sort. Deterministically shuffle the ties, if any, at the top end, using automatic seed determination.

◆ sort_shuffling_ties() [2/2]

template<class RandomIt , class Compare , class MakeSeed >
void vg::sort_shuffling_ties ( RandomIt  begin,
RandomIt  end,
Compare  comp,
MakeSeed  seed 
)

Sort the items between the two given random-access iterators, as with std::sort. Deterministically shuffle the ties, if any, at the top end, using the given seed generator function.

◆ split_delims() [1/2]

std::vector< std::string > vg::split_delims ( const std::string &  s,
const std::string &  delims 
)

◆ split_delims() [2/2]

std::vector< std::string > & vg::split_delims ( const std::string &  s,
const std::string &  delims,
std::vector< std::string > &  elems 
)

◆ split_ext()

pair< string, string > vg::split_ext ( const string &  filename)

Split off the extension from a filename and return both parts.

◆ split_splice_segment()

pair<pair<Path, int32_t>, pair<Path, int32_t> > vg::split_splice_segment ( const Alignment splice_segment,
int64_t  splice_junction_idx,
const GSSWAligner scorer,
const HandleGraph graph 
)

◆ stacktrace_manually()

void vg::stacktrace_manually ( ostream &  out,
int  signalNumber,
void *  ip,
void **  bp 
)

◆ start_backward()

bool vg::start_backward ( const Chain chain)

Return true if the first snarl in the given chain is backward relative to the chain.

◆ stdev()

template<typename T >
double vg::stdev ( const T &  v)

◆ strip_from_end()

Alignment vg::strip_from_end ( const Alignment aln,
size_t  drop 
)

◆ strip_from_start()

Alignment vg::strip_from_start ( const Alignment aln,
size_t  drop 
)

◆ sub_overlaps_of_first_aln()

int vg::sub_overlaps_of_first_aln ( const vector< Alignment > &  alns,
float  overlap_fraction 
)

◆ subtract_log()

double vg::subtract_log ( double  log_x,
double  log_y 
)
inline

◆ sum()

template<typename Collection >
Collection::value_type vg::sum ( const Collection &  collection)

Compute the sum of the values in a collection. Values must be default- constructable (like numbers are).

◆ support_max()

Support vg::support_max ( const Support a,
const Support b 
)

Get the maximum support of a pair of Supports, by taking the max in each orientation.

◆ support_min()

Support vg::support_min ( const Support a,
const Support b 
)

Get the minimum support of a pair of Supports, by taking the min in each orientation.

◆ target_alignment() [1/2]

Alignment vg::target_alignment ( const PathPositionHandleGraph graph,
const string &  name,
size_t  pos1,
size_t  pos2,
const string &  feature,
bool  is_reverse 
)

Make an Alignment corresponding to a subregion of a stored path. Positions are 0-based, and pos2 is excluded. Respects path circularity, so pos2 < pos1 is not a problem. If pos1 == pos2, returns an empty alignment.

◆ target_alignment() [2/2]

Alignment vg::target_alignment ( const PathPositionHandleGraph graph,
const string &  name,
size_t  pos1,
size_t  pos2,
const string &  feature,
bool  is_reverse,
Mapping cigar_mapping 
)

Same as above, but uses the given Mapping, translated directly form a CIGAR string, as a source of edits. The edits are inserted into the generated Alignment, cut as necessary to fit into the Alignment's Mappings.

◆ thread_name()

std::string vg::thread_name ( const gbwt::GBWT &  gbwt_index,
gbwt::size_type  id 
)

Get a string representation of a thread name stored in GBWT metadata. NOTE: id is a gbwt path id, not a gbwt sequence id.

◆ thread_to_graph_spanned()

void vg::thread_to_graph_spanned ( thread_t t,
Graph g,
const HandleGraph source 
)

◆ to_alignment()

Alignment vg::to_alignment ( const SnarlTraversal trav,
const HandleGraph graph 
)
inline

Convert a snarl traversal into an alignment.

◆ to_edge()

edge_t vg::to_edge ( const HandleGraph graph,
const Visit v1,
const Visit v2 
)

Make an edge_t from a pair of visits.

◆ to_left_side()

NodeSide vg::to_left_side ( const Visit visit)
inline

Converts a Visit to a node or snarl into a NodeSide for its left side.

◆ to_length()

int vg::to_length ( const Mapping m)

◆ to_length_after_pos()

size_t vg::to_length_after_pos ( const Alignment aln,
const Position pos 
)

◆ to_length_before_pos()

size_t vg::to_length_before_pos ( const Alignment aln,
const Position pos 
)

◆ to_mapping() [1/2]

Mapping vg::to_mapping ( const Visit visit,
const HandleGraph vg 
)
inline

Converts a Visit to a Mapping. Throws an exception if the Visit is of a Snarl instead of a Node. Uses a graph to get node length.

◆ to_mapping() [2/2]

Mapping vg::to_mapping ( const Visit visit,
std::function< size_t(id_t)>  node_length 
)
inline

Converts a Visit to a Mapping. Throws an exception if the Visit is of a Snarl instead of a Node. Uses a function to get node length.

◆ to_multipath_alignment()

void vg::to_multipath_alignment ( const Alignment aln,
multipath_alignment_t multipath_aln_out 
)

Converts a Alignment into a multipath_alignment_t with one subpath and stores it in an object

Args: aln alignment to convert multipath_aln empty multipath alignment to store converted alignment in (data may be be overwritten if not empty)

◆ to_node_traversal() [1/2]

NodeTraversal vg::to_node_traversal ( const Visit visit,
const VG graph 
)
inline

Converts a Visit to a NodeTraversal. Throws an exception if the Visit is of a Snarl instead of a Node

◆ to_node_traversal() [2/2]

NodeTraversal vg::to_node_traversal ( const Visit visit,
VG graph 
)
inline

◆ to_proto_edit()

void vg::to_proto_edit ( const edit_t edit,
Edit proto_edit 
)

◆ to_proto_mapping()

void vg::to_proto_mapping ( const path_mapping_t mapping,
Mapping proto_mapping 
)

◆ to_proto_multipath_alignment()

void vg::to_proto_multipath_alignment ( const multipath_alignment_t multipath_aln,
MultipathAlignment proto_multipath_aln_out 
)

Convert an STL-based multipath_alignment_t to a protobuf MultipathAlignment.

◆ to_proto_path()

void vg::to_proto_path ( const path_t path,
Path proto_path 
)

◆ to_rev_node_traversal() [1/2]

NodeTraversal vg::to_rev_node_traversal ( const Visit visit,
const VG graph 
)
inline

Converts a Visit to a NodeTraversal in the opposite orientation. Throws an exception if the Visit is of a Snarl instead of a Node

◆ to_rev_node_traversal() [2/2]

NodeTraversal vg::to_rev_node_traversal ( const Visit visit,
VG graph 
)
inline

◆ to_rev_visit()

Visit vg::to_rev_visit ( const NodeTraversal node_traversal)
inline

Converts a NodeTraversal to a Visit in the opposite orientation.

◆ to_right_side()

NodeSide vg::to_right_side ( const Visit visit)
inline

Converts a Visit to a node or snarl into a NodeSide for its right side.

◆ to_string() [1/2]

string vg::to_string ( const HandleGraph graph,
edge_t  edge 
)
inline

◆ to_string() [2/2]

string vg::to_string ( const HandleGraph graph,
handle_t  handle 
)
inline

◆ to_vcf_genotype()

string vg::to_vcf_genotype ( const Genotype gt)

Get a VCF-style 1/2, 1|2|3, etc. string from a Genotype.

◆ to_visit() [1/5]

Visit vg::to_visit ( const handlegraph::HandleGraph graph,
const handle_t handle 
)
inline

Make a Visit from a handle in a HandleGraph.

◆ to_visit() [2/5]

Visit vg::to_visit ( const Mapping mapping,
bool  make_full_node_match = false 
)
inline

Converts a Mapping to a Visit. The mapping must represent a full node match. If make_full_node_match is true, the mapping will automatically be made a full node match during the conversion process.

◆ to_visit() [3/5]

Visit vg::to_visit ( const NodeTraversal node_traversal)
inline

Converts a NodeTraversal to a Visit.

◆ to_visit() [4/5]

Visit vg::to_visit ( const Snarl snarl)
inline

Make a Visit from a snarl to traverse.

◆ to_visit() [5/5]

Visit vg::to_visit ( id_t  node_id,
bool  is_reverse 
)
inline

Make a Visit from a node ID and an orientation.

◆ topologically_order_subpaths()

void vg::topologically_order_subpaths ( multipath_alignment_t multipath_aln)

Put subpaths in topological order (assumed to be true for other algorithms)

◆ total()

double vg::total ( const Support support)

Get the total read support in a Support.

◆ toUppercase()

string vg::toUppercase ( const string &  s)

◆ trace_haplotypes_and_paths()

void vg::trace_haplotypes_and_paths ( const PathHandleGraph source,
const gbwt::GBWT &  haplotype_database,
vg::id_t  start_node,
int  extend_distance,
Graph out_graph,
map< string, int > &  out_thread_frequencies,
bool  expand_graph 
)

◆ trace_path()

pair< tuple< int64_t, int64_t, int64_t, int64_t >, tuple< int64_t, int64_t, int64_t > > vg::trace_path ( const multipath_alignment_t multipath_aln,
const Path path,
int64_t  subpath_idx,
int64_t  mapping_idx,
int64_t  edit_idx,
int64_t  base_idx 
)

◆ transfer_boundary_info()

void vg::transfer_boundary_info ( const Snarl from,
Snarl to 
)
inline

Copies the boundary Visits from one Snarl into another.

◆ transfer_from_proto_annotation()

template<class ProtoAlignment >
void vg::transfer_from_proto_annotation ( const ProtoAlignment &  from,
multipath_alignment_t to 
)

◆ transfer_proto_metadata() [1/2]

void vg::transfer_proto_metadata ( const Alignment from,
MultipathAlignment to 
)

◆ transfer_proto_metadata() [2/2]

void vg::transfer_proto_metadata ( const MultipathAlignment from,
Alignment to 
)

◆ transfer_read_metadata() [1/6]

void vg::transfer_read_metadata ( const Alignment from,
Alignment to 
)

Copies metadata from an Alignment object and transfers it to another Alignment

Args: from copy metadata from this to into this

◆ transfer_read_metadata() [2/6]

void vg::transfer_read_metadata ( const Alignment from,
multipath_alignment_t to 
)

Copies metadata from an Alignment object and transfers it to a multipath_alignment_t

Args: from copy metadata from this to into this

◆ transfer_read_metadata() [3/6]

void vg::transfer_read_metadata ( const multipath_alignment_t from,
Alignment to 
)

Copies metadata from an multipath_alignment_t object and transfers it to a Alignment

Args: from copy metadata from this to into this

◆ transfer_read_metadata() [4/6]

void vg::transfer_read_metadata ( const multipath_alignment_t from,
multipath_alignment_t to 
)

Copies metadata from an multipath_alignment_t object and transfers it to another multipath_alignment_t

Args: from copy metadata from this to into this

◆ transfer_read_metadata() [5/6]

void vg::transfer_read_metadata ( const multipath_alignment_t from,
MultipathAlignment to 
)

◆ transfer_read_metadata() [6/6]

void vg::transfer_read_metadata ( const MultipathAlignment from,
multipath_alignment_t to 
)

◆ transfer_to_proto_annotation()

template<class ProtoAlignment >
void vg::transfer_to_proto_annotation ( const multipath_alignment_t from,
ProtoAlignment &  to 
)

◆ translate_mems()

vector< MaximalExactMatch > vg::translate_mems ( const vector< MaximalExactMatch > &  mems,
const unordered_map< id_t, pair< id_t, bool > > &  trans 
)

◆ translate_node_ids() [1/3]

void vg::translate_node_ids ( Path path,
const unordered_map< id_t, id_t > &  translator 
)

Switches the node ids in the path to the ones indicated by the translator.

◆ translate_node_ids() [2/3]

void vg::translate_node_ids ( Path path,
const unordered_map< id_t, id_t > &  translator,
id_t  cut_node,
size_t  bases_removed,
bool  from_right 
)

Replaces the node IDs in the path with the ones indicated by the translator. Supports a single cut node in the source graph, where the given number of bases of the given node were removed from its left or right side when making the source graph from the destination graph.

◆ translate_node_ids() [3/3]

void vg::translate_node_ids ( path_t path,
const unordered_map< id_t, id_t > &  translator 
)

◆ translate_nodes()

void vg::translate_nodes ( Alignment a,
const unordered_map< id_t, pair< id_t, bool > > &  ids,
const std::function< size_t(int64_t)> &  node_length 
)

◆ translate_oriented_node_ids() [1/4]

void vg::translate_oriented_node_ids ( Path path,
const function< pair< id_t, bool >(id_t)> &  translator 
)

Switches node ids and orientations in the path to the ones indicated by the translator.

◆ translate_oriented_node_ids() [2/4]

void vg::translate_oriented_node_ids ( Path path,
const unordered_map< id_t, pair< id_t, bool >> &  translator 
)

Switches the node ids and orientations in the path to the ones indicated by the translator.

◆ translate_oriented_node_ids() [3/4]

void vg::translate_oriented_node_ids ( path_t path,
const function< pair< id_t, bool >(id_t)> &  translator 
)

◆ translate_oriented_node_ids() [4/4]

void vg::translate_oriented_node_ids ( path_t path,
const unordered_map< id_t, pair< id_t, bool >> &  translator 
)

◆ transpose()

vector< vector< double > > vg::transpose ( const vector< vector< double >> &  A)

A shitty set of linear algebra functions.

◆ traversal_to_string()

string vg::traversal_to_string ( VG graph,
const SnarlTraversal path 
)

Make a SnarlTraversal into the string it represents, including notes for nested child snarls.

◆ trim_alignment()

Alignment vg::trim_alignment ( const Alignment aln,
const Position pos1,
const Position pos2 
)

◆ trim_hanging_ends()

Path vg::trim_hanging_ends ( const Path p)

◆ trim_mismatches()

bool vg::trim_mismatches ( GaplessExtension extension,
const gbwtgraph::CachedGBWTGraph &  graph,
const Aligner aligner 
)

◆ trim_path()

bool vg::trim_path ( path_t path,
bool  from_left,
int64_t  mapping_idx,
int64_t  edit_idx,
int64_t  base_idx 
)

◆ trimmed_end()

tuple< pos_t, int64_t, int32_t > vg::trimmed_end ( const Alignment aln,
int64_t  len,
bool  from_end,
const HandleGraph graph,
const GSSWAligner aligner 
)

◆ uses_Us()

bool vg::uses_Us ( const Alignment alignment)

Returns true if the alignment sequence contains any U's and false if the alignment sequence contains and T's. In the case that both T's and U's are included, responds according to whichever comes first. If the sequence contains neither U's nor T's, returns false.

◆ validate_multipath_alignment()

bool vg::validate_multipath_alignment ( const multipath_alignment_t multipath_aln,
const HandleGraph handle_graph 
)

Debugging function to check that multipath alignment meets the formalism's basic invariants. Returns true if multipath alignment is valid, else false. Does not validate alignment score.

◆ value_cast() [1/4]

template<typename Container >
google::protobuf::Value vg::value_cast ( const Container &  wrap)
inline

◆ value_cast() [2/4]

template<typename T >
T vg::value_cast ( const google::protobuf::Value &  value)
inline

Cast a Protobuf generic Value to any type.

◆ value_cast() [3/4]

template<typename Container >
Container vg::value_cast ( const google::protobuf::Value &  value)
inline

Cast a Protobuf generic Value to any type.

◆ value_cast() [4/4]

template<typename T >
google::protobuf::Value vg::value_cast ( const T &  wrap)
inline

Cast any type to a generic Protobuf value.

◆ value_cast< bool >() [1/2]

template<>
google::protobuf::Value vg::value_cast< bool > ( const bool &  wrap)
inline

◆ value_cast< bool >() [2/2]

template<>
bool vg::value_cast< bool > ( const google::protobuf::Value &  value)
inline

◆ value_cast< double >() [1/2]

template<>
google::protobuf::Value vg::value_cast< double > ( const double &  wrap)
inline

◆ value_cast< double >() [2/2]

template<>
double vg::value_cast< double > ( const google::protobuf::Value &  value)
inline

◆ value_cast< int >()

template<>
google::protobuf::Value vg::value_cast< int > ( const int &  wrap)
inline

◆ value_cast< size_t >()

template<>
google::protobuf::Value vg::value_cast< size_t > ( const size_t &  wrap)
inline

◆ value_cast< string >() [1/2]

template<>
string vg::value_cast< string > ( const google::protobuf::Value &  value)
inline

◆ value_cast< string >() [2/2]

template<>
google::protobuf::Value vg::value_cast< string > ( const string &  wrap)
inline

◆ variant_recall()

void vg::variant_recall ( VG graph,
vcflib::VariantCallFile *  vars,
FastaReference *  ref_genome,
vector< FastaReference * >  insertions,
string  gamfile,
bool  isIndex 
)

run with : vg genotype -L -V v.vcf -I i.fa -R ref.fa

◆ verify_path()

template<class PathType >
bool vg::verify_path ( const PathType &  path,
MutableHandleGraph unfolded,
const hash_map< vg::id_t, std::vector< vg::id_t >> &  reverse_mapping 
)

◆ view_multipath_alignment()

void vg::view_multipath_alignment ( ostream &  out,
const multipath_alignment_t multipath_aln,
const HandleGraph handle_graph 
)

Send a formatted string representation of the multipath_alignment_t into the ostream.

◆ view_multipath_alignment_as_dot()

void vg::view_multipath_alignment_as_dot ( ostream &  out,
const multipath_alignment_t multipath_aln,
bool  show_graph 
)

Converts a multipath_alignment_t to a GraphViz Dot representation, output to the given ostream.

◆ vpmax()

template<typename T >
vector<T> vg::vpmax ( const std::vector< std::vector< T >> &  vv)

◆ wang_hash_64()

size_t vg::wang_hash_64 ( size_t  key)
inline

Thomas Wang's integer hash function. In many implementations, std::hash is identity function for integers, which leads to performance issues.

◆ weibull_cdf()

double vg::weibull_cdf ( double  x,
double  scale,
double  shape,
double  location = 0.0 
)
inline

Return the CDF of a max exponential with the given parameters.

◆ weibull_log_likelihood()

double vg::weibull_log_likelihood ( const vector< double > &  x,
double  scale,
double  shape,
double  location 
)

Returns the log likelihood of some data generated by a Weibull distribution.

◆ wellford_mean_var()

pair< double, double > vg::wellford_mean_var ( size_t  count,
double  mean,
double  M2,
bool  sample_variance 
)

◆ wellford_update()

void vg::wellford_update ( size_t &  count,
double &  mean,
double &  M2,
double  new_val 
)

◆ wrap_text()

string vg::wrap_text ( const string &  str,
size_t  width 
)

◆ write_alignment_to_file()

void vg::write_alignment_to_file ( const Alignment aln,
const string &  filename 
)

◆ write_fasta_sequence()

void vg::write_fasta_sequence ( const std::string &  name,
const std::string &  sequence,
ostream &  os,
size_t  width 
)

◆ write_gcsa_kmers()

void vg::write_gcsa_kmers ( const HandleGraph graph,
int  kmer_size,
ostream &  out,
size_t &  size_limit,
id_t  head_id,
id_t  tail_id 
)

Write GCSA2 formatted binary KMers to the given ostream. size_limit is the maximum size of the kmer file in bytes. When the function returns, size_limit is the size of the kmer file in bytes.

◆ write_gcsa_kmers_to_tmpfile()

string vg::write_gcsa_kmers_to_tmpfile ( const HandleGraph graph,
int  kmer_size,
size_t &  size_limit,
id_t  head_id,
id_t  tail_id,
const string &  base_file_name = "vg-kmers-tmp-" 
)

Open a tempfile and write the kmers to it. The calling context should remove it with temp_file::remove().

Variable Documentation

◆ BAM_DNA_LOOKUP

const char* const vg::BAM_DNA_LOOKUP = "=ACMGRSVTWYHKDBN"

◆ fullTrace

bool vg::fullTrace = false

◆ PRUNE_THREAD_BUFFER_SIZE

constexpr size_t vg::PRUNE_THREAD_BUFFER_SIZE = 1024 * 1024
constexpr

◆ var

const char* vg::var = "VG_FULL_TRACEBACK"