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 {
pub fn next_chr(&mut self) {
loop {
self.get_chr();
if !self.check_name() {
if self.check_name() {
break;
}
}
......@@ -141,7 +141,7 @@ impl Fragments {
while self.chr_id < chr_id {
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!(
"Fragments::get_single() pos {} not present in chromosome {}:{} of size {}",
chr_pos,
......@@ -171,7 +171,7 @@ impl Fragments {
while self.chr_id < chr_id {
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!(
"Fragments::get() pos {} not present in chromosome {} of size {}",
chr_pos,
......@@ -306,7 +306,7 @@ impl Read {
/// # Return
/// 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());
if paired {
if first {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment