Skip to content

Commit

Permalink
Misc improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
leoisl committed Jun 12, 2023
1 parent 27629b3 commit 1c53eb7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion include/fastaq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 4 additions & 4 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void define_clusters(
MinimizerHitClusters& clusters_of_hits,
const std::vector<uint32_t> &prg_min_path_lengths,
const std::vector<std::string> &prg_names,
std::shared_ptr<MinimizerHits> minimizer_hits, const int max_diff,
std::shared_ptr<MinimizerHits> &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);
Expand All @@ -96,8 +96,8 @@ MinimizerHitClusters get_minimizer_hit_clusters(
const Seq &seq,
const std::vector<uint32_t> &prg_min_path_lengths,
const std::vector<std::string> &prg_names,
std::shared_ptr<MinimizerHits> minimizer_hits,
std::shared_ptr<pangenome::Graph> pangraph, const int max_diff,
std::shared_ptr<MinimizerHits> &minimizer_hits,
const int max_diff,
const float& fraction_kmers_required_for_cluster,
ClusterDefFile &cluster_def_file,
ClusterFilterFile &cluster_filter_file,
Expand All @@ -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<pangenome::Graph> pangraph, Index &index,
std::shared_ptr<pangenome::Graph> &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,
Expand Down
2 changes: 1 addition & 1 deletion src/fastaq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/pangenome/pangraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ std::vector<LocalNodePtr> 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;
}
Expand Down
12 changes: 5 additions & 7 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -221,7 +219,7 @@ void define_clusters(
MinimizerHitClusters& clusters_of_hits, // Note: clusters_of_hits here is in insertion mode
const std::vector<uint32_t> &prg_min_path_lengths,
const std::vector<std::string> &prg_names,
std::shared_ptr<MinimizerHits> minimizer_hits, const int max_diff,
std::shared_ptr<MinimizerHits> &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)
Expand Down Expand Up @@ -480,8 +478,8 @@ MinimizerHitClusters get_minimizer_hit_clusters(
const Seq &seq,
const std::vector<uint32_t> &prg_min_path_lengths,
const std::vector<std::string> &prg_names,
std::shared_ptr<MinimizerHits> minimizer_hits,
std::shared_ptr<pangenome::Graph> pangraph, const int max_diff,
std::shared_ptr<MinimizerHits> &minimizer_hits,
const int max_diff,
const float& fraction_kmers_required_for_cluster,
ClusterDefFile &cluster_def_file,
ClusterFilterFile &cluster_filter_file,
Expand Down Expand Up @@ -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<pangenome::Graph> pangraph, Index &index,
std::shared_ptr<pangenome::Graph> &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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1c53eb7

Please sign in to comment.