From 1c53eb78a70be75dd35601701e3952d75549daa9 Mon Sep 17 00:00:00 2001 From: Leandro Ishi Date: Mon, 12 Jun 2023 15:08:43 +0100 Subject: [PATCH] Misc improvements --- include/fastaq.h | 2 +- include/utils.h | 8 ++++---- src/fastaq.cpp | 2 +- src/pangenome/pangraph.cpp | 2 +- src/utils.cpp | 12 +++++------- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/fastaq.h b/include/fastaq.h index 3a989ef5..4a64832f 100644 --- a/include/fastaq.h +++ b/include/fastaq.h @@ -34,7 +34,7 @@ struct Fastaq { const uint_least16_t, const std::string header = ""); void add_entry( - const std::string&, const std::string&, const std::string header = ""); + const std::string&, const std::string&, const std::string &header = ""); void clear(); diff --git a/include/utils.h b/include/utils.h index fd9f3517..d34c8c3f 100644 --- a/include/utils.h +++ b/include/utils.h @@ -72,7 +72,7 @@ void define_clusters( MinimizerHitClusters& clusters_of_hits, const std::vector &prg_min_path_lengths, const std::vector &prg_names, - std::shared_ptr minimizer_hits, const int max_diff, + std::shared_ptr &minimizer_hits, const int max_diff, const float& fraction_kmers_required_for_cluster, const uint32_t min_cluster_size, const uint32_t expected_number_kmers_in_read_sketch, ClusterDefFile& cluster_def_file); @@ -96,8 +96,8 @@ MinimizerHitClusters get_minimizer_hit_clusters( const Seq &seq, const std::vector &prg_min_path_lengths, const std::vector &prg_names, - std::shared_ptr minimizer_hits, - std::shared_ptr pangraph, const int max_diff, + std::shared_ptr &minimizer_hits, + const int max_diff, const float& fraction_kmers_required_for_cluster, ClusterDefFile &cluster_def_file, ClusterFilterFile &cluster_filter_file, @@ -106,7 +106,7 @@ MinimizerHitClusters get_minimizer_hit_clusters( const uint32_t rng_seed); uint32_t pangraph_from_read_file(const SampleData& sample, - std::shared_ptr pangraph, Index &index, + std::shared_ptr &pangraph, Index &index, const int max_diff, const float& e_rate, const fs::path& sample_outdir, const uint32_t min_cluster_size = 10, const uint32_t genome_size = 5000000, const uint32_t max_covg = 300, diff --git a/src/fastaq.cpp b/src/fastaq.cpp index dd09feb6..13bb8089 100644 --- a/src/fastaq.cpp +++ b/src/fastaq.cpp @@ -81,7 +81,7 @@ void Fastaq::add_entry(const std::string& name, const std::string& sequence, } void Fastaq::add_entry( - const std::string& name, const std::string& sequence, const std::string header) + const std::string& name, const std::string& sequence, const std::string &header) { const bool fasta_entry_has_a_name = name.length() > 0; if (!fasta_entry_has_a_name) { diff --git a/src/pangenome/pangraph.cpp b/src/pangenome/pangraph.cpp index 9a126682..fe9604df 100644 --- a/src/pangenome/pangraph.cpp +++ b/src/pangenome/pangraph.cpp @@ -148,7 +148,7 @@ std::vector pangenome::Graph::infer_node_vcf_reference_path( const auto& prg = *prg_ptr; if (vcf_refs.find(prg.name) != vcf_refs.end()) { const auto& vcf_reference_sequence = vcf_refs.at(prg.name); - const auto reference_path = prg.get_valid_vcf_reference(vcf_reference_sequence); + auto reference_path = prg.get_valid_vcf_reference(vcf_reference_sequence); if (!reference_path.empty()) return reference_path; } diff --git a/src/utils.cpp b/src/utils.cpp index f57d9231..4a36a8e6 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -186,8 +186,6 @@ void decide_if_add_cluster_or_not( if (!cluster_def_file.is_fake_file) { #pragma omp critical(cluster_def_file) { - // TODO: to create this file, we either need to know the PRG names without loading the PRGs - // TODO: or to output the id cluster_def_file << seq.name << "\t" << prg_names[(*mh_previous)->get_prg_id()] << "\t"; if (cluster_should_be_accepted) { cluster_def_file << "accepted\t"; @@ -221,7 +219,7 @@ void define_clusters( MinimizerHitClusters& clusters_of_hits, // Note: clusters_of_hits here is in insertion mode const std::vector &prg_min_path_lengths, const std::vector &prg_names, - std::shared_ptr minimizer_hits, const int max_diff, + std::shared_ptr &minimizer_hits, const int max_diff, const float& fraction_kmers_required_for_cluster, const uint32_t min_cluster_size, const uint32_t expected_number_kmers_in_read_sketch, ClusterDefFile& cluster_def_file) @@ -480,8 +478,8 @@ MinimizerHitClusters get_minimizer_hit_clusters( const Seq &seq, const std::vector &prg_min_path_lengths, const std::vector &prg_names, - std::shared_ptr minimizer_hits, - std::shared_ptr pangraph, const int max_diff, + std::shared_ptr &minimizer_hits, + const int max_diff, const float& fraction_kmers_required_for_cluster, ClusterDefFile &cluster_def_file, ClusterFilterFile &cluster_filter_file, @@ -513,7 +511,7 @@ MinimizerHitClusters get_minimizer_hit_clusters( // TODO: this should be in a constructor of pangenome::Graph or in a factory class uint32_t pangraph_from_read_file(const SampleData& sample, - std::shared_ptr pangraph, Index &index, + std::shared_ptr &pangraph, Index &index, const int max_diff, const float& e_rate, const fs::path& sample_outdir, const uint32_t min_cluster_size, const uint32_t genome_size, const uint32_t max_covg, uint32_t threads, @@ -636,7 +634,7 @@ uint32_t pangraph_from_read_file(const SampleData& sample, MinimizerHitClusters clusters_of_hits = get_minimizer_hit_clusters(sample_name, sequence, index.get_prg_min_path_lengths(), index.get_prg_names(), - minimizer_hits, pangraph, max_diff, + minimizer_hits, max_diff, fraction_kmers_required_for_cluster, cluster_def_file, cluster_filter_file, min_cluster_size, expected_number_kmers_in_read_sketch, rng_seed);