From ee32dc617ba81725eece4ec3b8f5ca21ac35a219 Mon Sep 17 00:00:00 2001 From: Kai Zhang Date: Wed, 2 Oct 2024 21:46:35 +0800 Subject: [PATCH] minor --- README.md | 5 +++++ docs/_static/versions.json | 4 ++-- docs/tutorials/index.rst | 1 + docs/tutorials/txg_atac.ipynb | 3 +++ python/Cargo.toml | 2 +- python/src/pyseqspec.rs | 19 ++++++++++--------- 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 docs/tutorials/txg_atac.ipynb diff --git a/README.md b/README.md index ccbbd36..1d2bb32 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/docs/_static/versions.json b/docs/_static/versions.json index dc99f0f..4d40cca 100644 --- a/docs/_static/versions.json +++ b/docs/_static/versions.json @@ -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/" } ] \ No newline at end of file diff --git a/docs/tutorials/index.rst b/docs/tutorials/index.rst index 9eda9a3..143f3cf 100644 --- a/docs/tutorials/index.rst +++ b/docs/tutorials/index.rst @@ -6,4 +6,5 @@ :maxdepth: 2 txg_multiome + txg_atac generic \ No newline at end of file diff --git a/docs/tutorials/txg_atac.ipynb b/docs/tutorials/txg_atac.ipynb new file mode 100644 index 0000000..cf19e62 --- /dev/null +++ b/docs/tutorials/txg_atac.ipynb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:302d786be3973d47e4cafacfc099fc42bb1aa4440dc051f09dc23981cfaf0b0f +size 4038562 diff --git a/python/Cargo.toml b/python/Cargo.toml index e330fe6..df9f06d 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -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 diff --git a/python/src/pyseqspec.rs b/python/src/pyseqspec.rs index 9b42467..e76570b 100644 --- a/python/src/pyseqspec.rs +++ b/python/src/pyseqspec.rs @@ -79,11 +79,11 @@ impl SeqSpec { min_len: Option, max_len: Option, ) -> 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 { @@ -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(()) } @@ -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 {