Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This file is autogenerated by maturin v1.8.2
# To update, run
#
# maturin generate-ci github
#
name: build wheels

on:
Expand Down Expand Up @@ -33,6 +28,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v4
- name: Build wheels
Expand All @@ -53,16 +49,17 @@ jobs:
strategy:
matrix:
platform:
- runner: macos-13
- runner: macos-15
target: x86_64
- runner: macos-14
- runner: macos-15
target: aarch64
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v4
- name: Build wheels
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bytecount = { version = "0.6", features = ["runtime-dispatch-simd"] }
bzip2 = { version = "0.4", optional = true }
flate2 = { version = "1.0.30", optional = true }
memchr = "2.7.2"
pyo3 = { version = "0.24.1", optional = true }
pyo3 = { version = "0.27.2", optional = true }
liblzma = { version = "0.3.1", optional = true }
zstd = { version = "0.13.2", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["maturin>=1.8,<2.0"]
requires = ["maturin>=1.10,<2.0"]
build-backend = "maturin"

[project]
Expand Down
2 changes: 1 addition & 1 deletion src/parser/fasta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ where
}

impl<R: io::Read + Send> FastxReader for Reader<R> {
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>> {
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>> {
if self.finished {
return None;
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser/fastq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ where
}

impl<R: io::Read + Send> FastxReader for Reader<R> {
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>> {
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>> {
// No more records to read
if self.finished {
return None;
Expand Down
2 changes: 1 addition & 1 deletion src/parser/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'a> SequenceRecord<'a> {

/// Returns the cleaned up sequence of the record. For FASTQ it is the same as `raw_seq` but
/// for FASTA it is `raw_seq` minus all the `\r\n`
pub fn seq(&self) -> Cow<[u8]> {
pub fn seq(&self) -> Cow<'_, [u8]> {
match self.buf_pos {
BufferPositionKind::Fasta(bp) => bp.seq(self.buffer),
BufferPositionKind::Fastq(bp) => bp.seq(self.buffer).into(),
Expand Down
2 changes: 1 addition & 1 deletion src/parser/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub trait FastxReader: Send {
/// Gets the next record in the stream.
/// This imitates the Iterator API but does not support any iterator functions.
/// This returns None once we reached the EOF.
fn next(&mut self) -> Option<Result<SequenceRecord, ParseError>>;
fn next(&mut self) -> Option<Result<SequenceRecord<'_>, ParseError>>;
/// Returns the current line/byte in the stream we are reading from
fn position(&self) -> &Position;
/// Returns whether the current stream uses Windows or Unix style line endings
Expand Down
16 changes: 7 additions & 9 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn get_seq_snippet(seq: &str, max_len: usize) -> String {
if seq.len() > max_len {
let start = &seq[..max_len - 4];
let end = &seq[seq.len() - 3..];
format!("{}…{}", start, end)
format!("{start}…{end}")
} else {
seq.to_string()
}
Expand Down Expand Up @@ -156,7 +156,7 @@ impl Record {
#[getter]
pub fn description(&self) -> PyResult<Option<&str>> {
if let Some(pos) = self.id.find(char::is_whitespace) {
Ok(Some(&self.id[pos..].trim_start()))
Ok(Some(self.id[pos..].trim_start()))
} else {
Ok(None)
}
Expand Down Expand Up @@ -219,9 +219,8 @@ impl Record {
let mut hasher = DefaultHasher::new();
self.id.hash(&mut hasher);
self.seq.hash(&mut hasher);
match &self.qual {
Some(qual) => qual.hash(&mut hasher),
None => {}
if let Some(qual) = &self.qual {
qual.hash(&mut hasher);
}
Ok(hasher.finish())
}
Expand Down Expand Up @@ -249,7 +248,7 @@ impl Record {

fn __repr__(&self) -> PyResult<String> {
let id_snippet = match self.name() {
Ok(name) if name != self.id => format!("{}…", name),
Ok(name) if name != self.id => format!("{name}…"),
Ok(name) => name.to_string(),
Err(_) => self.id.clone(),
};
Expand All @@ -259,8 +258,7 @@ impl Record {
None => "None".to_string(),
};
Ok(format!(
"Record(id={}, seq={}, qual={})",
id_snippet, seq_snippet, quality_snippet
"Record(id={id_snippet}, seq={seq_snippet}, qual={quality_snippet})"
))
}
}
Expand Down Expand Up @@ -424,7 +422,7 @@ pub fn py_decode_phred(qual: &str, base_64: bool, py: Python<'_>) -> PyResult<Py
PhredEncoding::Phred33
};
let scores = decode_phred(qual.as_bytes(), encoding)
.map_err(|e| PyValueError::new_err(format!("Invalid Phred quality: {}", e)))?;
.map_err(|e| PyValueError::new_err(format!("Invalid Phred quality: {e}")))?;
Ok(PyTuple::new(py, &scores)?.into())
}

Expand Down
4 changes: 2 additions & 2 deletions src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub fn complement(n: u8) -> u8 {
/// Taking in a sequence string, return the canonical form of the sequence
/// (e.g. the lexigraphically lowest of either the original sequence or its
/// reverse complement)
pub fn canonical(seq: &[u8]) -> Cow<[u8]> {
pub fn canonical(seq: &[u8]) -> Cow<'_, [u8]> {
let mut buf: Vec<u8> = Vec::with_capacity(seq.len());
// enough just keeps our comparisons from happening after they need to
let mut enough = false;
Expand Down Expand Up @@ -136,7 +136,7 @@ pub fn canonical(seq: &[u8]) -> Cow<[u8]> {
/// Find the lexigraphically smallest substring of `seq` of length `length`
///
/// There's probably a faster algorithm for this somewhere...
pub fn minimizer(seq: &[u8], length: usize) -> Cow<[u8]> {
pub fn minimizer(seq: &[u8], length: usize) -> Cow<'_, [u8]> {
let reverse_complement: Vec<u8> = seq.iter().rev().map(|n| complement(*n)).collect();
let mut minmer = Cow::Borrowed(&seq[..length]);

Expand Down
Loading