Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
return empty R2 read
Browse files Browse the repository at this point in the history
  • Loading branch information
govinda-kamath committed May 26, 2024
1 parent 26556f1 commit 5e0ce99
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/read_pair_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use crate::read_pair::{MutReadPair, ReadPair, ReadPairStorage, ReadPart, WhichRead};
use bytes::{BufMut, BytesMut};
use fastq::{self, Record, RecordRefIter};
use fastq::{self, OwnedRecord, Record, RecordRefIter};
use rand::distributions::{Distribution, Uniform};
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;
Expand Down Expand Up @@ -406,7 +406,7 @@ impl ReadPairIter {
iter.advance()
.fastq_err(paths[idx].as_ref().unwrap(), rec_num[idx] * 4)?;

{
let current_read_record = {
let record = iter.get();

// Check for non-ACGTN characters
Expand All @@ -433,7 +433,8 @@ impl ReadPairIter {
}

rec_num[idx] += 1;
}
record
};

// If R1 is interleaved, read another entry
// and store it as R2
Expand Down Expand Up @@ -474,6 +475,16 @@ impl ReadPairIter {
}

rec_num[idx] += 1;
} else if let Some(current_read_record) = current_read_record {
let read_length = read_lengths[WhichRead::R2 as usize];
let fake_r2_read = OwnedRecord {
head: current_read_record.head().to_owned(),
sep: Some(current_read_record.seq().to_owned()),
seq: vec![],
qual: vec![],
};
let tr = TrimRecord::new(&fake_r2_read, read_length);
rp.push_read(&tr, WhichRead::R2)
}
}
}
Expand Down

0 comments on commit 5e0ce99

Please sign in to comment.