Skip to content

Commit

Permalink
preliminary contigs + contig output saves
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewprzh committed Feb 28, 2017
1 parent 50d56ea commit ee94553
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions assembler/src/projects/spades/contig_output_stage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace debruijn_graph {

void ContigOutput::run(conj_graph_pack &gp, const char*) {
auto output_dir = cfg::get().output_dir;
auto output_dir = cfg::get().output_dir + contig_name_prefix_;

OutputContigs(gp.g, output_dir + "before_rr", false);
OutputContigsToFASTG(gp.g, output_dir + "assembly_graph", gp.components);
Expand Down Expand Up @@ -45,7 +45,7 @@ void ContigOutput::run(conj_graph_pack &gp, const char*) {

writer.OutputPaths(gp.contig_paths, output_dir + cfg::get().co.scaffolds_name);

OutputContigsToGFA(gp.g, gp.contig_paths, cfg::get().output_dir + "assembly_graph");
OutputContigsToGFA(gp.g, gp.contig_paths, output_dir + "assembly_graph");
} else {
OutputContigs(gp.g, output_dir + "simplified_contigs", cfg::get().use_unipaths);
OutputContigs(gp.g, output_dir + cfg::get().co.contigs_name, false);
Expand Down
12 changes: 6 additions & 6 deletions assembler/src/projects/spades/contig_output_stage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ namespace debruijn_graph {
class ContigOutput : public spades::AssemblyStage {
private:
bool output_paths_;
public:
ContigOutput(bool output_paths = true)
: AssemblyStage("Contig Output", "contig_output"), output_paths_(output_paths) { }

void load(conj_graph_pack &, const std::string &, const char *) { }
string contig_name_prefix_;

void save(const conj_graph_pack &, const std::string &, const char *) const { }
public:
ContigOutput(bool output_paths = true, bool preliminary = false, const string& contig_name_prefix = "")
: AssemblyStage("Contig Output", preliminary ? "preliminary_contig_output" : "contig_output"),
output_paths_(output_paths), contig_name_prefix_(contig_name_prefix) { }

void run(conj_graph_pack &gp, const char *);

};

}
9 changes: 4 additions & 5 deletions assembler/src/projects/spades/launch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,13 @@ void assemble_genome() {
SPAdes.add(new debruijn_graph::MismatchCorrection());
if (cfg::get().rr_enable) {
if (two_step_rr) {
string prelim_prefix = "preliminary_";
if (cfg::get().use_intermediate_contigs)
SPAdes.add(new debruijn_graph::PairInfoCount(true))
.add(new debruijn_graph::DistanceEstimation(true))
.add(new debruijn_graph::RepeatResolution(true))
.add(new debruijn_graph::ContigOutput())
.add(new debruijn_graph::SecondPhaseSetup());
.add(new debruijn_graph::ContigOutput(true, true, prelim_prefix))
.add(new debruijn_graph::SecondPhaseSetup(prelim_prefix));

SPAdes.add(new debruijn_graph::Simplification());
}
Expand All @@ -119,12 +120,10 @@ void assemble_genome() {

//No graph modification allowed after HybridLibrariesAligning stage!

SPAdes.add(new debruijn_graph::ContigOutput(false))
SPAdes.add(new debruijn_graph::ContigOutput(false, false, "pre_pe_"))
.add(new debruijn_graph::PairInfoCount())
.add(new debruijn_graph::DistanceEstimation())
.add(new debruijn_graph::RepeatResolution());
} else {
SPAdes.add(new debruijn_graph::ContigOutput(false));
}

SPAdes.add(new debruijn_graph::ContigOutput());
Expand Down
2 changes: 1 addition & 1 deletion assembler/src/projects/spades/second_phase_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void SecondPhaseSetup::run(conj_graph_pack &gp, const char*) {
gp.ClearRRIndices();
gp.ClearPaths();

std::string old_pe_contigs_filename = cfg::get().output_dir + "final_contigs.fasta";
std::string old_pe_contigs_filename = cfg::get().output_dir + contig_name_prefix_ + "final_contigs.fasta";
std::string new_pe_contigs_filename = cfg::get().output_dir + "first_pe_contigs.fasta";

VERIFY(path::check_existence(old_pe_contigs_filename));
Expand Down
7 changes: 5 additions & 2 deletions assembler/src/projects/spades/second_phase_setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ namespace debruijn_graph {

//todo rename
class SecondPhaseSetup : public spades::AssemblyStage {
private:
string contig_name_prefix_;

public:
SecondPhaseSetup()
: AssemblyStage("Second Phase Setup", "second_phase_setup") { }
SecondPhaseSetup(const string& contig_name_prefix = "")
: AssemblyStage("Second Phase Setup", "second_phase_setup"),contig_name_prefix_(contig_name_prefix) { }

void run(conj_graph_pack &gp, const char *);
};
Expand Down

0 comments on commit ee94553

Please sign in to comment.