Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge SpLitteR #1366

Open
wants to merge 158 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
d5ce5d4
Some small include cleanup
asl Apr 8, 2024
a83a25f
Add example gfa splitter
asl Mar 22, 2021
005ebb7
Split GFA paths as well
asl Apr 19, 2021
533ac5e
Switch to new GFA parser
asl Jun 6, 2022
055bd0c
Add link info to vertices. Fix graph reading
Itolstoganov Oct 3, 2022
5bdf83c
Split GFA paths as well
asl Apr 19, 2021
53bb961
Initial commit
Itolstoganov Jul 13, 2016
73cd059
Added serialization
Itolstoganov Jul 18, 2016
ee3a22e
Changed main data structure to pair of separate maps for head and tai…
Itolstoganov Jul 19, 2016
a88e3b7
Added visualization
Jul 20, 2016
b3aacb3
Changed barcode mapper structure
Itolstoganov Jul 25, 2016
f65b655
Changed BarcodeMapper structure
Itolstoganov Jul 28, 2016
3454721
Find following edges via dijkstra
Aug 5, 2016
ad66757
Changed barcode score. Added path scaffolder. Paired-end stages
Aug 11, 2016
6d5829a
Added relative threshold to extension chooser
Aug 29, 2016
3b3aee8
Io refactoring
Itolstoganov Sep 5, 2016
96c2d69
Changed coverage checks in PathJoiner
Itolstoganov Sep 8, 2016
e5ed92c
Changed high coverage threshold (meaningless commit)
Itolstoganov Sep 20, 2016
0a4669e
Made changes according to the newest version
Itolstoganov Sep 22, 2016
2b8815b
Added threshold on relative barcode coverage
Itolstoganov Oct 26, 2016
e40248c
Barcode threshold now depends on gap length
Itolstoganov Nov 2, 2016
5893ae0
Basic 10X support. BarcodeMapper refactoring
Itolstoganov Nov 17, 2016
0ca8890
Added 10X statistics
Itolstoganov Dec 29, 2016
28d117f
Merged rr into general pipeline
Itolstoganov Jan 13, 2017
3cffa98
Added backward check in read cloud resolver
Itolstoganov Feb 4, 2017
b5bc3c1
Separated storage from info extraction in BarcodeIndex. Various filters
Itolstoganov Feb 6, 2017
512d4f8
added new type of library: Clouds10x and new spades.py parameter --ge…
AntonBankevich Feb 22, 2017
37b211e
Documentation stub. Added method that allows to get reliable barcode …
Itolstoganov Mar 10, 2017
13ed588
Moved statistics into separate project
Itolstoganov Mar 13, 2017
492de69
Removed gap closer optimization cutoff. Fixed online_vis. Added separ…
Itolstoganov Mar 15, 2017
25d5e94
Fixed initial filter validation
Itolstoganov Mar 21, 2017
7d7985f
Added closest edge topology check
Itolstoganov Mar 22, 2017
846ffce
Added dijkstra based on paired info scaffolding
Itolstoganov Mar 24, 2017
b456c73
Added command that prints barcode info to online_vis. Added more reli…
Itolstoganov Mar 30, 2017
29eb8e8
Added parametrized gap distribution to read cloud statistics
Itolstoganov Apr 12, 2017
87a0a5d
first version of read cloud based polisher
Itolstoganov Apr 26, 2017
1c1f6e0
Added paired-end polisher. Removed dijkstra polisher
Itolstoganov May 10, 2017
f5cf461
Check for coverage breaks in the absence of candidates
Itolstoganov Jun 19, 2017
886a20e
Add transition statistics
Itolstoganov Jul 3, 2017
d3a0630
Enable cloud gap closer. Add capacity stats.
Itolstoganov Jul 11, 2017
e90591b
Lengthen the regions of the long edges from which barcodes are extracted
Itolstoganov Jul 11, 2017
695cb76
Add read cloud clusters extraction. Extract barcodes from the end of …
Itolstoganov Jul 21, 2017
33b92c4
Change configs. Extract barcodes from the beginning of the candidate …
Itolstoganov Jul 31, 2017
2935900
Add reference path connection statistics. Filter transitions from non…
Itolstoganov Aug 22, 2017
0a255ce
Store total number of barcodes in barcode index
Itolstoganov Sep 5, 2017
2a2c992
Add scaffold graph construction pipeline. Add new statistics stages.
Itolstoganov Sep 15, 2017
2278f52
Implement composite connection predicate
Itolstoganov Oct 31, 2017
0b915a7
Add scaffolding resolver to spades pipeline
Itolstoganov Nov 7, 2017
e22d390
Add ScaffoldVertex interface. Generalize scaffold graph constructing …
Itolstoganov Nov 17, 2017
708efd3
Add read cloud path scaffolder
Itolstoganov Nov 23, 2017
f8f0e10
Use new scoring functions in read cloud path polisher.
Itolstoganov Nov 24, 2017
63dcfae
Add reference validation mode.
Itolstoganov Dec 1, 2017
319d67b
Save scaffold graph after initial construction
Itolstoganov Dec 4, 2017
f9b54db
Use containment index as main score. Add more statistics to validation.
Itolstoganov Dec 6, 2017
8a6e22a
Introduce new barcode connection criteria
Itolstoganov Jan 26, 2018
ae7dc9b
Automatic detection of containment index threshold
Itolstoganov Jan 30, 2018
d05f76b
Improve read cloud path polishing
Itolstoganov Feb 1, 2018
f1870f4
Cluster storage can be created from path scaffold graph
Itolstoganov Feb 6, 2018
bf9386a
Add barcode connection scaffolding
Itolstoganov Feb 13, 2018
1b1007b
Add recording barcode connection predicate. Add print long edge comma…
Itolstoganov Feb 19, 2018
485fb64
Add read cloud scaffold graph gap closer
Itolstoganov Mar 11, 2018
489a5cb
Use barcodes from unique edges only in EntryCollector. Change score i…
Itolstoganov Mar 14, 2018
2587b8c
Add basic scaffolding procedure to scaffold graph gap close
Itolstoganov Mar 20, 2018
5d86d76
Add partial construction callers documentation
Itolstoganov Mar 22, 2018
c27f308
Add read cloud path extender to path extend pipeline
Itolstoganov Mar 26, 2018
26c304b
Analyze paired-end scaffolder results
Itolstoganov Apr 17, 2018
c34cfe3
Add score threshold estimation based on segments of long edges. Add s…
Itolstoganov May 17, 2018
4cba21a
Integrate short edge score and score estimator into scaffold graph co…
Itolstoganov May 21, 2018
51d8606
Estimate training assembly graph edge length.
Itolstoganov May 22, 2018
e296461
Estimate training edge length for cluster statistics extraction. Inco…
Itolstoganov May 30, 2018
8512ed6
Add top min filter for read cloud extender. Serialize cloud distribut…
Itolstoganov Jun 1, 2018
39407ad
Add 10x info in manual and help. Add path cluster statistics
Itolstoganov Jun 26, 2018
50fff85
Add path extraction procedure to scaffold graph polisher
Itolstoganov Jul 25, 2018
20b2ff3
Change scaffold graph polisher behaviour: remove repeat vertices, use…
Itolstoganov Aug 1, 2018
33523ee
Add new long-edge cloud extraction procedure
Itolstoganov Aug 23, 2018
c7fa066
Add cloud filtering procedure
Itolstoganov Nov 21, 2018
f8e59a8
Contracted graph simplification. Support path vertices in scaffold gr…
Itolstoganov Nov 30, 2018
411cfd6
Change transitive filter threshold
Itolstoganov Apr 4, 2019
2285111
Simple barcode index binary serialization
Itolstoganov Jun 18, 2019
f759cfc
Remove scaffold graph-related stages. Remove old statistics project
Itolstoganov Jul 9, 2019
ffa4e59
Reorganize paths and namespaces, remove scaffold graph storage
Itolstoganov Jul 15, 2019
3d01271
Turn off path scaffolding in preliminary rr
Itolstoganov Aug 9, 2019
1b98132
ьReformat read cloud contigs, remove unnecessary boost file. Extender…
Itolstoganov Aug 26, 2019
802fae0
Refactor scaffold graph construction pipeline
Aug 21, 2020
5fbf4df
Scaffold graph validation improvements
Sep 14, 2020
387c94a
Postrebase fixes. Turn off searching extender and path extender path …
Itolstoganov Aug 23, 2021
46eff64
Initial containment index extractor
Itolstoganov Aug 30, 2021
cb630c1
Path storage extractor
Itolstoganov Sep 6, 2021
03185d8
Add hifi scaffold graph construction, path cluster extractor fix
Itolstoganov Sep 8, 2021
42bdae3
Barcode index construction optimization
Itolstoganov Sep 8, 2021
3820336
Update barcode index
Itolstoganov Sep 14, 2021
5741a44
Construct scaffold graph using reversed index
Itolstoganov Sep 14, 2021
db8a57e
Use ReadProcessor for barcode index construction. Part 1
Itolstoganov Sep 17, 2021
effd185
Use ReadProcessor for barcode index construction. Part 2
Itolstoganov Sep 20, 2021
98a2217
Conjugate edges and reads fix
Itolstoganov Sep 21, 2021
280cfa6
Add scaffold graph serialization, minor refactoring
Itolstoganov Sep 22, 2021
818f1e7
Add iterator-based scaffold graph constructor
Itolstoganov Sep 25, 2021
1458176
Iterator graph constructor optimization
Itolstoganov Sep 28, 2021
ef19ec9
Long edge cluster stats. Scaffold graph comparison
Itolstoganov Sep 29, 2021
2bbbad7
Add HiFi links parser. Compare HiFi and TellSeq scores.
Itolstoganov Oct 6, 2021
b173afe
Ensure we can create edge index with non-default k-mers. Only unique …
asl Oct 4, 2021
affea42
Add short kmer sequence mapper
asl Oct 4, 2021
fb12dab
Iterator based intersection
Itolstoganov Oct 13, 2021
2eee080
Jaccard index output
Itolstoganov Oct 25, 2021
306e148
Add reference validation
Itolstoganov Nov 21, 2021
c68db4a
Add multiplex dbg reading
Itolstoganov Nov 22, 2021
adbf6e9
Cut edges during multiplex graph reading
Itolstoganov Nov 23, 2021
2ab1ef6
Change multiplex graph only in multi-edge neighbourhood
Itolstoganov Nov 28, 2021
4afdf05
Add double coverage stat, refactor reference path checker
Itolstoganov Nov 30, 2021
f96078c
Add 3-path extraction
Itolstoganov Dec 5, 2021
4a0257b
Add two kmer mapper and vertex statistics
Itolstoganov Dec 20, 2021
86b4661
Uncomressed vertex statistics
Itolstoganov Dec 27, 2021
1610e8c
Use simple blunt graphs
Itolstoganov Jan 21, 2022
6e7cf36
Print covered vertices
Itolstoganov Feb 21, 2022
8d3ec85
Vertex resolver refactoring, pt 1
Itolstoganov Mar 27, 2022
a8a077a
Vertex resolver refactoring, pt 2
Itolstoganov Mar 29, 2022
c4ca48b
Simple path extraction
Itolstoganov Mar 31, 2022
8c8e143
Process multiple libs
Itolstoganov Apr 19, 2022
29773f7
Increase default tail threshold
Itolstoganov Jun 7, 2022
652a466
Postrebase fixes
Itolstoganov Jun 13, 2022
622d29d
Add path support
Itolstoganov Jun 27, 2022
ad7e8b0
Path statistics, add single edges
Itolstoganov Jul 17, 2022
dbe4343
Small path fixes, graph output
Itolstoganov Jul 27, 2022
8d62f5a
Fix merging
Itolstoganov Jul 30, 2022
18f9a84
Fix edge merging overlap bug, some refactoring
Itolstoganov Aug 1, 2022
95e32c7
Support complex links for split
Itolstoganov Nov 17, 2022
2d3bbc5
Support edge merging
Itolstoganov Nov 19, 2022
cad1182
Add meta mode. Use contracted graph for VertexResolver
Itolstoganov Nov 28, 2022
f47392c
Fix contig output for contracted graphs
Itolstoganov Nov 28, 2022
c32d1cc
Check if linked-read links are supported by the graph
Itolstoganov Dec 8, 2022
201dfb9
Split partially resolved vertices
Itolstoganov Dec 12, 2022
3a60d97
Remove graph link check for diploid graphs
Dec 13, 2022
01a3518
Rename project
Itolstoganov Dec 14, 2022
df73321
Add readme. Refactor command line
Itolstoganov Dec 14, 2022
384f8b5
Use metaFlye assembly info for meta mode
Itolstoganov Dec 16, 2022
1e99614
Add relative score parameter
Itolstoganov Jan 6, 2023
35adf14
Add gaps or non-incident edges
Itolstoganov Jan 29, 2023
935f971
Replace non-graph links with gaps regardless of origin
Itolstoganov Jan 30, 2023
f27983a
Temporarily ignore simple vertices
Feb 6, 2023
43473bb
Support tellseq libraries
Itolstoganov Feb 18, 2023
9154196
Do not check first char in sequence
Itolstoganov Feb 22, 2023
2b280cc
Additional logging
Itolstoganov Feb 23, 2023
347966d
Downsampling option
Itolstoganov Feb 24, 2023
53e7e60
Fix downsampling
Itolstoganov Mar 1, 2023
0b893e4
Make downsampling actually uniform
Itolstoganov Mar 3, 2023
c6fc31e
Add scaffold links. Recsue links from ambiguous vertices.
Itolstoganov Apr 3, 2023
8b6364b
Use scaffold links in vertex resolution
Itolstoganov May 2, 2023
4db98f1
Fix index building from 10x format
Itolstoganov May 2, 2023
58ab07f
Refactor main. Remove unnecessary statistics. Fix\silence warnings.
Itolstoganov Apr 3, 2023
9121636
Remove path checker, refactor path extractor
Itolstoganov Apr 3, 2023
1c4ac74
Remove long edge based statistics
Itolstoganov May 23, 2023
bd4a141
Remove most of cloudspades
Itolstoganov May 23, 2023
df409cc
Fix edge merging
Itolstoganov May 29, 2023
a8b11fb
Remove unnecessary logging. Postrebase fix
Itolstoganov May 29, 2023
257b27d
Ignore graph links for simple graphs
Itolstoganov Jun 5, 2023
3c838cc
Update manual and cli
Itolstoganov Jun 5, 2023
fa5b336
Sparsify barcode edge coverage
Itolstoganov Jun 27, 2023
90a6bf5
Postrebase fixes, restore main spades pipeline
Itolstoganov Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ext/src/ncbi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include(ExternalProject)

ExternalProject_Add(ncbi_vdb_ext
GIT_REPOSITORY "https://github.com/ncbi/ncbi-vdb.git"
GIT_TAG "3.0.8"
GIT_TAG "3.1.0"
GIT_SHALLOW 1
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/vdb.patch
BUILD_ALWAYS OFF
Expand All @@ -29,12 +29,12 @@ ExternalProject_Add(ncbi_vdb_ext
CMAKE_CACHE_ARGS ${CL_ARGS})
ExternalProject_Get_property(ncbi_vdb_ext INSTALL_DIR)
set(NCBI_VDB_PREFIX ${INSTALL_DIR})
set(NCBI_VDB_INCLUDE ${NCBI_VDB_PREFIX}/include)
set(NCBI_VDB_LIB ${NCBI_VDB_PREFIX}/lib)
set(NCBI_VDB_INCLUDE ${NCBI_VDB_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
set(NCBI_VDB_LIB ${NCBI_VDB_PREFIX}/${CMAKE_INSTALL_LIBDIR})

ExternalProject_Add(ncbi_sratools_ext
GIT_REPOSITORY "https://github.com/ncbi/sra-tools.git"
GIT_TAG "3.0.8"
GIT_TAG "3.1.0"
GIT_SHALLOW 1
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/sratools.patch
BUILD_ALWAYS OFF
Expand All @@ -43,12 +43,12 @@ ExternalProject_Add(ncbi_sratools_ext
-DVDB_INCDIR=${NCBI_VDB_INCLUDE}
-DVDB_LIBDIR=${NCBI_VDB_LIB}
-DNO_JAVA=ON
CMAKE_CACHE_ARGS ${CL_ARGS})
add_dependencies(ncbi_sratools_ext ncbi_vdb_ext)
CMAKE_CACHE_ARGS ${CL_ARGS})
add_dependencies(ncbi_sratools_ext ncbi_vdb_ext)
ExternalProject_Get_property(ncbi_sratools_ext INSTALL_DIR)
set(NCBI_SRATOOLS_PREFIX ${INSTALL_DIR})
set(NCBI_SRATOOLS_INCLUDE ${NCBI_SRATOOLS_PREFIX}/include)
set(NCBI_SRATOOLS_LIB ${NCBI_SRATOOLS_PREFIX}/lib)
set(NCBI_SRATOOLS_INCLUDE ${NCBI_SRATOOLS_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
set(NCBI_SRATOOLS_LIB ${NCBI_SRATOOLS_PREFIX}/${CMAKE_INSTALL_LIBDIR})

add_library(ncbi-sdk INTERFACE)

Expand Down
2 changes: 1 addition & 1 deletion src/cmake/proj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Side-by-side subprojects layout: automatically set the
# SPADES_EXTERNAL_${project}_SOURCE_DIR using SPADES_ALL_PROJECTS
set(SPADES_ALL_PROJECTS "spades;hammer;ionhammer;corrector;spaligner;spades_tools;binspreader;pathracer")
set(SPADES_ALL_PROJECTS "spades;hammer;ionhammer;corrector;spaligner;spades_tools;binspreader;pathracer;splitter")
set(SPADES_EXTRA_PROJECTS "mts;online_vis;cds_subgraphs")
set(SPADES_KNOWN_PROJECTS "${SPADES_ALL_PROJECTS};${SPADES_EXTRA_PROJECTS}")
set(SPADES_ENABLE_PROJECTS "" CACHE STRING
Expand Down
7 changes: 4 additions & 3 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ add_subdirectory(pipeline)
add_subdirectory(sequence)
add_subdirectory(assembly_graph)
add_subdirectory(alignment)
add_subdirectory(auxiliary_graphs)
add_subdirectory(modules/path_extend)
add_subdirectory(modules)
add_subdirectory(paired_info)
Expand All @@ -29,7 +30,7 @@ add_library(common_modules
adt/concurrent_dsu.cpp)

target_link_libraries(common_modules library
assembly_graph input pipeline sequence
coverage_model paired_info path_extend
stages mph_index modules
assembly_graph auxiliary_graphs input
pipeline sequence coverage_model
paired_info path_extend stages mph_index modules
utils configs alignment)
2 changes: 1 addition & 1 deletion src/common/assembly_graph/core/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class DeBruijnGraph: public omnigraph::ObservableGraph<DeBruijnDataMaster> {
}

auto move_links(VertexId v) {
data(v).move_links();
return data(v).move_links();
}

auto clear_links(VertexId v) {
Expand Down
18 changes: 18 additions & 0 deletions src/common/auxiliary_graphs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
############################################################################
# Copyright (c) 2019 Saint Petersburg State University
# All Rights Reserved
# See file LICENSE for details.
############################################################################

project(auxiliary_graphs CXX)

add_library(auxiliary_graphs STATIC
contracted_graph/contracted_graph.cpp
contracted_graph/contracted_graph_builder.cpp
contracted_graph/contracted_graph_helper.cpp
contracted_graph/graph_condensation.cpp
contracted_graph/contracted_statistics.cpp
scaffold_graph/scaffold_vertex.cpp
scaffold_graph/scaffold_graph.cpp)

target_link_libraries(auxiliary_graphs assembly_graph)
203 changes: 203 additions & 0 deletions src/common/auxiliary_graphs/contracted_graph/contracted_graph.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
//***************************************************************************
//* Copyright (c) 2019 Saint Petersburg State University
//* All Rights Reserved
//* See file LICENSE for details.
//***************************************************************************

#include "contracted_graph.hpp"

namespace contracted_graph {

void AdjacencyMap::InsertPair(const AdjacencyMap::VertexId &vertex, const AdjacencyMap::ScaffoldVertex &edge) {
data_[vertex].insert(edge);
}
AdjacencyMap::const_iterator AdjacencyMap::begin() const {
return data_.begin();
}
AdjacencyMap::const_iterator AdjacencyMap::end() const {
return data_.end();
}
void AdjacencyMap::RemovePair(const VertexId &vertex, const AdjacencyMap::ScaffoldVertex &edge) {
data_.at(vertex).erase(edge);
if (data_.at(vertex).empty()) {
data_.erase(vertex);
}
}
bool AdjacencyMap::Contains(const VertexId &vertex, const AdjacencyMap::ScaffoldVertex &edge) {
auto vertex_entry = data_.find(vertex);
if (vertex_entry == data_.end()) {
return false;
}
return vertex_entry->second.find(edge) != vertex_entry->second.end();
}
bool AdjacencyMap::empty() const {
return data_.empty();
}
size_t AdjacencyMap::size() const {
return data_.size();
}

void ContractedGraph::InsertVertex(const ContractedGraph::VertexId &vertex) {
if (vertices_.insert(vertex).second) {
AdjacencyMap empty;
incoming_[vertex] = empty;
outcoming_[vertex] = empty;
}
}
void ContractedGraph::InsertEdge(const ContractedGraph::VertexId &head, const ContractedGraph::VertexId &tail,
const ContractedGraph::ScaffoldVertex &edge) {
VERIFY_DEV(vertices_.find(head) != vertices_.end());
VERIFY_DEV(vertices_.find(tail) != vertices_.end());
outcoming_[head].InsertPair(tail, edge);
incoming_[tail].InsertPair(head, edge);
}
ContractedGraph::const_entry_iterator ContractedGraph::in_entry_begin(const ContractedGraph::VertexId &vertex) const {
return incoming_.at(vertex).begin();
}
ContractedGraph::const_entry_iterator ContractedGraph::in_entry_end(const ContractedGraph::VertexId &vertex) const {
return incoming_.at(vertex).end();
}
adt::iterator_range<ContractedGraph::const_entry_iterator> ContractedGraph::IncomingEntries(
const ContractedGraph::VertexId &vertex) const {
return adt::make_range(in_entry_begin(vertex), in_entry_end(vertex));
}
ContractedGraph::const_entry_iterator ContractedGraph::out_entry_begin(const ContractedGraph::VertexId &vertex) const {
return outcoming_.at(vertex).begin();
}
ContractedGraph::const_entry_iterator ContractedGraph::out_entry_end(const ContractedGraph::VertexId &vertex) const {
return outcoming_.at(vertex).end();
}
adt::iterator_range<ContractedGraph::const_entry_iterator> ContractedGraph::OutcomingEntries(
const ContractedGraph::VertexId &vertex) const {
return adt::make_range(out_entry_begin(vertex), out_entry_end(vertex));
}
size_t ContractedGraph::GetOutDegree(const ContractedGraph::VertexId &vertex) const {
size_t result = 0;
for (const auto &entry: outcoming_.at(vertex)) {
result += entry.second.size();
}
return result;
}
size_t ContractedGraph::GetInDegree(const ContractedGraph::VertexId &vertex) const {
size_t result = 0;
for (const auto &entry: incoming_.at(vertex)) {
result += entry.second.size();
}
return result;
}
size_t ContractedGraph::GetCapacity(const ContractedGraph::VertexId &vertex) const {
return capacity_.at(vertex);
}
void ContractedGraph::InsertCapacity(const ContractedGraph::VertexId &vertex, size_t capacity) {
capacity_[vertex] = capacity;
}
bool ContractedGraph::ContainsVertex(const ContractedGraph::VertexId &vertex) const {
return vertices_.find(vertex) != vertices_.end();
}
ContractedGraph::const_vertex_iterator ContractedGraph::begin() const {
return vertices_.begin();
}
ContractedGraph::const_vertex_iterator ContractedGraph::end() const {
return vertices_.end();
}
size_t ContractedGraph::size() const {
return vertices_.size();
}
size_t ContractedGraph::CountEdges() const {
size_t result = 0;
for (const auto &vertex: vertices()) {
result += GetOutDegree(vertex);
}
return result;
}
void ContractedGraph::RemoveEdge(const VertexId &head, const VertexId &tail, const ContractedGraph::ScaffoldVertex &edge) {
VERIFY_DEV(ContainsVertex(head));
VERIFY_DEV(ContainsVertex(tail));
auto &head_outcoming = outcoming_.at(head);
auto &tail_incoming = incoming_.at(tail);
if (not head_outcoming.Contains(tail, edge)) {
return;
}
VERIFY_DEV(tail_incoming.Contains(head, edge));
head_outcoming.RemovePair(tail, edge);
tail_incoming.RemovePair(head, edge);
}
ContractedGraph::ContractedGraph(const Graph &assembly_graph) : assembly_graph_(assembly_graph) {}

const debruijn_graph::Graph &ContractedGraph::GetAssemblyGraph() const {
return assembly_graph_;
}
ContractedGraph::ScaffoldVertex ContractedGraph::conjugate(ContractedGraph::ScaffoldVertex edge) const {
return edge.GetConjugateFromGraph(assembly_graph_);
}
//std::string ContractedGraph::EdgeNucls(ContractedGraph::EdgeId edge) const {
// return edge.GetSequence(assembly_graph_);
//}

double ContractedGraph::coverage(ContractedGraph::EdgeId edge) const {
return edge.GetCoverageFromGraph(assembly_graph_);
}
size_t ContractedGraph::length(ContractedGraph::EdgeId edge) const {
return edge.GetLengthFromGraph(assembly_graph_);
}
size_t ContractedGraph::int_id(ContractedGraph::EdgeId edge) const {
return edge.int_id();
}
adt::iterator_range<ContractedGraph::const_vertex_iterator> ContractedGraph::vertices() const {
return adt::make_range(begin(), end());
}
ContractedGraph::const_edge_iterator ContractedGraph::in_edge_begin(const VertexId &vertex) const {
auto entry_begin = in_entry_begin(vertex);
if (not incoming_.at(vertex).empty()) {
return ContractedGraph::const_edge_iterator(entry_begin, entry_begin->second.begin(), in_entry_end(vertex));
}
return const_edge_iterator(entry_begin, empty_.end(), in_entry_end(vertex));
}
ContractedGraph::const_edge_iterator ContractedGraph::in_edge_end(const VertexId &vertex) const {
auto entry_end = in_entry_end(vertex);
auto entry_last = std::prev(entry_end);
if (not incoming_.at(vertex).empty()) {
return const_edge_iterator(entry_end, entry_last->second.end(), entry_end);
}
return const_edge_iterator(entry_end, empty_.end(), entry_end);
}
adt::iterator_range<ContractedGraph::const_edge_iterator> ContractedGraph::IncomingEdges(const VertexId &vertex) const {
return adt::make_range(in_edge_begin(vertex), in_edge_end(vertex));
}

ContractedGraph::const_edge_iterator ContractedGraph::out_edge_begin(const VertexId &vertex) const {
auto entry_begin = out_entry_begin(vertex);
if (not outcoming_.at(vertex).empty()) {
return ContractedGraph::const_edge_iterator(entry_begin, entry_begin->second.begin(), out_entry_end(vertex));
}
return const_edge_iterator(entry_begin, empty_.end(), out_entry_end(vertex));
}
ContractedGraph::const_edge_iterator ContractedGraph::out_edge_end(const VertexId &vertex) const {
auto entry_end = out_entry_end(vertex);
auto entry_last = std::prev(entry_end);
if (not outcoming_.at(vertex).empty()) {
return const_edge_iterator(entry_end, entry_last->second.end(), entry_end);
}
return const_edge_iterator(entry_end, empty_.end(), entry_end);
}
adt::iterator_range<ContractedGraph::const_edge_iterator> ContractedGraph::OutgoingEdges(const VertexId &vertex) const {
return adt::make_range(out_edge_begin(vertex), out_edge_end(vertex));
}
auto ContractedGraph::canonical_edges() const {
return assembly_graph_.canonical_edges();
}
ContractedGraph::VertexId ContractedGraph::conjugate(const ContractedGraph::VertexId &vertex) const {
return assembly_graph_.conjugate(vertex);
}
Sequence ContractedGraph::EdgeNucls(ContractedGraph::EdgeId edge) const {
VERIFY(edge.GetType() == scaffold_graph::ScaffoldVertexT::Edge);
assembly_graph_.EdgeNucls(edge.GetFirstEdge());
}
size_t ContractedGraph::IncomingEdgeCount(const ContractedGraph::VertexId &vertex) const {
return incoming_.at(vertex).size();
}
size_t ContractedGraph::OutgoingEdgeCount(const contracted_graph::ContractedGraph::VertexId &vertex) const {
return outcoming_.at(vertex).size();
}

}
Loading
Loading