Skip to content

Commit

Permalink
Fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RagnarGrootKoerkamp committed Dec 1, 2021
1 parent 22c37f8 commit b0fd27d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ pub(crate) enum Command {
}

#[derive(EnumString)]
pub(crate) enum PhylogenyMethod {
pub enum PhylogenyMethod {
UPGMA,
NeighborJoining,
}
Expand Down
11 changes: 6 additions & 5 deletions src/phylogeny.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//! ```
use anyhow::Error;
use std::fs::File;
use std::{fs::File, io::Write};

use crate::cli::PhylogenyMethod;

Expand All @@ -17,19 +17,20 @@ pub fn phylogeny(
method: PhylogenyMethod,
output: Option<std::path::PathBuf>,
) -> Result<(), Error> {
let dm = bio_types::distancematrix::DistanceMatrix::from_file(&input)?;
let dm = bio::io::phylip::from_file(&input)?;
let phylogeny = (match method {
PhylogenyMethod::UPGMA => bio::phylogeny::upgma,
PhylogenyMethod::NeighborJoining => bio::phylogeny::neighbor_joining,
})(&dm);
})(dm);
let s = bio::io::newick::to_string(&phylogeny)?;
Ok(match output {
Some(path) => {
let mut f = File::create(path)?;
f.write_all(phylogeny.to_string().as_bytes())?;
f.write_all(s.as_bytes())?;
f.write(b"\n")?;
}
None => {
println!("{}", phylogeny.to_string());
println!("{}", s);
}
})
}
Expand Down

0 comments on commit b0fd27d

Please sign in to comment.