This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(new_len > 0).then_some(Cigar::SoftClip(new_len as u32))
}
_ => Some(*c),
})
.collect();
let seq = record.seq().as_bytes();
let qual = record.qual().to_vec();
let seq_len = seq.len();
let trim_start = bases_to_trim_start.min(seq_len);
let trim_end = seq_len - bases_to_trim_end.min(seq_len.saturating_sub(trim_start));
let new_seq = seq[trim_start..trim_end].to_vec();
let new_qual = qual[trim_start..trim_end].to_vec();
let new_cigar_string = CigarString::from(new_cigar);
record.set(
&record.qname().to_vec(),
Check warning
on line 601
in src/plot.rs
View workflow job for this annotation
GitHub Actions/ clippy
unnecessary use of `to_vec`
warning: unnecessary use of `to_vec`
--> src/plot.rs:601:9
|
601 | &record.qname().to_vec(),
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `record.qname()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_to_owned
= note: `#[warn(clippy::unnecessary_to_owned)]` on by default
Some(&new_cigar_string),
&new_seq,
&new_qual,
);
Ok(record)
}
impl Read {
/// Creates a Read from a given rust_htslib bam record
fn from_record<P: AsRef<Path> + std::fmt::Debug>(
Expand All
@@ -564,6 +615,15 @@
target: &str,
aux_tags: &Option<Vec<String>>,
) -> Result<Read> {
let ref_length = get_fasta_length(&ref_path.as_ref().to_path_buf(), target)?;
let read_start = record.pos() - record.cigar().leading_softclips();
let read_end = record.reference_end() + record.cigar().trailing_softclips();
let record = if read_start < 0 || read_end > ref_length as i64 {
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: Clip reads extending beyond reference bounds #422
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
fix: Clip reads extending beyond reference bounds #422
Filter by extension
Viewed files
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Check warning on line 601 in src/plot.rs
unnecessary use of `to_vec`
Uh oh!
There was an error while loading. Please reload this page.