Skip to content

Commit 544f8fd

Browse files
author
dagou
committed
Add support for auto-detecting interleaved FASTQ
1 parent 15bc60a commit 544f8fd

File tree

3 files changed

+70
-4
lines changed

3 files changed

+70
-4
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kun_peng"
3-
version = "0.7.5"
3+
version = "0.7.6"
44
edition = "2021"
55
authors = ["[email protected]"]
66
description = "Kun-peng: an ultra-fast, low-memory footprint and accurate taxonomy classifier for all"
@@ -19,7 +19,7 @@ double_hashing = []
1919
exact_counting = []
2020

2121
[dependencies]
22-
seqkmer = "0.1.2"
22+
seqkmer = "0.1.3"
2323
clap = { version = "4.4.10", features = ["derive"] }
2424
hyperloglogplus = { version = "0.4.1", features = ["const-loop"] }
2525
seahash = "4.1.0"
@@ -38,8 +38,8 @@ num_cpus = "1.13.1"
3838
jemallocator = "0.5.4"
3939

4040
[dev-dependencies]
41-
criterion = "0.5.1"
42-
twox-hash = "1.6.3"
41+
criterion = "0.7.0"
42+
twox-hash = "2.1.2"
4343
farmhash = { version = "1.1.5" }
4444

4545
[profile.release]

data/test_interleaved.fastq

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@pair_A/1
2+
AGCAGAAGCGGAGCTTTAAGATGAATATAAATCCATATTTTCTTTCATAG
3+
+
4+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
5+
@pair_A/2
6+
ATGACGTTGGCTAAAATTGAACTACTAAAGCAGCTGTTAAGGGACAATGA
7+
+
8+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
9+
@pair_B/1 This is the R1 read
10+
ATGGATACTTTTATTACAAAGAATTTCCAGACTACAATAATACAAAAGGC
11+
+
12+
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
13+
@pair_B/2 This is the R2 read
14+
AGCAGAAGCGTTGCATTTTCTAATATCCACAAAATGAAGGCAATAATTGT
15+
+
16+
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
17+
@pair_C/1
18+
GGCAGAAGCACAGCATTTTCTTGTGAGCTTCGAGCACTAATAAAACTGAA
19+
+
20+
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
21+
@pair_C/2
22+
AGCAGAAGCAGAGCATATTCTTAGAACTGAAGTGAACAGGCCAAAAATGA
23+
+
24+
HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

examples/build_and_classify.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,46 @@ fn main() {
7676
String::from_utf8_lossy(&direct_output.stderr)
7777
);
7878
}
79+
80+
// --- Test 3: ./target/release/kun_peng direct --db test_database data/test_interleaved.fastq ---
81+
println!("\n--- Testing Interleaved FASTQ Classification ---");
82+
83+
let interleaved_fq = data_dir.join("test_interleaved.fastq");
84+
if !interleaved_fq.exists() {
85+
println!(
86+
"kun_peng error: fastq file {} does not exists",
87+
interleaved_fq.to_string_lossy().to_string()
88+
);
89+
// 考虑在这里 panic,如果文件不存在,测试就没有意义
90+
// panic!("Test FASTQ file not found!");
91+
}
92+
let direct_fastq_args = vec![
93+
"direct".to_string(),
94+
"--db".to_string(),
95+
test_dir.to_string_lossy().to_string(),
96+
interleaved_fq.to_string_lossy().to_string(),
97+
];
98+
99+
let direct_fastq_command_str = format!(
100+
"{} {}",
101+
kr2r_binary.to_string_lossy(),
102+
direct_fastq_args.join(" ")
103+
);
104+
println!("Executing command: {}", direct_fastq_command_str);
105+
106+
let direct_fastq_output = Command::new(&kr2r_binary)
107+
.args(&direct_fastq_args)
108+
.output()
109+
.expect("Failed to run kun_peng direct command with interleaved FASTQ");
110+
111+
println!(
112+
"kun_peng direct (fastq) output: {}",
113+
String::from_utf8_lossy(&direct_fastq_output.stdout)
114+
);
115+
if !direct_fastq_output.stderr.is_empty() {
116+
println!(
117+
"kun_peng direct (fastq) error: {}",
118+
String::from_utf8_lossy(&direct_fastq_output.stderr)
119+
);
120+
}
79121
}

0 commit comments

Comments
 (0)