Skip to content

Commit

Permalink
ignoring softclips for lengths
Browse files Browse the repository at this point in the history
as reported in
#16
  • Loading branch information
wdecoster committed Sep 25, 2023
1 parent 4b13193 commit b054f4d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode
test.feather
Cargo.lock
test.txt
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cramino"
version = "0.12.0"
version = "0.13.0"
edition = "2021"
authors = ["Wouter De Coster [email protected]"]
license = "MIT"
Expand Down
6 changes: 5 additions & 1 deletion src/extract_from_bam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ pub fn extract(args: &crate::Cli) -> Data {
.inspect(|_| all_counts += 1)
.filter(|read| filter_closure(read))
{
lengths.push(read.seq_len() as u64);
lengths.push(
read.seq_len() as u64
- read.cigar().leading_softclips() as u64
- read.cigar().trailing_softclips() as u64,
);
if args.karyotype || args.phased {
tids.push(read.tid());
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn generate_main_output(
panic!();
}
let data_yield: u64 = lengths.iter().sum::<u64>();
println!("Number of reads\t{num_reads}");
println!("Number of alignments\t{num_reads}");
println!(
"% from total reads\t{:.2}",
(num_reads as f64) / (all_reads as f64) * 100.0
Expand Down Expand Up @@ -213,7 +213,7 @@ fn extract() {
#[test]
fn extract_ubam() {
let args = Cli {
input: "test-data/small-test-phased.bam".to_string(),
input: "test-data/small-test-ubam.bam".to_string(),
threads: 8,
reference: None,
min_read_len: 0,
Expand Down

0 comments on commit b054f4d

Please sign in to comment.