Skip to content

Commit

Permalink
Corrects issue with no colours being included in merged graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Horsfield committed Jan 23, 2025
1 parent f9d5dfd commit c6d1119
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
17 changes: 14 additions & 3 deletions src/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ GraphTuple Graph::update (const std::string& graphfile,
// read in 1st graph
ColoredCDBG<> ccdbg_a;
ccdbg_a.read(graphfile, coloursfile, num_threads);
// need to add to _ref_paths, _read_paths

//set local variables
kmer = ccdbg_a.getK();
Expand All @@ -212,7 +211,10 @@ GraphTuple Graph::update (const std::string& graphfile,
nb_colours_a = ccdbg_a.getNbColors();
// get colour names
input_colours_a = ccdbg_a.getColorNames();

for (const auto& entry : input_colours_a)
{
_ref_paths.push_back(entry);
}

if (infile2 != "NA") {
is_ref = 0;
Expand Down Expand Up @@ -244,7 +246,16 @@ GraphTuple Graph::update (const std::string& graphfile,
opt.verbose = true;
opt.prefixFilenameOut = outpref;

cout << "Simplfying merged coloured compacted DBGs..." << endl;
// add filenames to graph
for (const auto& entry : _ref_paths)
{
opt.filename_ref_in.push_back(entry);
}
for (const auto& entry : _read_paths)
{
opt.filename_seq_in.push_back(entry);
}

ccdbg_a.simplify(opt.deleteIsolated, opt.clipTips, opt.verbose);
cout << "Building colours for merged compacted DBGs..." << endl;
ccdbg_a.buildColors(opt);
Expand Down
10 changes: 5 additions & 5 deletions src/indexing.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// ggCaller header
#include "indexing.h"

ColoredCDBG<MyUnitigMap> buildGraphvoid (const std::string& infile_1,
ColoredCDBG<MyUnitigMap> buildGraph (const std::string& infile_1,
const std::string& infile_2,
const bool is_ref,
const int kmer,
const int threads,
const bool verb,
const bool write_graph,
const std::string& output_prefix,
std::vector<std::string> _ref_paths,
std::vector<std::string> _read_paths)
std::vector<std::string>& _ref_paths,
std::vector<std::string>& _read_paths)
{
std::ifstream infile1(infile_1);
std::ifstream infile2(infile_2);
Expand Down Expand Up @@ -70,8 +70,8 @@ ColoredCDBG<> buildGraphvoid (const std::string& infile_1,
const bool verb,
const bool write_graph,
const std::string& output_prefix,
std::vector<std::string> _ref_paths,
std::vector<std::string> _read_paths)
std::vector<std::string>& _ref_paths,
std::vector<std::string>& _read_paths)
{
std::ifstream infile1(infile_1);
std::ifstream infile2(infile_2);
Expand Down
20 changes: 12 additions & 8 deletions src/indexing.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
#include "translation.h"

ColoredCDBG<MyUnitigMap> buildGraph (const std::string& infile_1,
const std::string& infile_2,
const bool is_ref,
const int kmer,
const int threads,
const bool verb,
const bool write_graph,
const std::string& output_prefix);
const std::string& infile_2,
const bool is_ref,
const int kmer,
const int threads,
const bool verb,
const bool write_graph,
const std::string& output_prefix,
std::vector<std::string>& _ref_paths,
std::vector<std::string>& _read_paths);

ColoredCDBG<> buildGraphvoid (const std::string& infile_1,
const std::string& infile_2,
Expand All @@ -21,7 +23,9 @@ ColoredCDBG<> buildGraphvoid (const std::string& infile_1,
const int threads,
const bool verb,
const bool write_graph,
const std::string& output_prefix);
const std::string& output_prefix,
std::vector<std::string>& _ref_paths,
std::vector<std::string>& _read_paths);

std::vector<std::size_t> findIndex(const std::string& seq,
const std::string& subseq,
Expand Down

0 comments on commit c6d1119

Please sign in to comment.