Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhang committed Oct 2, 2024
1 parent f17da91 commit ee32dc6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Single-cell genomics preprocessing package

![PyPI](https://img.shields.io/pypi/v/precellar)
![PyPI - Downloads](https://img.shields.io/pypi/dm/precellar)
![Continuous integration](https://github.com/regulatory-genomics/precellar/workflows/test-python-package/badge.svg)
![GitHub Repo stars](https://img.shields.io/github/stars/regulatory-genomics/precellar?style=social)

This tool is an automated pipeline for preprocessing single-cell genomics data.
It is designed to take raw data (fastq files) from a variety of single-cell genomics
platforms and a seqspec file as input, and output a count matrix (RNA) or a fragment file (ATAC)
Expand Down
4 changes: 2 additions & 2 deletions docs/_static/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
},
{
"name": "0.1 (stable)",
"version": "dev",
"version": "0.1",
"preferred": true,
"url": "https://lab.kaizhang.org/precellar/version/dev/"
"url": "https://lab.kaizhang.org/precellar/version/0.1/"
}
]
1 change: 1 addition & 0 deletions docs/tutorials/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
:maxdepth: 2

txg_multiome
txg_atac
generic
3 changes: 3 additions & 0 deletions docs/tutorials/txg_atac.ipynb
Git LFS file not shown
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "precellar-py"
version = "0.1.0"
version = "0.1.1-dev1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
19 changes: 10 additions & 9 deletions python/src/pyseqspec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ impl SeqSpec {
min_len: Option<usize>,
max_len: Option<usize>,
) -> Result<()> {
let mut all_reads = self.0.sequence_spec.take().unwrap_or(Vec::new());
let all_reads = &mut self.0.sequence_spec;
let mut read_exist = false;
let mut read_buffer = Read::default();
read_buffer.read_id = read_id.to_string();
let read = if let Some(r) = all_reads.iter_mut().find(|r| r.read_id == read_id) {
let read = if let Some(r) = all_reads.as_mut().map(|r| r.iter_mut().find(|r| r.read_id == read_id)).flatten() {
read_exist = true;
r
} else {
Expand Down Expand Up @@ -124,9 +124,12 @@ impl SeqSpec {
}

if !read_exist {
all_reads.push(read_buffer);
if let Some(r) = all_reads.as_mut() {
r.push(read_buffer);
} else {
all_reads.replace(vec![read_buffer]);
}
}
self.0.sequence_spec = Some(all_reads);

Ok(())
}
Expand Down Expand Up @@ -208,11 +211,9 @@ fn format_read(read: &Read) -> String {
} else {
format!("{}-{}", read.min_len, read.max_len)
};
if read.is_reverse() {
format!("↑{}({})", read.read_id, len)
} else {
format!("↓{}({})", read.read_id, len)
}
let orientation = if read.is_reverse() { "↑" } else { "↓" };
let has_files = if read.files.as_ref().map(|x| !x.is_empty()).unwrap_or(false) { "✓" } else { "✗" };
format!("{}{}({}){}", orientation, read.read_id, len, has_files)
}

fn make_file_path(path: &str) -> Result<File> {
Expand Down

0 comments on commit ee32dc6

Please sign in to comment.