-
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.
feat: add generation function for fast[a|q] format
- Loading branch information
Showing
12 changed files
with
482 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name = "biotest" | |
version = "0.1.0" | ||
authors = ["Pierre Marijon <[email protected]>"] | ||
edition = "2021" | ||
description = "Many function to generate test data for bioinformatics data" | ||
description = "Generate random test data for bioinformatics" | ||
rust-version = "1.75" | ||
|
||
homepage = "https://github.com/natir/biotest" | ||
|
@@ -14,13 +14,17 @@ readme = "Readme.md" | |
license-file = "LICENSE" | ||
|
||
|
||
[dependencies] | ||
[features] | ||
fasta = [] | ||
fastq = [] | ||
derive = ["dep:biotest_derive"] | ||
|
||
[dependencies] | ||
rand = { version = "0.8" } | ||
|
||
# Error management | ||
thiserror = { version = "1" } | ||
|
||
|
||
# Logging and error management | ||
log = { version = "0.4" } | ||
|
||
|
@@ -30,12 +34,15 @@ biotest_derive = { path = "biotest_derive", optional = true } | |
|
||
[dev-dependencies] | ||
criterion = { version = "0.5" } | ||
tempfile = { version = "3" } | ||
|
||
# CLI management | ||
clap = { version = "4", features = ["derive"] } | ||
|
||
# Logging management | ||
stderrlog = { version = "0.5" } | ||
|
||
|
||
[profile.release] | ||
lto = 'thin' | ||
opt-level = 3 | ||
|
@@ -46,4 +53,4 @@ incremental = false | |
|
||
[profile.profiling] | ||
inherits = "release" | ||
debug = true | ||
debug = true |
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,22 +1,21 @@ | ||
<h1 style="text-align: center;">biotest</h1> | ||
|
||
[![License](https://img.shields.io/badge/license-MIT-green)](https:///natir/biotest/blob/master/LICENSE) | ||
[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/natir/biotest/blob/master/LICENSE) | ||
![Test](https://github.com/natir/natir/workflows/Test/badge.svg) | ||
![Lints](https://github.com/natir/natir/workflows/Lints/badge.svg) | ||
![MSRV](https://github.com/natir/natir/workflows/MSRV/badge.svg) | ||
[![CodeCov](https://codecov.io/gh/natir/natir/branch/master/graph/badge.svg)](https://codecov.io/gh/natir/natir) | ||
[![Documentation](https://github.com/natir/natir/workflows/Documentation/badge.svg)](https://natir.github.io/natir/natir) | ||
|
||
Generate random test data for bioinformatics | ||
|
||
Many function to generate test data for bioinformatics data | ||
|
||
## Installation | ||
|
||
### From source | ||
## Usage | ||
|
||
```bash | ||
git clone https:///natir/biotest.git | ||
cd biotest | ||
cargo install --path . | ||
In your Cargo.toml add | ||
```toml | ||
biotest = { url = "https:///natir/biotest.git" } | ||
``` | ||
|
||
## Usage | ||
|
||
## Minimum supported Rust version | ||
|
||
Currently the minimum supported Rust version is 1.75. |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//! Declarations of some constants value | ||
/* std use */ | ||
|
||
/* crates use */ | ||
|
||
/* projet use */ | ||
|
||
const fn gen_array<const N: usize, const B: usize>() -> [u8; N] { | ||
let mut array = [0; N]; | ||
|
||
let mut i = 0; | ||
while i < N { | ||
array[i] = (B + i) as u8; | ||
i += 1; | ||
} | ||
|
||
array | ||
} | ||
|
||
/// Fixed random seed | ||
pub const SEED: [u8; 32] = [42; 32]; | ||
|
||
/// Nucleotides with any case | ||
pub const NUCLEOTIDES: [u8; 8] = *b"ACTGactg"; | ||
|
||
/// Nucleotides lower | ||
pub const NUCLEOTIDES_LOWER: [u8; 4] = *b"actg"; | ||
|
||
/// Nucleotides upper | ||
pub const NUCLEOTIDES_UPPER: [u8; 4] = *b"ACTG"; | ||
|
||
/// All possible phred 33 value | ||
pub const PHRED33: [u8; 40] = gen_array::<40, 33>(); | ||
|
||
/// All possible phred 64 value | ||
pub const PHRED64: [u8; 40] = gen_array::<40, 64>(); | ||
|
||
/// Alphabets with [ \ ] ^ _ ` | ||
pub const ALPHABETS: [u8; 58] = gen_array::<58, 65>(); | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
/* project use */ | ||
use super::*; | ||
|
||
#[test] | ||
fn phred33() { | ||
assert_eq!( | ||
gen_array::<40, 33>().to_vec(), | ||
b"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH".to_vec() | ||
); | ||
} | ||
|
||
#[test] | ||
fn phred64() { | ||
assert_eq!( | ||
gen_array::<40, 64>().to_vec(), | ||
b"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefg".to_vec() | ||
); | ||
} | ||
|
||
#[test] | ||
fn alphapets() { | ||
assert_eq!( | ||
gen_array::<58, 65>().to_vec(), | ||
b"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz".to_vec() | ||
); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//! Format data generation | ||
/* std use */ | ||
|
||
/* crates use */ | ||
|
||
/* module declaration */ | ||
#[cfg(feature = "fasta")] | ||
pub mod fasta; | ||
|
||
#[cfg(feature = "fastq")] | ||
pub mod fastq; | ||
|
||
/* projet use */ |
Oops, something went wrong.