-
Notifications
You must be signed in to change notification settings - Fork 37
Add rammap as a supported read mapping program #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ pub enum MappingProgram { | |
| MINIMAP2_LR_HQ, | ||
| MINIMAP2_NO_PRESET, | ||
| STROBEALIGN, | ||
| RAMMAP, | ||
| } | ||
|
|
||
| pub struct BamFileNamedReader { | ||
|
|
@@ -416,7 +417,10 @@ pub fn generate_named_bam_readers_from_reads( | |
|
|
||
| // Required because of https://github.com/wwood/CoverM/issues/58 | ||
| let minimap2_log_file_index = match mapping_program { | ||
| MappingProgram::BWA_MEM | MappingProgram::BWA_MEM2 | MappingProgram::STROBEALIGN => None, | ||
| MappingProgram::BWA_MEM | ||
| | MappingProgram::BWA_MEM2 | ||
| | MappingProgram::STROBEALIGN | ||
| | MappingProgram::RAMMAP => None, | ||
| // Required because of https://github.com/lh3/minimap2/issues/527 | ||
| MappingProgram::MINIMAP2_SR | ||
| | MappingProgram::MINIMAP2_ONT | ||
|
|
@@ -867,13 +871,21 @@ pub fn build_mapping_command( | |
| mapping_options: Option<&str>, | ||
| ) -> String { | ||
| let read_params1 = match mapping_program { | ||
| // minimap2 auto-detects interleaved based on read names | ||
| // minimap2 auto-detects interleaved input based on read names | ||
| MappingProgram::MINIMAP2_SR | ||
| | MappingProgram::MINIMAP2_ONT | ||
| | MappingProgram::MINIMAP2_HIFI | ||
| | MappingProgram::MINIMAP2_PB | ||
| | MappingProgram::MINIMAP2_LR_HQ | ||
| | MappingProgram::MINIMAP2_NO_PRESET => "", | ||
| MappingProgram::RAMMAP => match read_format { | ||
| // rammap's `sr` preset turns on fragment mode, which pulls read | ||
| // pairs from a single input file (this is how it maps interleaved | ||
| // reads). For genuinely single-end reads that would incorrectly | ||
| // consume the file as interleaved pairs, so disable fragment mode. | ||
| ReadFormat::Single => "--frag no", | ||
| ReadFormat::Coupled | ReadFormat::Interleaved => "", | ||
| }, | ||
| MappingProgram::BWA_MEM | MappingProgram::BWA_MEM2 => match read_format { | ||
| ReadFormat::Interleaved => "-p", | ||
| ReadFormat::Coupled | ReadFormat::Single => "", | ||
|
|
@@ -896,6 +908,9 @@ pub fn build_mapping_command( | |
| MappingProgram::BWA_MEM => "bwa mem".to_string(), | ||
| MappingProgram::BWA_MEM2 => "bwa-mem2 mem".to_string(), | ||
| MappingProgram::STROBEALIGN => "strobealign".to_string(), | ||
| // rammap is a minimap2-compatible aligner; map short reads with | ||
| // the 'sr' preset and emit SAM with -a. | ||
| MappingProgram::RAMMAP => "rammap -x sr -a".to_string(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When CoverM users choose Useful? React with 👍 / 👎. |
||
| _ => { | ||
| let split_prefix = tempfile::Builder::new() | ||
| .prefix("coverm-minimap2-split-index") | ||
|
|
@@ -915,7 +930,8 @@ pub fn build_mapping_command( | |
| match mapping_program { | ||
| MappingProgram::BWA_MEM | ||
| | MappingProgram::BWA_MEM2 | ||
| | MappingProgram::STROBEALIGN => unreachable!(), | ||
| | MappingProgram::STROBEALIGN | ||
| | MappingProgram::RAMMAP => unreachable!(), | ||
| MappingProgram::MINIMAP2_SR => "-x sr", | ||
| MappingProgram::MINIMAP2_ONT => "-x map-ont", | ||
| MappingProgram::MINIMAP2_HIFI => "-x map-hifi", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3239,6 +3239,55 @@ genome6~random_sequence_length_11003 0 0 0 | |
| .is_file()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_make_rammap() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This test is unconditional, but the macOS workflows still run Useful? React with 👍 / 👎. |
||
| let td = tempfile::TempDir::new().unwrap(); | ||
| Assert::main_binary() | ||
| .with_args(&[ | ||
| "make", | ||
| "--coupled", | ||
| "tests/data/reads_for_seq1_and_seq2.1.fq.gz", | ||
| "tests/data/reads_for_seq1_and_seq2.2.fq.gz", | ||
| "--reference", | ||
| "tests/data/7seqs.fna", | ||
| "--mapper", | ||
| "rammap", | ||
| "--output-directory", | ||
| td.path().to_str().unwrap(), | ||
| ]) | ||
| .succeeds() | ||
| .unwrap(); | ||
| assert!(td | ||
| .path() | ||
| .join("7seqs.fna.reads_for_seq1_and_seq2.1.fq.gz.bam") | ||
| .is_file()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_make_rammap_single() { | ||
| // Single-end reads must not be consumed as interleaved pairs by | ||
| // rammap's fragment mode; exercise the single-end path end to end. | ||
| let td = tempfile::TempDir::new().unwrap(); | ||
| Assert::main_binary() | ||
| .with_args(&[ | ||
| "make", | ||
| "--single", | ||
| "tests/data/reads_for_seq1_and_seq2.1.fq.gz", | ||
| "--reference", | ||
| "tests/data/7seqs.fna", | ||
| "--mapper", | ||
| "rammap", | ||
| "--output-directory", | ||
| td.path().to_str().unwrap(), | ||
| ]) | ||
| .succeeds() | ||
| .unwrap(); | ||
| assert!(td | ||
| .path() | ||
| .join("7seqs.fna.reads_for_seq1_and_seq2.1.fq.gz.bam") | ||
| .is_file()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_strobealign_pregenerated_index() { | ||
| // Generate the index at runtime so the format always matches the installed strobealign version | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 31 adds the new dependency, but
pixi.lockstill has norammapentry (rg rammap pixi.lock). The locked Linux workflow runspixi run --frozen cargo testin.github/workflows/test-coverm.ymlline 28, and Pixi documents--frozenas installing from the lockfile without updating it, so the newtest_make_rammapruns in an environment without the binary andcheck_for_rammapfails. Please regenerate and commitpixi.lockwith rammap included.Useful? React with 👍 / 👎.