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

Namespaces

 algorithms
 
 io
 
 subcommand
 
 temp_file
 

Classes

class  AbstractReadSampler
 
class  AliasGraph
 
class  Aligner
 
class  AlignerClient
 
struct  Alignment
 
struct  alignment_index_t
 
class  AlignmentChainModel
 
class  AlignmentChainModelVertex
 
struct  AlignmentValidity
 
struct  Annotation
 
struct  AppendHaplotypeCommand
 
struct  AugmentedGraph
 
class  BackTranslatingAlignmentEmitter
 
class  BandedGlobalAligner
 
class  BaseAligner
 
class  BaseMapper
 
class  BaseOption
 
struct  BasePileup
 
struct  BBEdgeHash
 
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  ContractingGraph
 
class  count_back_inserter
 
struct  Counts
 
class  DagifiedGraph
 
class  Deconstructor
 
struct  DeleteHaplotypeCommand
 
class  DeletionAligner
 
class  DiagramExplainer
 
class  DinucleotideMachine
 
class  discrete_distribution
 We provide a partial discrete_distribution implementation that is just the parts we need. More...
 
class  DistanceHeuristic
 
class  DotDumpExplainer
 
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  Explainer
 
class  ExtraNodeGraph
 
class  FeatureSet
 
class  Filter
 
class  FixedGenotypePriorCalculator
 
class  FlatFileBackTranslation
 
class  FlowCaller
 
class  FlowSort
 
class  FlowTraversalFinder
 
class  FragmentLengthDistribution
 
class  FragmentLengthStatistics
 
class  Funnel
 
class  GAFOutputCaller
 
class  GaplessExtender
 
struct  GaplessExtension
 
struct  GBWTHandler
 
class  GBWTTraversalFinder
 
class  GBZGraph
 
class  GenomeState
 
struct  GenomeStateCommand
 
struct  Genotype
 Describes a genotype at a particular locus. More...
 
class  GenotypeLikelihoodCalculator
 
class  GenotypePriorCalculator
 
class  Genotyper
 
class  GFAHandleGraph
 Use to load in GFAs and remember where they came from. More...
 
class  GFFReader
 
struct  GFFRecord
 
struct  Graph
 
class  GraphCaller
 
class  GraphSynchronizer
 
class  GreedyMinDistanceClusterer
 
class  GSSWAligner
 
class  HandleGraphNodeSet
 
class  HandleGraphSnarlFinder
 
class  HaplotypeIndexer
 
class  HaplotypePartitioner
 
class  Haplotypes
 
class  hash_map
 
class  hash_map< K *, V >
 
class  hash_set
 
class  hash_set< K * >
 
class  HTSAlignmentEmitter
 
class  HTSWriter
 
class  IdentityOverlay
 
struct  IDScanner
 
class  IncrementalSubgraph
 
struct  IncrementIter
 
class  IndexedVG
 
class  IndexFile
 
struct  IndexingParameters
 
class  IndexingPlan
 
struct  IndexRecipe
 
class  IndexRegistry
 
struct  InsertHaplotypeCommand
 
class  InsufficientInputException
 
class  IntegratedSnarlFinder
 
struct  is_instantiation_of
 
struct  is_instantiation_of< Predicate< PredicateArgs... >, Predicate >
 
class  JobSchedule
 
class  JoinedSpliceGraph
 
struct  kff_recoding_t
 A mapping of character values from KFF encoding to minimizer index encoding. More...
 
struct  kmer_t
 
struct  KmerMatch
 Used to serialize kmer matches. More...
 
struct  KmerPosition
 
class  LazyRNG
 
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
 
struct  MappingHash
 
struct  MatchPos
 
class  MaximalExactMatch
 
class  MCMCCaller
 
class  MCMCGenotyper
 
class  MEMAccelerator
 
class  MEMChainModel
 
class  MEMChainModelVertex
 
class  MEMClusterer
 
class  MemoizingGraph
 
class  MinDistanceClusterer
 
class  MinimizerMapper
 
struct  MIPayload
 
struct  MIPayloadValues
 
class  MSAConverter
 
class  multipath_alignment_t
 
struct  MultipathAlignment
 
class  MultipathAlignmentEmitter
 
class  MultipathAlignmentGraph
 
class  MultipathMapper
 
struct  MultipathProblem
 
class  NameMapper
 
class  NestedCachedPackedTraversalSupportFinder
 
class  NestedFlowCaller
 
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
 
class  ParallelKFFReader
 
struct  ParentGenotypeInfo
 
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  ProblemDumpExplainer
 
class  Progressive
 
class  QualAdjAligner
 
class  QualAdjXdropAligner
 
struct  Range
 
class  RareVariantSimplifier
 
class  RatioSupportSnarlCaller
 
struct  read_alignment_index_t
 Type to point to an alignment of a known read. More...
 
class  ReadFilter
 
class  ReadMasker
 
class  ReadRestrictedTraversalFinder
 
struct  RebuildJob
 
struct  RebuildParameters
 Parameters for rebuild_gbwt. More...
 
class  Recombinator
 
struct  RecombinatorHaplotype
 
struct  Region
 
class  RegionExpander
 
struct  ReplaceLocalHaplotypeCommand
 
struct  ReplaceSnarlHaplotypeCommand
 
class  RepresentativeTraversalFinder
 
class  ReverseGraph
 
class  RewindPlanException
 
class  Sampler
 
struct  SeqComplexity
 
class  ShuffledPairs
 
class  SimpleConsistencyCalculator
 
class  SimpleTraversalSupportCalculator
 
class  SizeLimitExceededException
 
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  SnarlDistanceIndexClusterer
 
class  SnarlFinder
 
class  SnarlGraph
 
class  SnarlManager
 
class  SnarlMinDistance
 
class  SnarlOrientedDistanceMeasurer
 
class  SnarlState
 
struct  SnarlTraversal
 
class  SourceSinkOverlay
 
class  SparseUnionFind
 
class  SplicedHTSAlignmentEmitter
 
class  SpliceRegion
 
class  SpliceStats
 
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
 
class  SubpathOverlay
 
struct  SummaryStatistics
 
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  SurjectingAlignmentEmitter
 
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  truncated_normal_distribution
 
class  TVSClusterer
 
class  uniform_int_distribution
 
class  uniform_real_distribution
 
class  VariantAdder
 
class  VcfBuffer
 
class  VCFGenotyper
 
class  VCFOutputCaller
 
class  VcfRecordConverter
 
class  VcfRecordFilter
 
class  VCFTraversalFinder
 
struct  VectorView
 
class  VectorViewInverse
 
class  Version
 Class for holding vg version and build environment information. More...
 
class  VG
 
struct  VGIndexes
 
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  wang_hash
 
struct  wang_hash< handle_t >
 
struct  wang_hash< handlegraph::net_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
 
struct  WFAAlignment
 
class  WFAExtender
 
struct  WFANode
 
struct  WFAPoint
 
class  WFATree
 
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 offset_t = handlegraph::offset_t
 
using subrange_t = handlegraph::subrange_t
 
using path_handle_t = handlegraph::path_handle_t
 
using PathSense = handlegraph::PathSense
 
using step_handle_t = handlegraph::step_handle_t
 
using edge_t = handlegraph::edge_t
 
using oriented_node_range_t = handlegraph::oriented_node_range_t
 
using HandleGraph = handlegraph::HandleGraph
 
using RankedHandleGraph = handlegraph::RankedHandleGraph
 
using MutableHandleGraph = handlegraph::MutableHandleGraph
 
using PathMetadata = handlegraph::PathMetadata
 
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 NamedNodeBackTranslation = handlegraph::NamedNodeBackTranslation
 
using thread_t = vector< gbwt::node_type >
 
using IndexName = string
 
using IndexGroup = set< IndexName >
 
using RecipeName = pair< IndexGroup, size_t >
 
using RecipeFunc = function< vector< vector< string > >(const vector< const IndexFile * > &, const IndexingPlan *, AliasGraph &, const IndexGroup &)>
 
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
 
using Traversal = vector< handle_t >
 
using PathInterval = pair< step_handle_t, step_handle_t >
 
typedef handlegraph::nid_t id_t
 
typedef std::tuple< id_t, bool, offset_tpos_t
 

Enumerations

enum  alignment_emitter_flags_t {
  ALIGNMENT_EMITTER_FLAG_NONE = 0, ALIGNMENT_EMITTER_FLAG_HTS_RAW = 1, ALIGNMENT_EMITTER_FLAG_HTS_SPLICED = 2, ALIGNMENT_EMITTER_FLAG_HTS_PRUNE_SUSPICIOUS_ANCHORS = 4,
  ALIGNMENT_EMITTER_FLAG_VG_USE_SEGMENT_NAMES = 8
}
 
enum  MappingQualityMethod { Approx, Exact, Adaptive, None }
 
enum  SnarlType { UNCLASSIFIED = 0, ULTRABUBBLE = 1, UNARY = 2 }
 Enumeration of the classifications of snarls. More...
 

Functions

int32_t score_gap (size_t gap_length, int32_t gap_open, int32_t gap_extension)
 Score a gap with the given open and extension scores. More...
 
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, const map< string, int64_t > &path_length, const map< string, string > &rg_sample)
 
bam_hdr_t * hts_string_header (string &header, const vector< pair< string, int64_t >> &path_order_and_length, const 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, uint64_t batch_size)
 
size_t fastq_paired_interleaved_for_each_parallel (const string &filename, function< void(Alignment &, Alignment &)> lambda, uint64_t batch_size)
 
size_t fastq_paired_two_files_for_each_parallel (const string &file1, const string &file2, function< void(Alignment &, Alignment &)> lambda, uint64_t batch_size)
 
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, uint64_t batch_size)
 
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, uint64_t batch_size)
 
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)
 Populate a mapping from read group to sample name, given the text BAM header. More...
 
void parse_tid_path_handle_map (const bam_hdr_t *hts_header, const PathHandleGraph *graph, map< int, path_handle_t > &tid_path_handle)
 
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 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, const path_handle_t &path, 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)
 
void simplify_cigar (vector< pair< int, char >> &cigar)
 
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, const map< string, string > &rg_sample, const map< int, path_handle_t > &tid_path_handle, const bam_hdr_t *bh, const PathPositionHandleGraph *graph)
 
Alignment bam_to_alignment (const bam1_t *b, const map< string, string > &rg_sample, const map< int, path_handle_t > &tid_path_handle)
 
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, const unordered_map< string, string > *translation)
 
void alignment_set_distance_to_correct (Alignment &aln, const map< string, vector< pair< size_t, bool > > > &base_offsets, const unordered_map< string, string > *translation)
 
AlignmentValidity alignment_is_valid (const Alignment &aln, const HandleGraph *hgraph)
 
Alignment target_alignment (const PathPositionHandleGraph *graph, const path_handle_t &path, size_t pos1, size_t pos2, const string &feature, bool is_reverse, Mapping &cigar_mapping)
 
Alignment target_alignment (const PathPositionHandleGraph *graph, const path_handle_t &path, 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 append_cigar_operation (const int length, const char operation, vector< pair< int, char >> &cigar)
 
void alignment_set_distance_to_correct (Alignment &aln, const map< string, vector< pair< size_t, bool >>> &base_offsets, const unordered_map< string, string > *translation=nullptr)
 
template<typename Annotated >
bool has_annotation (const Annotated &annotated, const string &name)
 Returns true if the Protobuf object has an annotation with this name. More...
 
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, bool edges_only)
 
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, bool edges_only)
 
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, bool edges_only)
 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...
 
void add_edges_only (MutableHandleGraph *graph, function< void(function< void(Alignment &)>, bool, bool)> iterate_gam, double min_mapq, size_t min_bp_coverage)
 
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)
 
void visit_contained_snarls (const PathPositionHandleGraph *graph, const vector< Region > &regions, SnarlManager &snarl_manager, bool include_endpoints, function< void(const Snarl *, step_handle_t, step_handle_t, int64_t, int64_t, bool, const Region *)> visit_fn)
 
void delete_nodes_and_chop_paths (MutablePathMutableHandleGraph *graph, const unordered_set< nid_t > &nodes_to_delete, const unordered_set< edge_t > &edges_to_delete, int64_t min_fragment_len, unordered_map< string, size_t > *fragments_per_path)
 
void clip_contained_snarls (MutablePathMutableHandleGraph *graph, PathPositionHandleGraph *pp_graph, const vector< Region > &regions, SnarlManager &snarl_manager, bool include_endpoints, int64_t min_fragment_len, size_t max_nodes, size_t max_edges, size_t max_nodes_shallow, size_t max_edges_shallow, double max_avg_degree, double max_reflen_prop, size_t max_reflen, bool out_bed, bool verbose)
 
void clip_low_depth_nodes_and_edges_generic (MutablePathMutableHandleGraph *graph, function< void(function< void(handle_t, const Region *)>)> iterate_handles, function< void(function< void(edge_t, const Region *)>)> iterate_edges, int64_t min_depth, const vector< string > &ref_prefixes, int64_t min_fragment_len, bool verbose)
 
void clip_low_depth_nodes_and_edges (MutablePathMutableHandleGraph *graph, int64_t min_depth, const vector< string > &ref_prefixes, int64_t min_fragment_len, bool verbose)
 
void clip_contained_low_depth_nodes_and_edges (MutablePathMutableHandleGraph *graph, PathPositionHandleGraph *pp_graph, const vector< Region > &regions, SnarlManager &snarl_manager, bool include_endpoints, int64_t min_depth, int64_t min_fragment_len, bool verbose)
 
void clip_deletion_edges (MutablePathMutableHandleGraph *graph, int64_t max_deletion, int64_t context_steps, const vector< string > &ref_prefixes, int64_t min_fragment_len, bool verbose)
 
void clip_stubs_generic (MutablePathMutableHandleGraph *graph, function< void(function< void(handle_t, const Region *)>)> iterate_handles, function< bool(handle_t)> handle_in_range, const vector< string > &ref_prefixes, int64_t min_fragment_len, bool verbose)
 
void clip_stubs (MutablePathMutableHandleGraph *graph, const vector< string > &ref_prefixes, int64_t min_fragment_len, bool verbose)
 
void clip_contained_stubs (MutablePathMutableHandleGraph *graph, PathPositionHandleGraph *pp_graph, const vector< Region > &regions, SnarlManager &snarl_manager, bool include_endpoints, int64_t min_fragment_len, bool verbose)
 
void stubbify_ref_paths (MutablePathMutableHandleGraph *graph, const vector< string > &ref_prefixes, int64_t min_fragment_len, bool verbose)
 
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...
 
void set_crash_context (const std::string &message)
 User code should call this when it has context for a failure in its thread. More...
 
void clear_crash_context ()
 User code should call this when it wants to clear context for a failure in its thread. More...
 
void with_exception_handling (const std::function< void(void)> &body)
 User code should call this to get all its exceptions handled. More...
 
void report_exception (const std::exception &ex)
 
void crash_unless_impl (bool condition, const std::string &condition_string, const std::string &file, int line, const std::string &function)
 crash_unless calls into this function for a real implementation. More...
 
double entropy (const string &st)
 
double entropy (const char *st, size_t len)
 
std::ostream & operator<< (std::ostream &out, const Funnel::State &state)
 
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::view_type target)
 
size_t match_forward (GaplessExtension &match, const std::string &seq, gbwtgraph::view_type target, uint32_t mismatch_limit)
 
void match_backward (GaplessExtension &match, const std::string &seq, 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::ostream & operator<< (std::ostream &out, const WFAAlignment::Edit &edit)
 Allow printing an Edit. More...
 
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. If the path does not exist, it is treated as empty. 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, const std::string &header="GBWT")
 Finish GBWT construction and optionally print the metadata. More...
 
void load_gbwt (gbwt::GBWT &index, const std::string &filename, bool show_progress=false)
 Load a compressed GBWT from the file. More...
 
void load_gbwt (gbwt::DynamicGBWT &index, const std::string &filename, bool show_progress=false)
 Load a dynamic GBWT from the file. More...
 
void load_r_index (gbwt::FastLocate &index, const std::string &filename, bool show_progress=false)
 Load an r-index from the file. More...
 
void save_gbwt (const gbwt::GBWT &index, const std::string &filename, bool show_progress=false)
 Save a compressed GBWT to the file. More...
 
void save_gbwt (const gbwt::DynamicGBWT &index, const std::string &filename, bool show_progress=false)
 Save a dynamic GBWT to the file. More...
 
void save_r_index (const gbwt::FastLocate &index, const std::string &filename, bool show_progress=false)
 Save an r-index to the file. More...
 
std::vector< std::vector< gbwt::size_type > > partition_gbwt_sequences (const gbwt::GBWT &gbwt_index, const std::unordered_map< nid_t, size_t > &node_to_job, size_t num_jobs)
 
gbwt::GBWT rebuild_gbwt_job (const gbwt::GBWT &gbwt_index, const RebuildJob &job, size_t job_id, const std::vector< gbwt::size_type > &sequences, const RebuildParameters &parameters)
 
void copy_metadata (const gbwt::GBWT &source, gbwt::GBWT &target, const std::vector< std::vector< gbwt::size_type >> &jobs, const std::vector< size_t > &job_order)
 
gbwt::GBWT rebuild_gbwt (const gbwt::GBWT &gbwt_index, const std::vector< RebuildJob > &jobs, const std::unordered_map< nid_t, size_t > &node_to_job, const RebuildParameters &parameters)
 
gbwt::GBWT rebuild_gbwt (const gbwt::GBWT &gbwt_index, const std::vector< RebuildJob::mapping_type > &mappings)
 As the general rebuild_gbwt, but always using a single job with default parameters. More...
 
std::vector< gbwt::size_type > threads_for_sample (const gbwt::GBWT &gbwt_index, const std::string &sample_name)
 Return the list of thread ids / gbwt path ids for the given sample. More...
 
std::vector< gbwt::size_type > threads_for_contig (const gbwt::GBWT &gbwt_index, const std::string &contig_name)
 Return the list of thread ids / gbwt path ids for the given contig. More...
 
std::string insert_gbwt_path (MutablePathHandleGraph &graph, const gbwt::GBWT &gbwt_index, gbwt::size_type id, std::string path_name)
 
Path extract_gbwt_path (const HandleGraph &graph, const gbwt::GBWT &gbwt_index, gbwt::size_type id)
 
std::string compose_short_path_name (const gbwt::GBWT &gbwt_index, gbwt::size_type id)
 
void copy_reference_samples (const gbwt::GBWT &source, gbwt::GBWT &destination)
 Copies the reference sample tag from the source GBWT index to the destination GBWT index. More...
 
void copy_reference_samples (const PathHandleGraph &source, gbwt::GBWT &destination)
 
gbwt::GBWT get_gbwt (const std::vector< gbwt::vector_type > &paths)
 Transform the paths into a GBWT index. Primarily for testing. More...
 
unordered_map< string, vector< nid_t > > load_translation_map (ifstream &input_stream)
 
unordered_map< nid_t, pair< string, size_t > > load_translation_back_map (HandleGraph &graph, ifstream &input_stream)
 
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...
 
gbwtgraph::GFAParsingParameters get_best_gbwtgraph_gfa_parsing_parameters ()
 
void load_gbwtgraph (gbwtgraph::GBWTGraph &graph, const std::string &filename, bool show_progress)
 
void load_gbz (gbwtgraph::GBZ &gbz, const std::string &filename, bool show_progress=false)
 Load GBZ from the file. More...
 
void load_gbz (gbwt::GBWT &index, gbwtgraph::GBWTGraph &graph, const std::string &filename, bool show_progress=false)
 Load GBWT and GBWTGraph from the GBZ file. More...
 
void load_gbz (gbwtgraph::GBZ &gbz, const std::string &gbwt_name, const std::string &graph_name, bool show_progress=false)
 Load GBZ from separate GBWT / GBWTGraph files. More...
 
void load_minimizer (gbwtgraph::DefaultMinimizerIndex &index, const std::string &filename, bool show_progress=false)
 Load a minimizer index from the file. More...
 
void save_gbwtgraph (const gbwtgraph::GBWTGraph &graph, const std::string &filename, bool show_progress=false)
 Save GBWTGraph to the file. More...
 
void save_gbz (const gbwtgraph::GBZ &gbz, const std::string &filename, bool show_progress=false)
 Save GBZ to the file. More...
 
void save_gbz (const gbwt::GBWT &index, gbwtgraph::GBWTGraph &graph, const std::string &filename, bool show_progress=false)
 Save GBWT and GBWTGraph to the GBZ file. More...
 
void save_gbz (const gbwtgraph::GBZ &gbz, const std::string &gbwt_name, const std::string &graph_name, bool show_progress=false)
 Save GBZ to separate GBWT / GBWTGraph files. More...
 
void save_minimizer (const gbwtgraph::DefaultMinimizerIndex &index, const std::string &filename, bool show_progress=false)
 Save a minimizer index to the file. More...
 
unordered_map< string, vector< nid_t > > load_translation_map (const gbwtgraph::GBWTGraph &graph)
 Return a mapping of the original segment ids to a list of chopped node ids. More...
 
unordered_map< nid_t, pair< string, size_t > > load_translation_back_map (const gbwtgraph::GBWTGraph &graph)
 Return a backwards mapping of chopped node to original segment position (id,offset pair) More...
 
std::string to_string_gbwtgraph (handle_t handle)
 Returns a string representation of a GBWTGraph handle. More...
 
std::string to_string_gbwtgraph (gbwt::node_type node)
 Returns a string representation of a GBWTGraph node. More...
 
handle_t empty_gbwtgraph_handle ()
 Returns an empty GBWTGraph handle corresponding to the GBWT endmarker. More...
 
void load_gcsa (gcsa::GCSA &index, const std::string &filename, bool show_progress=false)
 Load GCSA from the file. More...
 
void load_lcp (gcsa::LCPArray &lcp, const std::string &filename, bool show_progress=false)
 Load LCP array from the file. More...
 
void save_gcsa (const gcsa::GCSA &index, const std::string &filename, bool show_progress=false)
 Save GCSA to the file. More...
 
void save_lcp (const gcsa::LCPArray &lcp, const std::string &filename, bool show_progress=false)
 Save LCP array to the file. 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 PathHandleGraph *graph, ostream &out, const set< string > &rgfa_paths, bool rgfa_pline, bool use_w_lines)
 
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< vector< gbwt::node_type >, gbwt::SearchState > > list_haplotypes (const HandleGraph &graph, const gbwt::GBWT &gbwt, handle_t start, function< bool(const vector< gbwt::node_type > &)> stop_fn)
 
unique_ptr< AlignmentEmitterget_alignment_emitter (const string &filename, const string &format, const vector< tuple< path_handle_t, size_t, size_t >> &paths, size_t max_threads, const HandleGraph *graph, int flags)
 
pair< vector< pair< string, int64_t > >, unordered_map< string, int64_t > > extract_path_metadata (const vector< tuple< path_handle_t, size_t, size_t >> &paths, const PathPositionHandleGraph &graph, bool subpath_support)
 
vector< tuple< path_handle_t, size_t, size_t > > get_sequence_dictionary (const string &filename, const vector< string > &path_names, const PathPositionHandleGraph &graph)
 
void copy_file (const string &from_fp, const string &to_fp)
 
int64_t get_file_size (const string &filename)
 
bool is_gzipped (const string &filename)
 
int64_t get_num_samples (const string &vcf_filename)
 
double approx_num_vars (const string &vcf_filename)
 
double format_multiplier ()
 
int64_t approx_graph_memory (const vector< string > &fasta_filenames, const vector< string > &vcf_filenames)
 
vector< int64_t > each_approx_graph_memory (const vector< string > &fasta_filenames, const vector< string > &vcf_filenames)
 
int64_t approx_graph_memory (const string &fasta_filename, const string &vcf_filename)
 
int64_t approx_graph_memory (const string &gfa_filename)
 
int64_t approx_gbwt_memory (const string &vcf_filename)
 
int64_t approx_graph_load_memory (const string &graph_filename)
 
bool transcript_file_nonempty (const string &transcripts)
 
vector< string > vcf_contigs (const string &filename)
 
size_t guess_parallel_gbwt_jobs (size_t node_count, size_t haplotype_count, size_t available_memory, size_t batch_size)
 
size_t xg_index_size (const xg::XG &index)
 
int execute_in_fork (const function< void(void)> &exec)
 
bool kff_is_trivial (const uint8_t *encoding)
 Returns true if the encoding is trivial (0, 1, 2, 3). More...
 
std::string kff_invert (const uint8_t *encoding)
 Inverts the KFF encoding into a packed -> char table. More...
 
kff_recoding_t kff_recoding (const uint8_t *encoding)
 Returns a recoding for the given encoding. More...
 
uint64_t kff_parse (const uint8_t *data, size_t bytes)
 Parses a big-endian integer from KFF data. More...
 
uint8_t kff_encode (const std::string &kmer, size_t start, size_t limit, const uint8_t *encoding)
 
std::vector< uint8_t > kff_encode (const std::string &kmer, const uint8_t *encoding)
 
void kff_decode (uint8_t byte, size_t chars, const std::string &decoding, std::string &output)
 
std::string kff_decode (const uint8_t *kmer, size_t k, const std::string &decoding)
 Decodes a kmer in KFF format according to the given encoding. More...
 
uint8_t kff_recode (gbwtgraph::Key64::value_type kmer, size_t k, size_t chars, const uint8_t *encoding)
 
std::vector< uint8_t > kff_recode (gbwtgraph::Key64::value_type kmer, size_t k, const uint8_t *encoding)
 Recodes a kmer from a minimizer index in KFF format according to the given encoding. More...
 
gbwtgraph::Key64::value_type kff_recode (const uint8_t *kmer, size_t k, kff_recoding_t recoding)
 
gbwtgraph::Key64::value_type kff_recode_trivial (const uint8_t *kmer, size_t k, size_t bytes)
 
std::vector< gbwtgraph::Key64::value_type > kff_recode (const uint8_t *kmers, size_t n, size_t k, kff_recoding_t recoding)
 
uint8_t kff_get (const uint8_t *kmer, size_t i)
 
void kff_set (std::vector< uint8_t > &kmer, size_t i, uint8_t value)
 
std::vector< uint8_t > kff_reverse_complement (const uint8_t *kmer, size_t k, const uint8_t *encoding)
 Returns the reverse complement of a KFF kmer. More...
 
size_t kff_bytes (size_t k)
 Returns the number of bytes required for a kmer in KFF format. More...
 
gbwtgraph::Key64::value_type minimizer_reverse_complement (gbwtgraph::Key64::value_type kmer, size_t k)
 Returns the reverse complement of a minimizer index kmer. More...
 
void for_each_kmer (const HandleGraph &graph, size_t k, const function< void(const kmer_t &)> &lambda, id_t head_id, id_t tail_id, atomic< int > *stop_flag)
 
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)
 
vector< size_t > make_prefix_suffix_table (const char *pattern, size_t len)
 
size_t kmp_search (const char *text, size_t text_len, const char *pattern, size_t pattern_len, const vector< size_t > &prefix_suffix_table)
 
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...
 
vector< size_t > subpath_topological_order (const multipath_alignment_t &multipath_aln, bool do_index)
 Return either the vector of topological order by index or the vector of indexes within the topological order. More...
 
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_alignment_sections (multipath_alignment_t &multipath_aln)
 
void identify_start_subpaths (multipath_alignment_t &multipath_aln)
 
void clear_alignment (multipath_alignment_t &multipath_aln)
 Clear all of the field associated with the alignment. More...
 
tuple< MultipathProblem, int64_t, int32_t > run_multipath_dp (const multipath_alignment_t &multipath_aln, bool subpath_global=false, bool forward=true)
 
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)
 
int32_t worst_alignment_score (const multipath_alignment_t &multipath_aln)
 
void remove_low_scoring_sections (multipath_alignment_t &multipath_aln, int32_t max_score_diff)
 
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...
 
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)
 
template<class ProtoAlignment1 , class ProtoAlignment2 >
void transfer_between_proto_annotation (const ProtoAlignment1 &from, ProtoAlignment2 &to)
 
template<class Alignment1 , class Alignment2 >
void transfer_uniform_metadata (const Alignment1 &from, Alignment2 &to)
 
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)
 
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, const unordered_set< size_t > *prohibited_merges)
 
void connected_comps_do (const multipath_alignment_t &multipath_aln, function< void(void)> &on_new_component, function< void(size_t)> &on_new_node)
 
size_t num_connected_components (const multipath_alignment_t &multipath_aln)
 Returns the number of connected components in the multipath alignment. 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...
 
bool contains_connection (const multipath_alignment_t &multipath_aln)
 Returns true if any subpath has a connection adjacency. 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 >, vector< tuple< int64_t, 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 search_left, int64_t search_limit)
 
bool contains_match (const multipath_alignment_t &multipath_aln, const pos_t &pos, int64_t read_pos, int64_t match_length)
 
vector< pair< int, char > > cigar_against_path (const multipath_alignment_t &multipath_aln, const string &path_name, bool rev, int64_t path_pos, const PathPositionHandleGraph &graph, int64_t min_splice_length)
 
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)
 
string make_shuffle_seed (const multipath_alignment_t &aln)
 Define seed generation for shuffling multipath alignments. More...
 
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)
 
bool edits_are_compatible (const Edit &e, const Edit &f)
 Return true if two edits could be combined into one (assuming adjacency). More...
 
void merge_edits_in_place (Edit &e, const Edit &f)
 Glom the second edit into the first, assuming adjacency. More...
 
Mapping merge_adjacent_edits (const Mapping &m)
 Merge adjacent edits of the same type. More...
 
Path trim_hanging_ends (const Path &p)
 
bool mappings_equivalent (const Mapping &m1, const Mapping &m2)
 
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_total_insertion (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)
 
int corresponding_length_internal (const path_t &path, int given_length, bool is_from_length, bool from_end)
 
int corresponding_to_length (const path_t &path, int from_length, bool from_end)
 
int corresponding_from_length (const path_t &path, int to_length, bool from_end)
 
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, offset_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 from_proto_position (const Position &from, position_t &to)
 
void preflight_check ()
 
ostream & operator<< (ostream &os, const Counts &counts)
 
std::string to_string (handle_t handle)
 
hash_map< Haplotypes::Subchain::kmer_type, size_t >::iterator find_kmer (hash_map< Haplotypes::Subchain::kmer_type, size_t > &counts, Haplotypes::Subchain::kmer_type kmer, size_t k)
 
void sa_to_da (std::vector< HaplotypePartitioner::sequence_type > &sequences, const gbwt::FastLocate &r_index)
 
std::string generate_haplotype (gbwt::edge_type pos, handle_t end, size_t start_max, size_t end_max, const gbwtgraph::GBWTGraph &graph)
 
std::vector< HaplotypePartitioner::kmer_typetake_unique_minimizers (const std::string &sequence, const HaplotypePartitioner::minimizer_index_type &minimizer_index)
 
void present_kmers (const std::vector< std::vector< HaplotypePartitioner::kmer_type >> &sequences, std::vector< std::pair< HaplotypePartitioner::kmer_type, size_t >> &all_kmers, sdsl::bit_vector &kmers_present)
 
void add_path (const gbwt::GBWT &source, gbwt::size_type path_id, gbwt::GBWTBuilder &builder, gbwtgraph::MetadataBuilder &metadata)
 
void recombinator_sanity_checks (const Recombinator::Parameters &parameters)
 
double get_or_estimate_coverage (const hash_map< Haplotypes::Subchain::kmer_type, size_t > &counts, const Recombinator::Parameters &parameters, Haplotypes::Verbosity verbosity)
 
std::vector< std::pair< Recombinator::kmer_presence, double > > classify_kmers (const Haplotypes::Subchain &subchain, const hash_map< Haplotypes::Subchain::kmer_type, size_t > &kmer_counts, double coverage, Recombinator::Statistics *statistics, const Recombinator::Parameters &parameters)
 
std::vector< std::pair< size_t, double > > select_diploid (const Haplotypes::Subchain &subchain, const std::vector< std::pair< size_t, double >> &candidates, const std::vector< std::pair< Recombinator::kmer_presence, double >> &kmer_types)
 
std::vector< std::pair< size_t, double > > select_haplotypes (const Haplotypes::Subchain &subchain, const hash_map< Haplotypes::Subchain::kmer_type, size_t > &kmer_counts, double coverage, Recombinator::Statistics *statistics, std::vector< Recombinator::LocalHaplotype > *local_haplotypes, const Recombinator::Parameters &parameters)
 
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 *graph_ptr, const string &path_name, const size_t &path_offset, bool is_reverse)
 
string to_string (const HandleGraph &graph, handle_t handle)
 
string to_string (const HandleGraph &graph, edge_t edge)
 
size_t minimum_distance (const SnarlDistanceIndex &distance_index, pos_t pos1, pos_t pos2, bool unoriented_distance, const HandleGraph *graph)
 
size_t maximum_distance (const SnarlDistanceIndex &distance_index, pos_t pos1, pos_t pos2)
 
void fill_in_distance_index (SnarlDistanceIndex *distance_index, const HandleGraph *graph, const HandleGraphSnarlFinder *snarl_finder, size_t size_limit)
 
SnarlDistanceIndex::TemporaryDistanceIndex make_temporary_distance_index (const HandleGraph *graph, const HandleGraphSnarlFinder *snarl_finder, size_t size_limit)
 
void populate_snarl_index (SnarlDistanceIndex::TemporaryDistanceIndex &temp_index, pair< SnarlDistanceIndex::temp_record_t, size_t > snarl_index, size_t size_limit, const HandleGraph *graph)
 
void subgraph_in_distance_range (const SnarlDistanceIndex &distance_index, const Path &path, const HandleGraph *super_graph, size_t min_distance, size_t max_distance, std::unordered_set< nid_t > &subgraph, bool look_forward)
 
void subgraph_in_distance_range_walk_graph (const HandleGraph *super_graph, size_t min_distance, size_t max_distance, std::unordered_set< nid_t > &subgraph, vector< pair< handle_t, size_t >> &start_nodes, hash_set< pair< nid_t, bool >> &seen_nodes, const pair< nid_t, bool > &traversal_start)
 
void subgraph_in_distance_range_walk_across_chain (const SnarlDistanceIndex &distance_index, const HandleGraph *super_graph, std::unordered_set< nid_t > &subgraph, net_handle_t current_node, size_t current_distance, vector< pair< handle_t, size_t >> &search_start_nodes, hash_set< pair< nid_t, bool >> &seen_nodes, const size_t &min_distance, const size_t &max_distance, bool checked_loop)
 
void subgraph_containing_path_snarls (const SnarlDistanceIndex &distance_index, const HandleGraph *graph, const Path &path, std::unordered_set< nid_t > &subgraph)
 
void add_descendants_to_subgraph (const SnarlDistanceIndex &distance_index, const net_handle_t &parent, std::unordered_set< nid_t > &subgraph)
 
MIPayloadValues get_minimizer_distances (const SnarlDistanceIndex &distance_index, pos_t pos)
 
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)
 
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_t, int32_t >, pair< path_t, int32_t > > split_splice_segment (const Alignment &splice_segment, const tuple< int64_t, int64_t, int64_t > &left_trace, const tuple< int64_t, int64_t, int64_t > &right_trace, 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 x)
 The standard normal cumulative distribution function. More...
 
double Phi_inv (double quantile)
 Inverse CDF of a standard normal distribution. Must have 0 < quantile < 1. More...
 
double lognormal_pdf (double x, double mu, double sigma)
 Probability density function or log-normal distribution. 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)
 
template<typename Number >
SummaryStatistics summary_statistics (const std::map< Number, size_t > &values)
 Returns summary statistics for a multiset of numbers. More...
 
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=0.0, T s=1.0)
 
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 operator== (const Exon &lhs, const Exon &rhs)
 
bool operator!= (const Exon &lhs, const Exon &rhs)
 
bool operator< (const Exon &lhs, const Exon &rhs)
 
bool operator== (const Transcript &lhs, const Transcript &rhs)
 
bool operator!= (const Transcript &lhs, const Transcript &rhs)
 
bool operator< (const Transcript &lhs, const Transcript &rhs)
 
bool operator== (const Mapping &lhs, const Mapping &rhs)
 
bool operator!= (const Mapping &lhs, const Mapping &rhs)
 
bool operator== (const Path &lhs, const Path &rhs)
 
bool operator!= (const Path &lhs, const Path &rhs)
 
bool sort_pair_by_second (const pair< uint32_t, uint32_t > &lhs, const pair< uint32_t, uint32_t > &rhs)
 
bool sort_transcript_paths_by_name (const CompletedTranscriptPath &lhs, const CompletedTranscriptPath &rhs)
 
handle_t mapping_to_handle (const Mapping &mapping, const HandleGraph &graph)
 
bool is_match (const Translation &translation)
 
double weighted_jaccard_coefficient (const PathHandleGraph *graph, const multiset< handle_t > &target, const multiset< handle_t > &query)
 
vector< int > get_traversal_order (const PathHandleGraph *graph, const vector< Traversal > &traversals, const vector< string > &trav_path_names, const vector< int > &ref_travs, int64_t ref_trav_idx, const vector< bool > &use_traversal)
 
vector< vector< int > > cluster_traversals (const PathHandleGraph *graph, const vector< Traversal > &traversals, const vector< int > &traversal_order, const vector< pair< handle_t, handle_t >> &child_snarls, double min_jaccard, vector< pair< double, int64_t >> &out_info, vector< int > &out_child_snarl_to_trav)
 
vector< vector< int > > assign_child_snarls_to_traversals (const PathHandleGraph *graph, const vector< Traversal > &traversals, const vector< pair< handle_t, handle_t >> &child_snarls)
 
template<typename T , typename U >
double jaccard_coefficient (const T &target, const U &query)
 
string traversal_to_string (const PathHandleGraph *graph, const Traversal &traversal, int64_t max_steps)
 
string graph_interval_to_string (const HandleGraph *graph, const handle_t &start_handle, const handle_t &end_handle)
 
pair< vector< SnarlTraversal >, vector< pair< step_handle_t, step_handle_t > > > find_path_traversals (const Snarl &site)
 
pos_t make_pos_t (id_t id, bool is_rev, offset_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...
 
offset_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...
 
offset_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 empty_pos_t ()
 Get an unset pos_t. 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, size_t max_cuts)
 
std::vector< std::string > split_delims (const std::string &s, const std::string &delims, size_t max_cuts)
 
bool starts_with (const std::string &value, const std::string &prefix)
 Check if a string starts with another string. More...
 
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 toUppercaseInPlace (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)
 Vector containing positive integer values in [begin, end) More...
 
std::vector< size_t > stack_permutations (const std::vector< size_t > &bottom, const std::vector< size_t > &top)
 Apply one permutation on top of another. Retutn the combined permutation. More...
 
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, bool test_open)
 
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...
 
string file_base_name (const string &filename)
 Get the base name of a filename (without the directory and the extension). 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...
 
bool deterministic_flip (LazyRNG &rng)
 Flip a coin with 50% probability against the given RNG. 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)
 
template<>
bool parse (const string &arg, pos_t &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)
 
template<typename Item >
VectorView< Item >::const_iterator operator+ (typename VectorView< Item >::const_iterator::difference_type a, const typename VectorView< Item >::const_iterator &b)
 Allow VectorView iterators to be added to numbers. More...
 
vector< size_t > range_vector (size_t end)
 Vector containing positive integer values in [0, end) More...
 
template<typename Iterator >
std::vector< size_t > sort_permutation (const Iterator &begin, const Iterator &end, const std::function< bool(const typename Iterator::value_type &, const typename Iterator::value_type &)> &comparator)
 Get the index permutation that sorts the given items with the given comparator instead of <. More...
 
template<typename Iterator >
std::vector< size_t > sort_permutation (const Iterator &begin, const Iterator &end)
 Get the index permutation that sorts the given items ascending using <. More...
 
size_t integer_power (size_t x, size_t power)
 
template<class RandomIt >
void deterministic_shuffle (RandomIt begin, RandomIt end, LazyRNG &rng)
 
template<typename Number >
bool deterministic_beats (const Number &a, const Number &b, LazyRNG &rng)
 Return true if a is larger than b, or else equal to b and wins a coin flip. More...
 
string make_shuffle_seed (const Alignment &aln)
 Make seeds for Alignments based on their sequences. More...
 
template<typename T >
string make_shuffle_seed (const T *ptr)
 Make seeds for pointers to things we can make seeds for. More...
 
template<typename T1 , typename T2 >
string make_shuffle_seed (const pair< T1, T2 > &p)
 Make seeds for pairs of things we can make seeds for. 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 >
void sort_shuffling_ties (RandomIt begin, RandomIt end, Compare comp, LazyRNG &rng)
 
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)
 
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
 
const char * ISSUE_URL = "https://github.com/vgteam/vg/issues/new/choose"
 
thread_local std::string stored_crash_context
 
const read_alignment_index_t NO_READ_INDEX = {std::numeric_limits<size_t>::infinity(), std::numeric_limits<size_t>::infinity()}
 Represents an unset index. More...
 
const alignment_index_t NO_INDEX {std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max(), std::numeric_limits<bool>::max()}
 Represents an unset index. More...
 

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.

◆ IndexGroup

using vg::IndexGroup = typedef set<IndexName>

A group of indexes that can be made simultaneously

◆ IndexName

using vg::IndexName = typedef string

A unique identifier for an Index

◆ MutableHandleGraph

◆ MutablePathDeletableHandleGraph

◆ MutablePathHandleGraph

◆ MutablePathMutableHandleGraph

◆ NamedNodeBackTranslation

◆ nid_t

using vg::nid_t = typedef handlegraph::nid_t

◆ offset_t

typedef size_t vg::offset_t

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

◆ oriented_node_range_t

◆ pareto_point

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

◆ path_handle_t

◆ PathHandleGraph

◆ PathInterval

◆ PathMetadata

◆ PathPositionHandleGraph

◆ PathSense

◆ pos_t

typedef std::tuple<id_t, bool, offset_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

◆ RecipeFunc

using vg::RecipeFunc = typedef function<vector<vector<string> >(const vector<const IndexFile*>&, const IndexingPlan*, AliasGraph&, const IndexGroup&)>

Is a recipe to create the files (returned by name) associated with some index, from a series of input indexes, given the plan it is being generated for and the index being generated.

◆ RecipeName

using vg::RecipeName = typedef pair<IndexGroup, size_t>

Names a recipe in the collection of registered recipes.

◆ SerializableHandleGraph

◆ step_handle_t

◆ subrange_t

◆ thread_ids_t

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

◆ thread_t

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

◆ Traversal

using vg::Traversal = typedef vector<handle_t>

◆ VectorizableHandleGraph

Enumeration Type Documentation

◆ alignment_emitter_flags_t

Flag enum for controlling the behavior of alignment emitters behind get_alignment_emitter().

Enumerator
ALIGNMENT_EMITTER_FLAG_NONE 

Value for no flags set.

ALIGNMENT_EMITTER_FLAG_HTS_RAW 

Skip surjection, and expect pre-surjected alignments.

ALIGNMENT_EMITTER_FLAG_HTS_SPLICED 

Use splicing-aware conversion to HTSlib formats: alignments are spliced at known splice sites (i.e. edges in the graph), so form spliced CIGAR strings

ALIGNMENT_EMITTER_FLAG_HTS_PRUNE_SUSPICIOUS_ANCHORS 

When surjecting, discard low-complexity anchors and realign more freely against the target path.

ALIGNMENT_EMITTER_FLAG_VG_USE_SEGMENT_NAMES 

Emit graph alignments in named segment (i.e. GFA space) instead of numerical node ID space.

◆ 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_descendants_to_subgraph()

void vg::add_descendants_to_subgraph ( const SnarlDistanceIndex &  distance_index,
const net_handle_t parent,
std::unordered_set< nid_t > &  subgraph 
)

◆ add_edges_only()

void vg::add_edges_only ( MutableHandleGraph graph,
function< void(function< void(Alignment &)>, bool, bool)>  iterate_gam,
double  min_mapq,
size_t  min_bp_coverage 
)

Add edges between consecutive mappings that aren't already in the graph note: offsets are completely ignored (a simplifying assumption designed to help with SV genotpying with pack/call as edge packing works similarly)

No existing nodes or edges are modified, and no nodes are added, just edges So the output graph will be id-space compatible, and any GAM/GAF will continue to be valid for it.

◆ 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()

void vg::add_path ( const gbwt::GBWT &  source,
gbwt::size_type  path_id,
gbwt::GBWTBuilder &  builder,
gbwtgraph::MetadataBuilder &  metadata 
)

◆ 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 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()

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

Check to make sure edits on the alignment's path don't assume incorrect node lengths or ids. Result can be used like a bool or inspected for further details. Does not log anything itself about bad alignments.

◆ 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/3]

void vg::alignment_set_distance_to_correct ( Alignment aln,
const Alignment base,
const unordered_map< string, string > *  translation = nullptr 
)

Annotate the first alignment with its minimum distance to the second in their annotated paths. If translation is set, replace path names in aln using that mapping, if they are found in it.

◆ alignment_set_distance_to_correct() [2/3]

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

◆ alignment_set_distance_to_correct() [3/3]

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

◆ 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

Add a CIGAR operation to a vector representing the parsed CIGAR string.

Coalesces adjacent operations of the same type. Coalesces runs of inserts and deletes into a signle delete followed by a single insert.

◆ 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 
)

Append the second path onto the end of the first, without combining mappings or simplifying. Modifies and returns a reference to the first path.

◆ approx_gbwt_memory()

int64_t vg::approx_gbwt_memory ( const string &  vcf_filename)

◆ approx_graph_load_memory()

int64_t vg::approx_graph_load_memory ( const string &  graph_filename)

◆ approx_graph_memory() [1/3]

int64_t vg::approx_graph_memory ( const string &  fasta_filename,
const string &  vcf_filename 
)

◆ approx_graph_memory() [2/3]

int64_t vg::approx_graph_memory ( const string &  gfa_filename)

◆ approx_graph_memory() [3/3]

int64_t vg::approx_graph_memory ( const vector< string > &  fasta_filenames,
const vector< string > &  vcf_filenames 
)

◆ approx_num_vars()

double vg::approx_num_vars ( const string &  vcf_filename)

◆ assign_child_snarls_to_traversals()

vector< vector< int > > vg::assign_child_snarls_to_traversals ( const PathHandleGraph graph,
const vector< Traversal > &  traversals,
const vector< pair< handle_t, handle_t >> &  child_snarls 
)

assign a list of child snarls to traversals that fully conrtain them the output is a list (for each traversal) of each child snarl that's contained in it so otuput[i] = {x,y,z} means that child_snarls[x],[y],[z] are in traversals[i]

◆ 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.,
bool  edges_only = false 
)

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.,
bool  edges_only = false 
)

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,
bool  edges_only 
)

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,
const map< string, string > &  rg_sample,
const map< int, path_handle_t > &  tid_path_handle 
)

◆ bam_to_alignment() [2/2]

Alignment vg::bam_to_alignment ( const bam1_t *  b,
const map< string, string > &  rg_sample,
const map< int, path_handle_t > &  tid_path_handle,
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() [1/2]

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_against_path() [2/2]

vector< pair< int, char > > vg::cigar_against_path ( const multipath_alignment_t multipath_aln,
const string &  path_name,
bool  rev,
int64_t  path_pos,
const PathPositionHandleGraph graph,
int64_t  min_splice_length = numeric_limits< int64_t >::max() 
)

Convert a surjected multipath alignment into a CIGAR sequence against a path. Splicing will be allowed at connections and at any silent deletions of path sequence. Surjected multipath alignment graph must consist of a single non-branching path

◆ 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)

◆ classify_kmers()

std::vector<std::pair<Recombinator::kmer_presence, double> > vg::classify_kmers ( const Haplotypes::Subchain subchain,
const hash_map< Haplotypes::Subchain::kmer_type, size_t > &  kmer_counts,
double  coverage,
Recombinator::Statistics statistics,
const Recombinator::Parameters parameters 
)

◆ clear_alignment()

void vg::clear_alignment ( multipath_alignment_t multipath_aln)

Clear all of the field associated with the alignment.

◆ 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.

◆ clear_crash_context()

void vg::clear_crash_context ( )

User code should call this when it wants to clear context for a failure in its thread.

◆ clip_contained_low_depth_nodes_and_edges()

void vg::clip_contained_low_depth_nodes_and_edges ( MutablePathMutableHandleGraph graph,
PathPositionHandleGraph pp_graph,
const vector< Region > &  regions,
SnarlManager snarl_manager,
bool  include_endpoints,
int64_t  min_depth,
int64_t  min_fragment_len,
bool  verbose 
)

Or on contained snarls

◆ clip_contained_snarls()

void vg::clip_contained_snarls ( MutablePathMutableHandleGraph graph,
PathPositionHandleGraph pp_graph,
const vector< Region > &  regions,
SnarlManager snarl_manager,
bool  include_endpoints,
int64_t  min_fragment_len,
size_t  max_nodes,
size_t  max_edges,
size_t  max_nodes_shallow,
size_t  max_edges_shallow,
double  max_avg_degree,
double  max_reflen_prop,
size_t  max_reflen,
bool  out_bed,
bool  verbose 
)

If a given bed region spans a snarl (overlaps its end nodes, and forms a traversal) then clip out all other nodes (ie nodes that don't lie on the traversal)

IMPORTANT: for any given snarl, the first region that contains it is used. (but other reference paths now whitelisted via ref_prefixes)

Update: now accepts some snarl complexity thresholds to ignore simple enough snarls

◆ clip_contained_stubs()

void vg::clip_contained_stubs ( MutablePathMutableHandleGraph graph,
PathPositionHandleGraph pp_graph,
const vector< Region > &  regions,
SnarlManager snarl_manager,
bool  include_endpoints,
int64_t  min_fragment_len,
bool  verbose 
)

◆ clip_deletion_edges()

void vg::clip_deletion_edges ( MutablePathMutableHandleGraph graph,
int64_t  max_deletion,
int64_t  context_steps,
const vector< string > &  ref_prefixes,
int64_t  min_fragment_len,
bool  verbose 
)

clip out deletion edges

◆ clip_low_depth_nodes_and_edges()

void vg::clip_low_depth_nodes_and_edges ( MutablePathMutableHandleGraph graph,
int64_t  min_depth,
const vector< string > &  ref_prefixes,
int64_t  min_fragment_len,
bool  verbose 
)

Run above function on graph

◆ clip_low_depth_nodes_and_edges_generic()

void vg::clip_low_depth_nodes_and_edges_generic ( MutablePathMutableHandleGraph graph,
function< void(function< void(handle_t, const Region *)>)>  iterate_handles,
function< void(function< void(edge_t, const Region *)>)>  iterate_edges,
int64_t  min_depth,
const vector< string > &  ref_prefixes,
int64_t  min_fragment_len,
bool  verbose 
)

Clip out nodes that don't pass depth threshold (depth < min_depth).
"depth" is the number of paths that step on the node. Nodes on path with given prefix ignored (todo: should really switch to regex or something) iterate_handles is a hack to generalize this function to whole graphs or snarls

◆ clip_stubs()

void vg::clip_stubs ( MutablePathMutableHandleGraph graph,
const vector< string > &  ref_prefixes,
int64_t  min_fragment_len,
bool  verbose 
)

clip out stubs

◆ clip_stubs_generic()

void vg::clip_stubs_generic ( MutablePathMutableHandleGraph graph,
function< void(function< void(handle_t, const Region *)>)>  iterate_handles,
function< bool(handle_t)>  handle_in_range,
const vector< string > &  ref_prefixes,
int64_t  min_fragment_len,
bool  verbose 
)

◆ 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

◆ cluster_traversals()

vector< vector< int > > vg::cluster_traversals ( const PathHandleGraph graph,
const vector< Traversal > &  traversals,
const vector< int > &  traversal_order,
const vector< pair< handle_t, handle_t >> &  child_snarls,
double  min_jaccard,
vector< pair< double, int64_t >> &  out_info,
vector< int > &  out_child_snarl_to_trav 
)

cluster the traversals. The algorithm is:

  • visit traversals in provided order
    • if the traversal is <= min_jaccard away from the reference traversal of cluster, add to cluster
    • else start a new cluster, with the given traversal as a reference note that traversal_order can specify a subset of traversals out_info are Simlarity/length-delta pairs comparing the traversal to its cluster reference (if the traversal wasn't in traversal_order, it'll get -1) if child snarls are given, then we make sure that every child snarl is contained in a reference traversal (this guarantees the snarl nesting structure is exactly represented in the vcf alleles!) if child snarls are given, then we also fill in the mapping of each child snarl to its "reference" traversals – ie first traversal in a cluster that contains both its endpoints

◆ 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 
)

◆ compose_short_path_name()

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

Get a short version of a string representation of a thread name stored in GBWT metadata, made of just the sample and contig and haplotype. NOTE: id is a gbwt path id, not a gbwt sequence id.

◆ 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 subpath_t's in each connected component. An unmapped multipath_alignment_t with no subpaths produces an empty vector.

◆ connected_comps_do()

void vg::connected_comps_do ( const multipath_alignment_t multipath_aln,
function< void(void)> &  on_new_component,
function< void(size_t)> &  on_new_node 
)

◆ 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 
)

◆ contains_connection()

bool vg::contains_connection ( const multipath_alignment_t multipath_aln)

Returns true if any subpath has a connection adjacency.

◆ contains_match()

bool vg::contains_match ( const multipath_alignment_t multipath_aln,
const pos_t pos,
int64_t  read_pos,
int64_t  match_length 
)

Returns true if the multipath alignment contains a match of a given length starting at the graph and read position

◆ 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.

◆ copy_file()

void vg::copy_file ( const string &  from_fp,
const string &  to_fp 
)

◆ copy_metadata()

void vg::copy_metadata ( const gbwt::GBWT &  source,
gbwt::GBWT &  target,
const std::vector< std::vector< gbwt::size_type >> &  jobs,
const std::vector< size_t > &  job_order 
)

◆ copy_reference_samples() [1/2]

void vg::copy_reference_samples ( const gbwt::GBWT &  source,
gbwt::GBWT &  destination 
)

Copies the reference sample tag from the source GBWT index to the destination GBWT index.

◆ copy_reference_samples() [2/2]

void vg::copy_reference_samples ( const PathHandleGraph source,
gbwt::GBWT &  destination 
)

Copies reference samples from the source graph to the destination GBWT index. Every sample with at least one reference path in the source graph is considered a reference sample.

◆ corresponding_from_length()

int vg::corresponding_from_length ( const path_t path,
int  to_length,
bool  from_end 
)

◆ corresponding_length_internal()

int vg::corresponding_length_internal ( const path_t path,
int  given_length,
bool  is_from_length,
bool  from_end 
)

◆ corresponding_to_length()

int vg::corresponding_to_length ( const path_t path,
int  from_length,
bool  from_end 
)

◆ crash_unless_impl()

void vg::crash_unless_impl ( bool  condition,
const std::string &  condition_string,
const std::string &  file,
int  line,
const std::string &  function 
)

crash_unless calls into this function for a real implementation.

◆ 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 
)

◆ delete_nodes_and_chop_paths()

void vg::delete_nodes_and_chop_paths ( MutablePathMutableHandleGraph graph,
const unordered_set< nid_t > &  nodes_to_delete,
const unordered_set< edge_t > &  edges_to_delete,
int64_t  min_fragment_len,
unordered_map< string, size_t > *  fragments_per_path 
)

◆ 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_beats()

template<typename Number >
bool vg::deterministic_beats ( const Number &  a,
const Number &  b,
LazyRNG rng 
)

Return true if a is larger than b, or else equal to b and wins a coin flip.

◆ deterministic_flip()

bool vg::deterministic_flip ( LazyRNG rng)

Flip a coin with 50% probability against the given RNG.

◆ deterministic_shuffle() [1/2]

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

Do a deterministic shuffle with automatic seed determination.

◆ deterministic_shuffle() [2/2]

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

Given a pair of random access iterators defining a range, deterministically shuffle the contents of the range based on the given RNG. Allows one RNG from deterministic_start() to be used for multiple shuffles.

◆ divergence()

double vg::divergence ( const Mapping m)

◆ each_approx_graph_memory()

vector<int64_t> vg::each_approx_graph_memory ( const vector< string > &  fasta_filenames,
const vector< string > &  vcf_filenames 
)

◆ edit_count()

int vg::edit_count ( const Alignment alignment)

◆ edits_are_compatible()

bool vg::edits_are_compatible ( const Edit e,
const Edit f 
)

Return true if two edits could be combined into one (assuming adjacency).

◆ 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.

◆ empty_gbwtgraph_handle()

handle_t vg::empty_gbwtgraph_handle ( )
inline

Returns an empty GBWTGraph handle corresponding to the GBWT endmarker.

◆ empty_pos_t()

pos_t vg::empty_pos_t ( )
inline

Get an unset pos_t.

◆ 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

◆ execute_in_fork()

int vg::execute_in_fork ( const function< void(void)> &  exec)

◆ 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. If the path does not exist, it is treated as empty.

◆ 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_path_metadata()

pair< vector< pair< string, int64_t > >, unordered_map< string, int64_t > > vg::extract_path_metadata ( const vector< tuple< path_handle_t, size_t, size_t >> &  paths,
const PathPositionHandleGraph graph,
bool  subpath_support = false 
)

Given a list of path handles and size info (from get_sequence_dictionary), return two things: 1) names and lengths of all of base paths in order. 2) a mapping of path names to length (reflects paths in the graph including subpaths)

If subpath_support is set to false, there won't be a distinction.

◆ 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,
uint64_t  batch_size 
)

◆ 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,
uint64_t  batch_size 
)

◆ 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,
uint64_t  batch_size 
)

◆ 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,
uint64_t  batch_size 
)

◆ 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,
uint64_t  batch_size 
)

◆ file_base_name()

string vg::file_base_name ( const string &  filename)

Get the base name of a filename (without the directory and the extension).

◆ file_exists()

bool vg::file_exists ( const string &  filename)

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

◆ fill_in_distance_index()

void vg::fill_in_distance_index ( SnarlDistanceIndex *  distance_index,
const HandleGraph graph,
const HandleGraphSnarlFinder snarl_finder,
size_t  size_limit 
)

◆ 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_kmer()

hash_map<Haplotypes::Subchain::kmer_type, size_t>::iterator vg::find_kmer ( hash_map< Haplotypes::Subchain::kmer_type, size_t > &  counts,
Haplotypes::Subchain::kmer_type  kmer,
size_t  k 
)

◆ 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_path_traversals()

pair<vector<SnarlTraversal>, vector<pair<step_handle_t, step_handle_t> > > vg::find_path_traversals ( const Snarl site)

◆ 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,
const std::string &  header 
)

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)

◆ 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 = 0,
id_t  tail_id = 0,
atomic< int > *  stop_flag = nullptr 
)

Iterate over all the kmers in the graph, running lambda on each If the stop flag is included, stop execution if it ever evaluates to true

◆ format_multiplier()

double vg::format_multiplier ( )

◆ 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 
)

◆ from_proto_position()

void vg::from_proto_position ( const Position from,
position_t to 
)

◆ 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.

◆ 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)

◆ generate_haplotype()

std::string vg::generate_haplotype ( gbwt::edge_type  pos,
handle_t  end,
size_t  start_max,
size_t  end_max,
const gbwtgraph::GBWTGraph &  graph 
)

◆ 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 vector< tuple< path_handle_t, size_t, size_t >> &  paths,
size_t  max_threads,
const HandleGraph graph = nullptr,
int  flags = ALIGNMENT_EMITTER_FLAG_NONE 
)

Get an AlignmentEmitter that can emit to the given file (or "-") in the given format. When writing HTSlib formats (SAM, BAM, CRAM), paths should contain the paths in the linear reference in sequence dictionary order (see get_sequence_dictionary), and a PathPositionHandleGraph must be provided. When writing GAF, a HandleGraph must be provided for obtaining node lengths and sequences. Other formats do not need a graph.

flags is an ORed together set of flags from alignment_emitter_flags_t.

Automatically applies per-thread buffering, but needs to know how many OMP threads will be in use.

◆ 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_best_gbwtgraph_gfa_parsing_parameters()

gbwtgraph::GFAParsingParameters vg::get_best_gbwtgraph_gfa_parsing_parameters ( )

Get the best configuration to use for the GBWTGraph library GFA parser, to best matcch the behavior of vg's GFA parser.

◆ 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_file_size()

int64_t vg::get_file_size ( const string &  filename)

◆ 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.

Warning: If you're reading a HandleGraph via VPKG::load_one (as is the pattern in vg) it is best to use get_input_file_name() below instead, and run load_one on that. This allows better GFA support because it allows memmapping the file directly

◆ get_input_file_name()

string vg::get_input_file_name ( int &  optind,
int  argc,
char **  argv,
bool  test_open = true 
)

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_minimizer_distances()

MIPayloadValues vg::get_minimizer_distances ( const SnarlDistanceIndex &  distance_index,
pos_t  pos 
)

◆ 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_num_samples()

int64_t vg::get_num_samples ( const string &  vcf_filename)

◆ get_offset()

offset_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_estimate_coverage()

double vg::get_or_estimate_coverage ( const hash_map< Haplotypes::Subchain::kmer_type, size_t > &  counts,
const Recombinator::Parameters parameters,
Haplotypes::Verbosity  verbosity 
)

◆ 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_sequence_dictionary()

vector< tuple< path_handle_t, size_t, size_t > > vg::get_sequence_dictionary ( const string &  filename,
const vector< string > &  path_names,
const PathPositionHandleGraph graph 
)

Produce a list of path handles in a fixed order, suitable for use with get_alignment_emitter_with_surjection(), by parsing a file. The file may be an HTSlib-style "sequence dictionary" (consisting of SAM @SQ header lines), or a plain list of sequence names (which do not start with "@SQ"). If the file is not openable or contains no entries, reports an error and quits.

If path_names has entries, they are treated as path names that supplement those in the file, if any.

If the filename is itself an empty string, and no path names are passed, then all reference-sense paths from the graph will be collected in arbitrary order. If there are none, all non-alt-allele generic sense paths from the graph will be collected in arbitrary order.

TODO: Be able to generate the autosomes human-sort, X, Y, MT order typical of references.

The tuple is <path, path length in graph, base path length> For a subpath (ie chr1[1000-10000]) the base path length would be that of chr1 This information needs to come from the user in order to be correct, but if it's not specified, it'll be guessed from the graph

◆ 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.

◆ get_traversal_order()

vector< int > vg::get_traversal_order ( const PathHandleGraph graph,
const vector< Traversal > &  traversals,
const vector< string > &  trav_path_names,
const vector< int > &  ref_travs,
int64_t  ref_trav_idx,
const vector< bool > &  use_traversal 
)

sort the traversals, putting the reference first then using names traversals masked out by use_traversal will be filrtered out entirely (so the output vector may be smaller than the input...)

◆ 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_interval_to_string()

string vg::graph_interval_to_string ( const HandleGraph graph,
const handle_t start_handle,
const handle_t end_handle 
)

◆ graph_to_gfa()

void vg::graph_to_gfa ( const PathHandleGraph graph,
ostream &  out,
const set< string > &  rgfa_paths = {},
bool  rgfa_pline = false,
bool  use_w_lines = true 
)

Export the given VG graph to the given GFA file. Express paths mentioned in rgfa_paths as rGFA. If rgfa_pline is set, also express them as dedicated lines. If use_w_lines is set, reference and haplotype paths will use W lines instead of P lines.

◆ guess_parallel_gbwt_jobs()

size_t vg::guess_parallel_gbwt_jobs ( size_t  node_count,
size_t  haplotype_count,
size_t  available_memory,
size_t  batch_size 
)

◆ 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_annotation()

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

Returns true if the Protobuf object has an annotation with this name.

◆ 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() [1/2]

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

◆ hts_string_header() [2/2]

bam_hdr_t * vg::hts_string_header ( string &  header,
const vector< pair< string, int64_t >> &  path_order_and_length,
const 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 
)

◆ 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,
std::string  path_name = "" 
)

Insert a GBWT thread into the graph and return its name. Returns an empty string on failure. If a path name is specified and not empty, that name will be used for the inserted path. 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_gzipped()

bool vg::is_gzipped ( const string &  filename)

◆ 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.

◆ jaccard_coefficient()

template<typename T , typename U >
double vg::jaccard_coefficient ( const T &  target,
const U &  query 
)
inline

◆ kff_bytes()

size_t vg::kff_bytes ( size_t  k)
inline

Returns the number of bytes required for a kmer in KFF format.

◆ kff_decode() [1/2]

std::string vg::kff_decode ( const uint8_t *  kmer,
size_t  k,
const std::string &  decoding 
)

Decodes a kmer in KFF format according to the given encoding.

◆ kff_decode() [2/2]

void vg::kff_decode ( uint8_t  byte,
size_t  chars,
const std::string &  decoding,
std::string &  output 
)

◆ kff_encode() [1/2]

std::vector< uint8_t > vg::kff_encode ( const std::string &  kmer,
const uint8_t *  encoding 
)

Encodes a kmer in KFF format according to the given encoding. Non-ACGT characters are encoded as 0s.

◆ kff_encode() [2/2]

uint8_t vg::kff_encode ( const std::string &  kmer,
size_t  start,
size_t  limit,
const uint8_t *  encoding 
)

◆ kff_get()

uint8_t vg::kff_get ( const uint8_t *  kmer,
size_t  i 
)

◆ kff_invert()

std::string vg::kff_invert ( const uint8_t *  encoding)

Inverts the KFF encoding into a packed -> char table.

◆ kff_is_trivial()

bool vg::kff_is_trivial ( const uint8_t *  encoding)

Returns true if the encoding is trivial (0, 1, 2, 3).

◆ kff_parse()

uint64_t vg::kff_parse ( const uint8_t *  data,
size_t  bytes 
)

Parses a big-endian integer from KFF data.

◆ kff_recode() [1/4]

gbwtgraph::Key64::value_type vg::kff_recode ( const uint8_t *  kmer,
size_t  k,
kff_recoding_t  recoding 
)

Recodes a KFF kmer in the minimizer index format according to the given encoding. Will fail silently if k is too large or recoding is not from kff_recoding().

◆ kff_recode() [2/4]

std::vector< gbwtgraph::Key64::value_type > vg::kff_recode ( const uint8_t *  kmers,
size_t  n,
size_t  k,
kff_recoding_t  recoding 
)

Recodes n KFF kmers in the minimizer index format according to the given encoding. Will fail silently if k is too large or recoding is not from kff_recoding().

◆ kff_recode() [3/4]

std::vector< uint8_t > vg::kff_recode ( gbwtgraph::Key64::value_type  kmer,
size_t  k,
const uint8_t *  encoding 
)

Recodes a kmer from a minimizer index in KFF format according to the given encoding.

◆ kff_recode() [4/4]

uint8_t vg::kff_recode ( gbwtgraph::Key64::value_type  kmer,
size_t  k,
size_t  chars,
const uint8_t *  encoding 
)

◆ kff_recode_trivial()

gbwtgraph::Key64::value_type vg::kff_recode_trivial ( const uint8_t *  kmer,
size_t  k,
size_t  bytes 
)

Recodes a KFF kmer in the minimizer index format, assuming that the encoding is the same. Will fail silently if k or bytes is too large.

◆ kff_recoding()

kff_recoding_t vg::kff_recoding ( const uint8_t *  encoding)

Returns a recoding for the given encoding.

◆ kff_reverse_complement()

std::vector< uint8_t > vg::kff_reverse_complement ( const uint8_t *  kmer,
size_t  k,
const uint8_t *  encoding 
)

Returns the reverse complement of a KFF kmer.

◆ kff_set()

void vg::kff_set ( std::vector< uint8_t > &  kmer,
size_t  i,
uint8_t  value 
)

◆ 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.

◆ kmp_search()

size_t vg::kmp_search ( const char *  text,
size_t  text_len,
const char *  pattern,
size_t  pattern_len,
const vector< size_t > &  prefix_suffix_table 
)

◆ last_path_position()

Position vg::last_path_position ( const Path path)

◆ list_haplotypes()

vector< pair< vector< gbwt::node_type >, gbwt::SearchState > > vg::list_haplotypes ( const HandleGraph graph,
const gbwt::GBWT &  gbwt,
handle_t  start,
function< bool(const vector< gbwt::node_type > &)>  stop_fn 
)

◆ ln_to_log10()

double vg::ln_to_log10 ( double  ln)
inline

Convert a number ln to the same number log 10.

◆ load_gbwt() [1/2]

void vg::load_gbwt ( gbwt::DynamicGBWT &  index,
const std::string &  filename,
bool  show_progress 
)

Load a dynamic GBWT from the file.

◆ load_gbwt() [2/2]

void vg::load_gbwt ( gbwt::GBWT &  index,
const std::string &  filename,
bool  show_progress 
)

Load a compressed GBWT from the file.

◆ load_gbwtgraph()

void vg::load_gbwtgraph ( gbwtgraph::GBWTGraph &  graph,
const std::string &  filename,
bool  show_progress = false 
)

Load GBWTGraph from the file. NOTE: Call graph.set_gbwt() afterwards with the appropriate GBWT index.

◆ load_gbz() [1/3]

void vg::load_gbz ( gbwt::GBWT &  index,
gbwtgraph::GBWTGraph &  graph,
const std::string &  filename,
bool  show_progress 
)

Load GBWT and GBWTGraph from the GBZ file.

◆ load_gbz() [2/3]

void vg::load_gbz ( gbwtgraph::GBZ &  gbz,
const std::string &  filename,
bool  show_progress 
)

Load GBZ from the file.

◆ load_gbz() [3/3]

void vg::load_gbz ( gbwtgraph::GBZ &  gbz,
const std::string &  gbwt_name,
const std::string &  graph_name,
bool  show_progress 
)

Load GBZ from separate GBWT / GBWTGraph files.

◆ load_gcsa()

void vg::load_gcsa ( gcsa::GCSA &  index,
const std::string &  filename,
bool  show_progress 
)

Load GCSA from the file.

◆ load_lcp()

void vg::load_lcp ( gcsa::LCPArray &  lcp,
const std::string &  filename,
bool  show_progress 
)

Load LCP array from the file.

◆ load_minimizer()

void vg::load_minimizer ( gbwtgraph::DefaultMinimizerIndex &  index,
const std::string &  filename,
bool  show_progress 
)

Load a minimizer index from the file.

◆ load_r_index()

void vg::load_r_index ( gbwt::FastLocate &  index,
const std::string &  filename,
bool  show_progress 
)

Load an r-index from the file.

◆ load_translation_back_map() [1/2]

std::unordered_map< nid_t, std::pair< std::string, size_t > > vg::load_translation_back_map ( const gbwtgraph::GBWTGraph &  graph)

Return a backwards mapping of chopped node to original segment position (id,offset pair)

Return a backwards mapping of chopped node to original segment position (id,offset pair) (mimicking logic and interface from function of same name in gbwt_helper.cpp)

◆ load_translation_back_map() [2/2]

unordered_map< nid_t, pair< string, size_t > > vg::load_translation_back_map ( HandleGraph graph,
ifstream &  input_stream 
)

Load a translation file (created with vg gbwt –translation) and return a backwards mapping of chopped node to original segment position (id,offset pair) NOTE: hopefully this is just a short-term hack, and we get a general interface baked into the handlegraphs themselves

◆ load_translation_map() [1/2]

std::unordered_map< std::string, std::vector< nid_t > > vg::load_translation_map ( const gbwtgraph::GBWTGraph &  graph)

Return a mapping of the original segment ids to a list of chopped node ids.

Return a mapping of the original segment ids to a list of chopped node ids (mimicking logic and interface from function of same name in gbwt_helper.cpp)

◆ load_translation_map() [2/2]

unordered_map< string, vector< nid_t > > vg::load_translation_map ( ifstream &  input_stream)

Load a translation file (created with vg gbwt –translation) and return a mapping original segment ids to a list of chopped node ids

◆ 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.

◆ lognormal_pdf()

double vg::lognormal_pdf ( double  x,
double  mu,
double  sigma 
)

Probability density function or log-normal distribution.

◆ 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,
offset_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,
offset_t  off 
)

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

◆ make_prefix_suffix_table()

vector< size_t > vg::make_prefix_suffix_table ( const char *  pattern,
size_t  len 
)

◆ make_shuffle_seed() [1/4]

string vg::make_shuffle_seed ( const Alignment aln)
inline

Make seeds for Alignments based on their sequences.

◆ make_shuffle_seed() [2/4]

string vg::make_shuffle_seed ( const multipath_alignment_t aln)
inline

Define seed generation for shuffling multipath alignments.

◆ make_shuffle_seed() [3/4]

template<typename T1 , typename T2 >
string vg::make_shuffle_seed ( const pair< T1, T2 > &  p)
inline

Make seeds for pairs of things we can make seeds for.

◆ make_shuffle_seed() [4/4]

template<typename T >
string vg::make_shuffle_seed ( const T *  ptr)
inline

Make seeds for pointers to things we can make seeds for.

◆ 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_temporary_distance_index()

SnarlDistanceIndex::TemporaryDistanceIndex vg::make_temporary_distance_index ( const HandleGraph graph,
const HandleGraphSnarlFinder snarl_finder,
size_t  size_limit 
)

◆ 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()

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

Translate the CIGAR in the given BAM record into mappings in the given Alignment against the given path in the given graph.

◆ 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_is_total_insertion()

bool vg::mapping_is_total_insertion ( 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_handle()

handle_t vg::mapping_to_handle ( const Mapping mapping,
const HandleGraph graph 
)

◆ 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)

◆ mappings_equivalent()

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

◆ 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::view_type  target,
uint32_t  mismatch_limit 
)

◆ match_forward()

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

◆ match_initial()

void vg::match_initial ( GaplessExtension match,
const std::string &  seq,
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.

◆ maximum_distance()

size_t vg::maximum_distance ( const SnarlDistanceIndex &  distance_index,
pos_t  pos1,
pos_t  pos2 
)

◆ 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_edits_in_place()

void vg::merge_edits_in_place ( Edit e,
const Edit f 
)

Glom the second edit into the first, assuming adjacency.

◆ merge_non_branching_subpaths()

void vg::merge_non_branching_subpaths ( multipath_alignment_t multipath_aln,
const unordered_set< size_t > *  prohibited_merges = nullptr 
)

Merges non-branching paths in a multipath alignment in place Does not assume topological order among subpaths

◆ 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_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.

◆ minimizer_reverse_complement()

gbwtgraph::Key64::value_type vg::minimizer_reverse_complement ( gbwtgraph::Key64::value_type  kmer,
size_t  k 
)
inline

Returns the reverse complement of a minimizer index kmer.

◆ minimum_distance()

size_t vg::minimum_distance ( const SnarlDistanceIndex &  distance_index,
pos_t  pos1,
pos_t  pos2,
bool  unoriented_distance,
const HandleGraph graph 
)

◆ 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_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_pdf()

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

◆ normalize_alignment()

void vg::normalize_alignment ( Alignment alignment)

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

◆ num_connected_components()

size_t vg::num_connected_components ( const multipath_alignment_t multipath_aln)

Returns the number of connected components in the multipath alignment.

◆ offset()

offset_t vg::offset ( const pos_t pos)
inline

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

◆ operator!=() [1/7]

bool vg::operator!= ( const Exon lhs,
const Exon rhs 
)

◆ operator!=() [2/7]

bool vg::operator!= ( const Mapping lhs,
const Mapping rhs 
)

◆ operator!=() [3/7]

bool vg::operator!= ( const Path lhs,
const Path rhs 
)

◆ operator!=() [4/7]

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

Two Snarls are unequal if they are not equal.

◆ operator!=() [5/7]

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

Two SnarlTraversals are unequal if they are not equal.

◆ operator!=() [6/7]

bool vg::operator!= ( const Transcript lhs,
const Transcript rhs 
)

◆ operator!=() [7/7]

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+() [1/2]

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

Add two Support values together, accounting for strand.

◆ operator+() [2/2]

template<typename Item >
VectorView<Item>::const_iterator vg::operator+ ( typename VectorView< Item >::const_iterator::difference_type  a,
const typename VectorView< Item >::const_iterator &  b 
)

Allow VectorView iterators to be added to numbers.

◆ 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/7]

bool vg::operator< ( const Exon lhs,
const Exon rhs 
)

◆ operator<() [2/7]

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

◆ operator<() [3/7]

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<() [4/7]

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<() [5/7]

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

Support less-than, based on total coverage.

◆ operator<() [6/7]

bool vg::operator< ( const Transcript lhs,
const Transcript rhs 
)

◆ operator<() [7/7]

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/15]

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

◆ operator<<() [2/15]

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

Benchmark results can be output to streams

◆ operator<<() [3/15]

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

Allow BitStrings to be printed for debugging.

◆ operator<<() [4/15]

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

Print a kmer_t to a stream.

◆ operator<<() [5/15]

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

◆ operator<<() [6/15]

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

Print a NodeSide to a stream.

◆ operator<<() [7/15]

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

Print the given NodeTraversal.

◆ operator<<() [8/15]

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

A Snarl can be printed.

◆ operator<<() [9/15]

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

A Visit can be printed.

◆ operator<<() [10/15]

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

Allow a mapping_t to be printed, for debugging purposes.

◆ operator<<() [11/15]

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

Allow printing a Support.

◆ operator<<() [12/15]

std::ostream& vg::operator<< ( std::ostream &  out,
const Funnel::State state 
)
inline

◆ operator<<() [13/15]

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

Print a pos_t to a stream.

◆ operator<<() [14/15]

std::ostream & vg::operator<< ( std::ostream &  out,
const WFAAlignment::Edit edit 
)

Allow printing an Edit.

◆ operator<<() [15/15]

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

◆ operator==() [1/8]

bool vg::operator== ( const Exon lhs,
const Exon rhs 
)

◆ operator==() [2/8]

bool vg::operator== ( const Mapping lhs,
const Mapping rhs 
)

◆ operator==() [3/8]

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

◆ operator==() [4/8]

bool vg::operator== ( const Path lhs,
const Path rhs 
)

◆ operator==() [5/8]

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==() [6/8]

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==() [7/8]

bool vg::operator== ( const Transcript lhs,
const Transcript rhs 
)

◆ operator==() [8/8]

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/8]

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 of the appropriate type.

◆ parse() [2/8]

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 of the appropriate type.

◆ parse() [3/8]

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

◆ parse() [4/8]

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

◆ parse() [5/8]

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() [6/8]

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

◆ parse() [7/8]

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() [8/8]

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 
)

Populate a mapping from read group to sample name, given the text BAM header.

◆ parse_tid_path_handle_map()

void vg::parse_tid_path_handle_map ( const bam_hdr_t *  hts_header,
const PathHandleGraph graph,
map< int, path_handle_t > &  tid_path_handle 
)

Populate a mapping from target ID number to path handle in the given graph, given a parsed BAM header. The graph may be null. Missing target paths in the graph produce no warning or error and no map entry.

◆ parseGenotypes()

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

◆ partition_gbwt_sequences()

std::vector<std::vector<gbwt::size_type> > vg::partition_gbwt_sequences ( const gbwt::GBWT &  gbwt_index,
const std::unordered_map< nid_t, size_t > &  node_to_job,
size_t  num_jobs 
)

◆ 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 
)

Find all predecessor nodes of the path, ignoring self-loops. If the path does not exist, it is treated as empty.

◆ 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  x)

The standard normal cumulative distribution function.

◆ Phi_inv()

double vg::Phi_inv ( double  p)

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

◆ 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.

◆ populate_snarl_index()

void vg::populate_snarl_index ( SnarlDistanceIndex::TemporaryDistanceIndex &  temp_index,
pair< SnarlDistanceIndex::temp_record_t, size_t >  snarl_index,
size_t  size_limit,
const HandleGraph graph 
)

Record the distance

Add the next node to the priority queue

Check the minimum length of the snarl passing through this node

◆ 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 graph_ptr,
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.

◆ present_kmers()

void vg::present_kmers ( const std::vector< std::vector< HaplotypePartitioner::kmer_type >> &  sequences,
std::vector< std::pair< HaplotypePartitioner::kmer_type, size_t >> &  all_kmers,
sdsl::bit_vector &  kmers_present 
)

◆ 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 
)

Vector containing positive integer values in [begin, end)

◆ range_vector() [2/2]

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

Vector containing positive integer values in [0, end)

◆ rebuild_gbwt() [1/2]

gbwt::GBWT vg::rebuild_gbwt ( const gbwt::GBWT &  gbwt_index,
const std::vector< RebuildJob > &  jobs,
const std::unordered_map< nid_t, size_t > &  node_to_job,
const RebuildParameters parameters 
)

Rebuild the GBWT by applying all provided mappings. Each mapping is a pair (original subpath, new subpath). If the original subpath is empty, the mapping is ignored. If there are multiple applicable mappings, the first one will be used.

The mappings will be applied in both orientations. The reverse mapping replaces the reverse of the original subpath with the reverse of the new subpath.

The first and the last node can be used as context. For example (aXb, aYb) can be interpreted as "replace X with Y in context a b". If both subpaths end with the same node, the cursor will point at that node after the mapping. Otherwise the cursor will be set past the original subpath.

NOTE: To avoid infinite loops, the cursor will proceed after a mapping of the type (a, Xa).

The process can be partitioned into multiple non-overlapping jobs, each of them corresponding to one or more weakly connected components in the graph. Multiple jobs can be run in parallel using 2 threads each, and the jobs will be started from the largest to the smallest.

node_to_job maps each node identifier to the corresponding job identifier. Empty paths go to the first job, but this can be overridden by including gbwt::ENDMARKER in node_to_job.

NOTE: Paths may be reordered if there are multiple jobs. Old path ids are no longer valid after rebuilding the GBWT.

NOTE: This could use the ConstructionJob / MetadataBuilder scheme for parallelization, but it would change the interface.

◆ rebuild_gbwt() [2/2]

gbwt::GBWT vg::rebuild_gbwt ( const gbwt::GBWT &  gbwt_index,
const std::vector< RebuildJob::mapping_type > &  mappings 
)

As the general rebuild_gbwt, but always using a single job with default parameters.

◆ rebuild_gbwt_job()

gbwt::GBWT vg::rebuild_gbwt_job ( const gbwt::GBWT &  gbwt_index,
const RebuildJob job,
size_t  job_id,
const std::vector< gbwt::size_type > &  sequences,
const RebuildParameters parameters 
)

◆ recombinator_sanity_checks()

void vg::recombinator_sanity_checks ( const Recombinator::Parameters parameters)

◆ 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_alignment_sections()

void vg::remove_empty_alignment_sections ( multipath_alignment_t multipath_aln)

Removes all edit, mappings, and subpaths that have no aligned bases, and introduces transitive edges to preserve connectivity through any completely removed subpaths

◆ remove_low_scoring_sections()

void vg::remove_low_scoring_sections ( multipath_alignment_t multipath_aln,
int32_t  max_score_diff 
)

Removes all subpaths and edges whose optimal full length alignment is less than the given difference from the highest-scoring full length alignment

◆ 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 
)

◆ report_exception()

void vg::report_exception ( const std::exception &  ex)

User code should call this if it catches an exception it doesn't know what to do with.

◆ 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,
bool  forward = true 
)

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)

◆ sa_to_da()

void vg::sa_to_da ( std::vector< HaplotypePartitioner::sequence_type > &  sequences,
const gbwt::FastLocate &  r_index 
)

◆ sam_flag()

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

◆ save_gbwt() [1/2]

void vg::save_gbwt ( const gbwt::DynamicGBWT &  index,
const std::string &  filename,
bool  show_progress 
)

Save a dynamic GBWT to the file.

◆ save_gbwt() [2/2]

void vg::save_gbwt ( const gbwt::GBWT &  index,
const std::string &  filename,
bool  show_progress 
)

Save a compressed GBWT to the file.

◆ save_gbwtgraph()

void vg::save_gbwtgraph ( const gbwtgraph::GBWTGraph &  graph,
const std::string &  filename,
bool  show_progress 
)

Save GBWTGraph to the file.

◆ save_gbz() [1/3]

void vg::save_gbz ( const gbwt::GBWT &  index,
gbwtgraph::GBWTGraph &  graph,
const std::string &  filename,
bool  show_progress 
)

Save GBWT and GBWTGraph to the GBZ file.

◆ save_gbz() [2/3]

void vg::save_gbz ( const gbwtgraph::GBZ &  gbz,
const std::string &  filename,
bool  show_progress 
)

Save GBZ to the file.

◆ save_gbz() [3/3]

void vg::save_gbz ( const gbwtgraph::GBZ &  gbz,
const std::string &  gbwt_name,
const std::string &  graph_name,
bool  show_progress 
)

Save GBZ to separate GBWT / GBWTGraph files.

◆ save_gcsa()

void vg::save_gcsa ( const gcsa::GCSA &  index,
const std::string &  filename,
bool  show_progress 
)

Save GCSA to the file.

◆ save_lcp()

void vg::save_lcp ( const gcsa::LCPArray &  lcp,
const std::string &  filename,
bool  show_progress 
)

Save LCP array to the file.

◆ save_minimizer()

void vg::save_minimizer ( const gbwtgraph::DefaultMinimizerIndex &  index,
const std::string &  filename,
bool  show_progress 
)

Save a minimizer index to the file.

◆ save_r_index()

void vg::save_r_index ( const gbwt::FastLocate &  index,
const std::string &  filename,
bool  show_progress 
)

Save an r-index to the file.

◆ score_gap()

int32_t vg::score_gap ( size_t  gap_length,
int32_t  gap_open,
int32_t  gap_extension 
)

Score a gap with the given open and extension scores.

◆ 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)

◆ select_diploid()

std::vector<std::pair<size_t, double> > vg::select_diploid ( const Haplotypes::Subchain subchain,
const std::vector< std::pair< size_t, double >> &  candidates,
const std::vector< std::pair< Recombinator::kmer_presence, double >> &  kmer_types 
)

◆ select_haplotypes()

std::vector<std::pair<size_t, double> > vg::select_haplotypes ( const Haplotypes::Subchain subchain,
const hash_map< Haplotypes::Subchain::kmer_type, size_t > &  kmer_counts,
double  coverage,
Recombinator::Statistics statistics,
std::vector< Recombinator::LocalHaplotype > *  local_haplotypes,
const Recombinator::Parameters parameters 
)

◆ 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_crash_context()

void vg::set_crash_context ( const std::string &  message)

User code should call this when it has context for a failure in its thread.

◆ 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_cigar()

void vg::simplify_cigar ( vector< pair< int, char >> &  cigar)

Merge runs of successive I/D operations into a single I and D, remove 0-length operations, and merge adjacent operations of the same type

◆ 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_pair_by_second()

bool vg::sort_pair_by_second ( const pair< uint32_t, uint32_t > &  lhs,
const pair< uint32_t, uint32_t > &  rhs 
)

◆ sort_permutation() [1/2]

template<typename Iterator >
std::vector<size_t> vg::sort_permutation ( const Iterator &  begin,
const Iterator &  end 
)

Get the index permutation that sorts the given items ascending using <.

◆ sort_permutation() [2/2]

template<typename Iterator >
std::vector<size_t> vg::sort_permutation ( const Iterator &  begin,
const Iterator &  end,
const std::function< bool(const typename Iterator::value_type &, const typename Iterator::value_type &)> &  comparator 
)

Get the index permutation that sorts the given items with the given comparator instead of <.

◆ 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 as defined by a make_shuffle_seed() overload for the collection's item type.

◆ sort_shuffling_ties() [2/2]

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

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

◆ sort_transcript_paths_by_name()

bool vg::sort_transcript_paths_by_name ( const CompletedTranscriptPath lhs,
const CompletedTranscriptPath rhs 
)

◆ split_delims() [1/2]

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

◆ split_delims() [2/2]

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

◆ 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_t, int32_t>, pair<path_t, int32_t> > vg::split_splice_segment ( const Alignment splice_segment,
const tuple< int64_t, int64_t, int64_t > &  left_trace,
const tuple< int64_t, int64_t, int64_t > &  right_trace,
int64_t  splice_junction_idx,
const GSSWAligner scorer,
const HandleGraph graph 
)

◆ stack_permutations()

std::vector< size_t > vg::stack_permutations ( const std::vector< size_t > &  bottom,
const std::vector< size_t > &  top 
)

Apply one permutation on top of another. Retutn the combined permutation.

◆ 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.

◆ starts_with()

bool vg::starts_with ( const std::string &  value,
const std::string &  prefix 
)

Check if a string starts with another string.

◆ 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 
)

◆ stubbify_ref_paths()

void vg::stubbify_ref_paths ( MutablePathMutableHandleGraph graph,
const vector< string > &  ref_prefixes,
int64_t  min_fragment_len,
bool  verbose 
)

stubbify reference

◆ sub_overlaps_of_first_aln()

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

◆ subgraph_containing_path_snarls()

void vg::subgraph_containing_path_snarls ( const SnarlDistanceIndex &  distance_index,
const HandleGraph graph,
const Path path,
std::unordered_set< nid_t > &  subgraph 
)

◆ subgraph_in_distance_range()

void vg::subgraph_in_distance_range ( const SnarlDistanceIndex &  distance_index,
const Path path,
const HandleGraph super_graph,
size_t  min_distance,
size_t  max_distance,
std::unordered_set< nid_t > &  subgraph,
bool  look_forward 
)

◆ subgraph_in_distance_range_walk_across_chain()

void vg::subgraph_in_distance_range_walk_across_chain ( const SnarlDistanceIndex &  distance_index,
const HandleGraph super_graph,
std::unordered_set< nid_t > &  subgraph,
net_handle_t  current_node,
size_t  current_distance,
vector< pair< handle_t, size_t >> &  search_start_nodes,
hash_set< pair< nid_t, bool >> &  seen_nodes,
const size_t &  min_distance,
const size_t &  max_distance,
bool  checked_loop 
)

◆ subgraph_in_distance_range_walk_graph()

void vg::subgraph_in_distance_range_walk_graph ( const HandleGraph super_graph,
size_t  min_distance,
size_t  max_distance,
std::unordered_set< nid_t > &  subgraph,
vector< pair< handle_t, size_t >> &  start_nodes,
hash_set< pair< nid_t, bool >> &  seen_nodes,
const pair< nid_t, bool > &  traversal_start 
)

Helper for subgraph_in_distance_range Given starting handles in the super graph and the distances to each handle (including the start position and

◆ subpath_topological_order()

vector<size_t> vg::subpath_topological_order ( const multipath_alignment_t multipath_aln,
bool  do_index 
)

Return either the vector of topological order by index or the vector of indexes within the topological order.

◆ 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).

◆ summary_statistics()

template<typename Number >
SummaryStatistics vg::summary_statistics ( const std::map< Number, size_t > &  values)

Returns summary statistics for a multiset of numbers.

◆ 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.

◆ take_unique_minimizers()

std::vector<HaplotypePartitioner::kmer_type> vg::take_unique_minimizers ( const std::string &  sequence,
const HaplotypePartitioner::minimizer_index_type minimizer_index 
)

◆ target_alignment() [1/2]

Alignment vg::target_alignment ( const PathPositionHandleGraph graph,
const path_handle_t path,
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 path_handle_t path,
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_to_graph_spanned()

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

◆ threads_for_contig()

std::vector< gbwt::size_type > vg::threads_for_contig ( const gbwt::GBWT &  gbwt_index,
const std::string &  contig_name 
)

Return the list of thread ids / gbwt path ids for the given contig.

◆ threads_for_sample()

std::vector< gbwt::size_type > vg::threads_for_sample ( const gbwt::GBWT &  gbwt_index,
const std::string &  sample_name 
)

Return the list of thread ids / gbwt path ids for the given sample.

◆ 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/3]

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

◆ to_string() [2/3]

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

◆ to_string() [3/3]

std::string vg::to_string ( handle_t  handle)

◆ to_string_gbwtgraph() [1/2]

std::string vg::to_string_gbwtgraph ( gbwt::node_type  node)

Returns a string representation of a GBWTGraph node.

◆ to_string_gbwtgraph() [2/2]

std::string vg::to_string_gbwtgraph ( handle_t  handle)

Returns a string representation of a GBWTGraph handle.

◆ 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)

◆ toUppercaseInPlace()

void vg::toUppercaseInPlace ( 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 >, vector< tuple< int64_t, 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,
bool  search_left,
int64_t  search_limit 
)

Returns a pair of (mapping, edit, base) and possibly multiple (subpath, mapping, edit, base),of the furthest position that can be traced through the multipath alignment along the pathstarting the indicated position in the multipath alignment. The path can be traced rightward starting at the beginning, or leftward starting. Search is limited to not passing a given mapping on the path.

◆ transcript_file_nonempty()

bool vg::transcript_file_nonempty ( const string &  transcripts)

◆ transfer_between_proto_annotation()

template<class ProtoAlignment1 , class ProtoAlignment2 >
void vg::transfer_between_proto_annotation ( const ProtoAlignment1 &  from,
ProtoAlignment2 &  to 
)

◆ 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 the annotations that are carried with the Protobuf formats but not the internal multipath_alignment_t (and which therefore get lost when using it as an intermediate format).

◆ 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 
)

◆ transfer_read_metadata() [2/6]

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

All functions of this form transfer:

  • sequence
  • base quality
  • mapping quality
  • read annotations (including multiple encodings of secondary)

◆ transfer_read_metadata() [3/6]

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

◆ transfer_read_metadata() [4/6]

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

◆ 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 
)

◆ transfer_uniform_metadata()

template<class Alignment1 , class Alignment2 >
void vg::transfer_uniform_metadata ( const Alignment1 &  from,
Alignment2 &  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() [1/2]

string vg::traversal_to_string ( const PathHandleGraph graph,
const Traversal traversal,
int64_t  max_steps 
)

◆ traversal_to_string() [2/2]

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 
)

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

◆ vcf_contigs()

vector<string> vg::vcf_contigs ( const string &  filename)

◆ 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.

◆ visit_contained_snarls()

void vg::visit_contained_snarls ( const PathPositionHandleGraph graph,
const vector< Region > &  regions,
SnarlManager snarl_manager,
bool  include_endpoints,
function< void(const Snarl *, step_handle_t, step_handle_t, int64_t, int64_t, bool, const Region *)>  visit_fn 
)

Visit each snarl if it is fully contained in at least one region from the input set. Only the top-most snarl is visited. The parameters to visit_fn are: <the snarl, start_step, end_step, steps_reversed, the containing input region>

◆ 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.

◆ weighted_jaccard_coefficient()

double vg::weighted_jaccard_coefficient ( const PathHandleGraph graph,
const multiset< handle_t > &  target,
const multiset< handle_t > &  query 
)

◆ 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 
)

◆ with_exception_handling()

void vg::with_exception_handling ( const std::function< void(void)> &  body)

User code should call this to get all its exceptions handled.

◆ worst_alignment_score()

int32_t vg::worst_alignment_score ( const multipath_alignment_t multipath_aln)

Returns the score of the lowest-scoring source-to-sink alignment in the multipath_alignment_t. Assumes that subpaths are topologically ordered and starts have been identified.

◆ 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(). In the case that the size limit is exceeded, throws a SizeLimitExceededException and deletes the temp file.

◆ xg_index_size()

size_t vg::xg_index_size ( const xg::XG index)

Variable Documentation

◆ BAM_DNA_LOOKUP

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

◆ fullTrace

bool vg::fullTrace = false

◆ ISSUE_URL

const char* vg::ISSUE_URL = "https://github.com/vgteam/vg/issues/new/choose"

◆ NO_INDEX

const alignment_index_t vg::NO_INDEX {std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max(), std::numeric_limits<bool>::max()}

Represents an unset index.

◆ NO_READ_INDEX

const read_alignment_index_t vg::NO_READ_INDEX = {std::numeric_limits<size_t>::infinity(), std::numeric_limits<size_t>::infinity()}

Represents an unset index.

◆ stored_crash_context

thread_local std::string vg::stored_crash_context

◆ var

const char* vg::var = "VG_FULL_TRACEBACK"