Skip to content

Commit

Permalink
release: version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebedthan committed Jul 30, 2024
1 parent c82c7db commit 2154cc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 127 deletions.
126 changes: 0 additions & 126 deletions src/cmd/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,130 +442,4 @@ GCF_014635325.1
assert_eq!("11".to_string(), expected);
std::fs::remove_file("test.txt").unwrap();
}

#[test]
fn test_exact_search_count() {
let mut args = cli::search::SearchArgs::new();
args.add_needle("Azorhizobium");
args.set_count(true);
args.set_disable_certificate_verification(true);
args.set_output(Some("test1.txt".to_string()));
args.set_outfmt("json".to_string());
args.set_matching_mode(true);
let res = search(args.clone());
assert!(res.is_ok());
let expected = std::fs::read_to_string("test1.txt").unwrap();
assert_eq!("11".to_string(), expected);
std::fs::remove_file("test1.txt").unwrap();
}

/*
#[test]
fn test_exact_search_pretty() {
let mut args = utils::SearchArgs::new();
args.add_needle("s__Azorhizobium doebereinerae");
args.set_output(Some("test8.txt".to_string()));
args.set_outfmt("json".to_string());
args.set_disable_certificate_verification(true);
let res = search(args.clone());
assert!(res.is_ok());
let expected = std::fs::read_to_string("test8.txt").unwrap();
let actual = r#"{
"gid": "GCF_000473085.1",
"accession": "GCF_000473085.1",
"ncbiOrgName": "Azorhizobium doebereinerae UFLA1-100",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Hyphomicrobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium doebereinerae",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhizobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium doebereinerae",
"isGtdbSpeciesRep": true,
"isNcbiTypeMaterial": true
}"#;
assert_eq!(actual, expected);
std::fs::remove_file("test8.txt").unwrap();
}
#[test]
fn test_partial_search_pretty() {
let mut args = utils::SearchArgs::new();
args.add_needle("s__Azorhizobium doebereinerae");
args.set_output(Some("test9.txt".to_string()));
args.set_disable_certificate_verification(true);
args.set_outfmt("json".to_string());
let res = search(args.clone());
assert!(res.is_ok());
let expected = std::fs::read_to_string("test9.txt").unwrap();
let actual = r#"{
"gid": "GCA_023405075.1",
"accession": "GCA_023405075.1",
"ncbiOrgName": "Pseudomonadota bacterium",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__; o__; f__; g__; s__",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhizobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium caulinodans",
"isGtdbSpeciesRep": false,
"isNcbiTypeMaterial": true
}
{
"gid": "GCA_023448105.1",
"accession": "GCA_023448105.1",
"ncbiOrgName": "Pseudomonadota bacterium",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__; o__; f__; g__; s__",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhizobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium caulinodans",
"isGtdbSpeciesRep": false,
"isNcbiTypeMaterial": true
}
{
"gid": "GCF_000010525.1",
"accession": "GCF_000010525.1",
"ncbiOrgName": "Azorhizobium caulinodans ORS 571",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Hyphomicrobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium caulinodans",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhizobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium caulinodans",
"isGtdbSpeciesRep": true,
"isNcbiTypeMaterial": true
}
{
"gid": "GCF_000473085.1",
"accession": "GCF_000473085.1",
"ncbiOrgName": "Azorhizobium doebereinerae UFLA1-100",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Hyphomicrobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium doebereinerae",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhizobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium doebereinerae",
"isGtdbSpeciesRep": true,
"isNcbiTypeMaterial": true
}
{
"gid": "GCF_003989665.1",
"accession": "GCF_003989665.1",
"ncbiOrgName": "Azospirillum doebereinerae",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhodospirillales; f__Azospirillaceae; g__Azospirillum; s__Azospirillum doebereinerae",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Azospirillales; f__Azospirillaceae; g__Azospirillum; s__Azospirillum doebereinerae",
"isGtdbSpeciesRep": true,
"isNcbiTypeMaterial": true
}
{
"gid": "GCF_004364705.1",
"accession": "GCF_004364705.1",
"ncbiOrgName": "Azorhizobium sp. AG788",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Hyphomicrobiales; f__Xanthobacteraceae; g__Azorhizobium; s__",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhizobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium caulinodans",
"isGtdbSpeciesRep": false,
"isNcbiTypeMaterial": true
}
{
"gid": "GCF_014635325.1",
"accession": "GCF_014635325.1",
"ncbiOrgName": "Azorhizobium oxalatiphilum",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Hyphomicrobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium oxalatiphilum",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhizobiales; f__Xanthobacteraceae; g__Azorhizobium; s__Azorhizobium oxalatiphilum",
"isGtdbSpeciesRep": true,
"isNcbiTypeMaterial": true
}
{
"gid": "GCF_022214805.1",
"accession": "GCF_022214805.1",
"ncbiOrgName": "Azospirillum doebereinerae",
"ncbiTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Rhodospirillales; f__Azospirillaceae; g__Azospirillum; s__Azospirillum doebereinerae",
"gtdbTaxonomy": "d__Bacteria; p__Pseudomonadota; c__Alphaproteobacteria; o__Azospirillales; f__Azospirillaceae; g__Azospirillum; s__Azospirillum doebereinerae",
"isGtdbSpeciesRep": false,
"isNcbiTypeMaterial": true
}"#;
assert_eq!(actual, expected);
std::fs::remove_file("test9.txt").unwrap();
}*/
}
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ mod tests {
OsString::from("--file"),
OsString::from("test/test.txt"),
OsString::from("--id"),
OsString::from("--partial"),
OsString::from("-w"),
OsString::from("--count"),
OsString::from("--rep"),
OsString::from("--type"),
Expand All @@ -89,6 +89,7 @@ mod tests {
assert_eq!(args.is_type_species_only(), tsp);
assert_eq!(args.get_output(), Some(String::from("out")));
assert_eq!(args.get_outfmt(), OutputFormat::from("json".to_string()));
assert!(args.is_whole_words_matching());
}

#[test]
Expand Down

0 comments on commit 2154cc1

Please sign in to comment.