-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update docs and startup filepath handling
- Loading branch information
1 parent
bd6a643
commit aa54ab7
Showing
8 changed files
with
27 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
/target | ||
cerevisiae.k21.hist.png | ||
freq.tsv.gz | ||
output.tsv | ||
output/ | ||
reddit_feedback.txt | ||
revcomp_issue.txt | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
use std::env; | ||
use std::error::Error; | ||
use std::{env, error::Error, path::PathBuf}; | ||
|
||
/// Parsing command line k-size and filepath arguments. | ||
pub struct Config { | ||
pub kmer_len: usize, | ||
pub filepath: String, | ||
pub k: usize, | ||
pub path: PathBuf, | ||
} | ||
|
||
impl Config { | ||
pub fn new(mut args: env::Args) -> Result<Config, Box<dyn Error>> { | ||
let kmer_len: usize = match args.nth(1) { | ||
let k: usize = match args.nth(1) { | ||
Some(arg) => match arg.parse() { | ||
Ok(kmer_len) if kmer_len > 0 && kmer_len < 33 => kmer_len, | ||
Ok(k) if k > 0 && k < 33 => k, | ||
Ok(_) => return Err("k-mer length needs to be larger than zero and, for `krust` in its current working form, no more than 32".into()), | ||
Err(_) => return Err(format!("issue with k-mer length argument: {}", arg).into()), | ||
}, | ||
None => return Err("k-mer length input required".into()), | ||
}; | ||
|
||
let filepath = match args.next() { | ||
Some(arg) => arg, | ||
let path = match args.next() { | ||
Some(arg) => PathBuf::from(arg), | ||
None => return Err("filepath argument needed".into()), | ||
}; | ||
|
||
Ok(Config { kmer_len, filepath }) | ||
Ok(Config { k, path }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,3 @@ fn find_invalid_works5() { | |
assert_eq!(0, ans); | ||
assert_eq!(&b'N', dna.iter().collect::<Vec<_>>()[ans]); | ||
} | ||
|