Skip to content
Snippets Groups Projects
Verified Commit 56ca8ce9 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

read.rs: fix bug leading to empty bam

parent 80f0ac14
No related branches found
No related tags found
No related merge requests found
...@@ -118,7 +118,7 @@ impl Fragments { ...@@ -118,7 +118,7 @@ impl Fragments {
pub fn next_chr(&mut self) { pub fn next_chr(&mut self) {
loop { loop {
self.get_chr(); self.get_chr();
if !self.check_name() { if self.check_name() {
break; break;
} }
} }
...@@ -141,7 +141,7 @@ impl Fragments { ...@@ -141,7 +141,7 @@ impl Fragments {
while self.chr_id < chr_id { while self.chr_id < chr_id {
self.next_chr(); self.next_chr();
} }
if chr_pos > self.chr_seq.len() as u32 - self.fragment_len { if chr_pos > self.chr_seq.len() as u32 {
panic!( panic!(
"Fragments::get_single() pos {} not present in chromosome {}:{} of size {}", "Fragments::get_single() pos {} not present in chromosome {}:{} of size {}",
chr_pos, chr_pos,
...@@ -171,7 +171,7 @@ impl Fragments { ...@@ -171,7 +171,7 @@ impl Fragments {
while self.chr_id < chr_id { while self.chr_id < chr_id {
self.next_chr(); self.next_chr();
} }
if chr_pos >= self.chr_seq.len() as u32 - self.fragment_len { if chr_pos >= self.chr_seq.len() as u32 {
panic!( panic!(
"Fragments::get() pos {} not present in chromosome {} of size {}", "Fragments::get() pos {} not present in chromosome {} of size {}",
chr_pos, chr_pos,
...@@ -306,7 +306,7 @@ impl Read { ...@@ -306,7 +306,7 @@ impl Read {
/// # Return /// # Return
/// String /// String
fn build_name(read_number: u64, paired: bool, first: bool) -> String { fn build_name(read_number: u64, paired: bool, first: bool) -> String {
let mut read_name = String::from("bigwig2bam:0:0:0:"); let mut read_name = String::from("bigwig2bam:0:1:3:");
read_name.push_str(&read_number.to_string()); read_name.push_str(&read_number.to_string());
if paired { if paired {
if first { if first {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment