-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e7a03a
commit fe0bb8f
Showing
25 changed files
with
242 additions
and
260 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
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 |
---|---|---|
@@ -1,35 +1,32 @@ | ||
use rand::{ | ||
rngs::ThreadRng, | ||
Rng | ||
}; | ||
use rand::{rngs::ThreadRng, Rng}; | ||
|
||
/// Generate a random InterPro annotation. | ||
pub fn generate_ipr(random: &mut ThreadRng) -> String { | ||
format!("IPR:IPR{:06}", random.gen_range(0 .. 999999)) | ||
format!("IPR:IPR{:06}", random.gen_range(0..999999)) | ||
} | ||
|
||
/// Generate a random Gene Ontology annotation. | ||
pub fn generate_go(random: &mut ThreadRng) -> String { | ||
format!("GO:{:07}", random.gen_range(0 .. 9999999)) | ||
format!("GO:{:07}", random.gen_range(0..9999999)) | ||
} | ||
|
||
/// Generate a random Enzyme Commission annotation. | ||
pub fn generate_ec(random: &mut ThreadRng) -> String { | ||
format!( | ||
"EC:{}.{}.{}.{}", | ||
random.gen_range(0 .. 8), | ||
random.gen_range(0 .. 30), | ||
random.gen_range(0 .. 30), | ||
random.gen_range(0 .. 200) | ||
random.gen_range(0..8), | ||
random.gen_range(0..30), | ||
random.gen_range(0..30), | ||
random.gen_range(0..200) | ||
) | ||
} | ||
|
||
/// Generate a random annotation. | ||
pub fn generate_annotation(random: &mut ThreadRng) -> String { | ||
match random.gen_range(0 .. 3) { | ||
match random.gen_range(0..3) { | ||
0 => generate_ipr(random), | ||
1 => generate_go(random), | ||
2 => generate_ec(random), | ||
_ => unreachable!() | ||
_ => unreachable!(), | ||
} | ||
} |
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
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
Oops, something went wrong.