Skip to content

Commit

Permalink
Tests work fine again.
Browse files Browse the repository at this point in the history
  • Loading branch information
stela2502 committed Aug 26, 2024
1 parent 85d4fd6 commit 82ba8ad
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/analysis/gene_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,13 @@ impl AnalysisGeneMapper{
report
){
report.pcr_duplicates += 1;
match minimal_sam.to_sam_line( &data[i].1, gene_id, cell_seq, umi_seq, &self.genes ) {
Some(sam_line) => bam.push( sam_line ),
None => {
eprintln!("There has been an error in the minimal_sam.to_sam_line function - please check what went wrong with this sequence:\n{}.",&data[i].1 );
}
}
}
// add it whether it is a duplicate or not
match minimal_sam.to_sam_line( &data[i].1, gene_id, cell_seq, umi_seq, &self.genes ) {
Some(sam_line) => bam.push( sam_line ),
None => {
eprintln!("There has been an error in the minimal_sam.to_sam_line function - please check what went wrong with this sequence:\n{}.",&data[i].1 );
}
}
},
Err(MappingError::NoMatch) => {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/check_read_gene_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn main() {

//worker.write_data( opts.outpath, &mut results, opts.min_umi );


println!("{}",results.log_str());

match now.elapsed() {
Ok(elapsed) => {
Expand Down
1 change: 1 addition & 0 deletions src/genes_mapper/genes_mapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ impl GenesMapper{
let res_vec = self.query_database( seq );

if res_vec.is_empty() {
#[cfg(debug_assertions)]
if self.debug{
println!("No matching gene found - cause: Not enough keys matching to a single gene");
}
Expand Down
4 changes: 4 additions & 0 deletions src/singlecelldata/singlecelldata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ impl SingleCellData{
ret
}

pub fn passing_cells( &self) -> usize {
self.passing
}

pub fn n_reads( &mut self, genes:&IndexedGenes, names: &Vec<String> ) -> usize {
let mut count = 0;

Expand Down
6 changes: 5 additions & 1 deletion tests/analysis_gene_mapper_internals_R1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ mod tests {
assert_eq!( sam_strings.len(), 0, "I go no result for the search" );
},
None=> {
assert_eq!(sam_strings[0], sam_line, "We got the expected sam line?");
if sam_strings.len() > 0 {
assert_eq!(sam_strings[0], sam_line, "We got the expected sam line?");
}else {
panic!("I expected a sam line in return and got nothing?!");
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mapping_efficiency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,5 @@ fn test_quantify_rhapsody_multi_bad_seq2() {

let stdout = std::str::from_utf8( &output.stdout).unwrap();

assert!( stdout.contains( "No matching gene found"), "Gene detected!: {stdout}");
assert!( stdout.contains( "100.00% with cell_id, 0.00% with gene_id 0.00% multimapper"), "Gene detected!: {stdout}");
}

0 comments on commit 82ba8ad

Please sign in to comment.