From 7487d8434fd4983c9aa4e8a7189b99e57a88f7d9 Mon Sep 17 00:00:00 2001 From: Kai Zhang Date: Mon, 30 Sep 2024 18:42:59 +0800 Subject: [PATCH] add templates --- python/Cargo.toml | 1 + python/src/pyseqspec.rs | 7 +- seqspec_templates/10x_rna_atac.yaml | 231 ++++++++++++++++++++++++++++ 3 files changed, 237 insertions(+), 2 deletions(-) create mode 100644 seqspec_templates/10x_rna_atac.yaml diff --git a/python/Cargo.toml b/python/Cargo.toml index c160fe6..280441b 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -12,6 +12,7 @@ crate-type = ["cdylib"] anyhow = "1.0" bwa-mem2 = { git = "https://github.com/regulatory-genomics/bwa-mem2-rust.git", rev = "07eda9b9c2815ae52b3fa30b01de0e19fae31fe0" } bstr = "1.0" +cached-path = "0.6" either = "1.13" itertools = "0.13" noodles = { version = "0.80", features = ["core", "fastq", "bam", "sam", "bgzf"] } diff --git a/python/src/pyseqspec.rs b/python/src/pyseqspec.rs index caeb97c..ae886e7 100644 --- a/python/src/pyseqspec.rs +++ b/python/src/pyseqspec.rs @@ -4,6 +4,7 @@ use pyo3::prelude::*; use seqspec::{Assay, File, Modality, Read, Region, Strand, UrlType}; use anyhow::Result; use termtree::Tree; +use cached_path::Cache; /** A SeqSpec object. @@ -17,7 +18,7 @@ use termtree::Tree; Parameters ---------- path - Path to the AnnData file. + The local path or url to the seqspec file. See Also -------- @@ -32,7 +33,9 @@ impl SeqSpec { #[new] #[pyo3(signature = (path))] pub fn new(path: &str) -> Result { - let assay = Assay::from_path(path)?; + let cache = Cache::new()?; + let file = cache.cached_path(path)?; + let assay = Assay::from_path(file)?; Ok(SeqSpec(assay)) } diff --git a/seqspec_templates/10x_rna_atac.yaml b/seqspec_templates/10x_rna_atac.yaml new file mode 100644 index 0000000..7ba507e --- /dev/null +++ b/seqspec_templates/10x_rna_atac.yaml @@ -0,0 +1,231 @@ +!Assay +seqspec_version: 0.3.0 +assay_id: 10xMultiome +name: 10x-ATAC-RNA +doi: https://www.globenewswire.com/en/news-release/2020/09/15/2093690/0/en/10x-Genomics-First-to-Market-With-Product-to-Simultaneously-Capture-Epigenome-and-Transcriptome.html +date: 15 September 2020 +description: Single Cell Multiome ATAC + Gene Expression +modalities: +- rna +- atac +lib_struct: https://teichlab.github.io/scg_lib_structs/methods_html/10xChromium_multiome.html +library_protocol: Any +library_kit: Illumina Truseq Dual Index +sequence_protocol: Illumina NovaSeq 6000 +sequence_kit: NovaSeq 6000 v1.5 +sequence_spec: [] +library_spec: +- !Region + parent_id: null + region_id: rna + region_type: rna + name: 10x-ATAC-RNA-MULTI-seq RNA + sequence_type: joined + sequence: AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCTNNNNNNNNNNNNNNNNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAGATCGGAAGAGCACACGTCTGAACTCCAGTCACNNNNNNNNATCTCGTATGCCGTCTTCTGCTTG + min_len: 153 + max_len: 250 + onlist: null + regions: + - !Region + parent_id: rna + region_id: rna-illumina_p5 + region_type: illumina_p5 + name: Illumina P5 + sequence_type: fixed + sequence: AATGATACGGCGACCACCGAGATCTACAC + min_len: 29 + max_len: 29 + onlist: null + regions: null + - !Region + parent_id: rna + region_id: rna-truseq_read1 + region_type: truseq_read1 + name: RNA Truseq Read 1 + sequence_type: fixed + sequence: TCTTTCCCTACACGACGCTCTTCCGATCT + min_len: 29 + max_len: 29 + onlist: null + regions: null + - !Region + parent_id: rna + region_id: rna-cell_barcode + region_type: barcode + name: Cell Barcode + sequence_type: onlist + sequence: NNNNNNNNNNNNNNNN + min_len: 16 + max_len: 16 + onlist: !Onlist + file_id: gex_737K-arc-v1.txt.gz + filename: gex_737K-arc-v1.txt.gz + filetype: txt + filesize: 0 + url: https://teichlab.github.io/scg_lib_structs/data/10X-Genomics/gex_737K-arc-v1.txt.gz + urltype: https + md5: 0 + location: local + regions: null + - !Region + region_id: rna-umi + region_type: umi + name: GEX UMI + sequence_type: random + sequence: XXXXXXXXXXXX + min_len: 12 + max_len: 12 + onlist: null + regions: null + parent_id: rna + - !Region + parent_id: rna + region_id: rna-cDNA + region_type: cdna + name: RNA-cDNA + sequence_type: random + sequence: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + min_len: 1 + max_len: 98 + onlist: null + regions: null + - !Region + parent_id: rna + region_id: rna-truseq_read2 + region_type: truseq_read2 + name: Truseq Read 2 + sequence_type: fixed + sequence: AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC + min_len: 34 + max_len: 34 + onlist: null + regions: null + - !Region + parent_id: rna + region_id: rna-index7 + region_type: index7 + name: Truseq Read 2 + sequence_type: onlist + sequence: NNNNNNNN + min_len: 8 + max_len: 8 + onlist: null + regions: null + - !Region + parent_id: rna + region_id: rna-illumina_p7 + region_type: illumina_p7 + name: Illumina P7 + sequence_type: fixed + sequence: ATCTCGTATGCCGTCTTCTGCTTG + min_len: 24 + max_len: 24 + onlist: null + regions: null +- !Region + parent_id: null + region_id: atac + region_type: atac + name: ATAC + sequence_type: joined + sequence: AATGATACGGCGACCACCGAGATCTACACNNNNNNNNNNNNNNNNCGCGTCTGTCGTCGGCAGCGTCAGATGTGTATAAGAGACAGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXCTGTCTCTTATACACATCTCCGAGCCCACGAGACNNNNNNNNATCTCGTATGCCGTCTTCTGCTTG + min_len: 153 + max_len: 250 + onlist: null + regions: + - !Region + parent_id: atac + region_id: atac-illumina_p5 + region_type: illumina_p5 + name: Illumina P5 + sequence_type: fixed + sequence: AATGATACGGCGACCACCGAGATCTACAC + min_len: 29 + max_len: 29 + onlist: null + regions: null + - !Region + parent_id: atac + region_id: atac-cell_barcode + region_type: barcode + name: R2 Cell Barcode + sequence_type: onlist + sequence: NNNNNNNNNNNNNNNN + min_len: 16 + max_len: 16 + onlist: !Onlist + file_id: atac_737K-arc-v1.txt.gz + filename: atac_737K-arc-v1.txt.gz + filetype: txt + filesize: 0 + url: https://teichlab.github.io/scg_lib_structs/data/10X-Genomics/atac_737K-arc-v1.txt.gz + urltype: https + md5: 0 + location: remote + regions: null + - !Region + parent_id: atac + region_id: atac-linker + region_type: linker + name: atac linker + sequence_type: fixed + sequence: CGCGTCTG + min_len: 8 + max_len: 8 + onlist: null + regions: null + - !Region + parent_id: atac + region_id: atac-nextera_read1 + region_type: nextera_read1 + name: nextera_read1 + sequence_type: fixed + sequence: TCGTCGGCAGCGTCAGATGTGTATAAGAGACAG + min_len: 33 + max_len: 33 + onlist: null + regions: null + - !Region + parent_id: atac + region_id: gDNA + region_type: gdna + name: gDNA + sequence_type: random + sequence: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + min_len: 1 + max_len: 98 + onlist: null + regions: null + - !Region + parent_id: atac + region_id: atac-nextera_read2 + region_type: nextera_read2 + name: nextera_read2 + sequence_type: fixed + sequence: CTGTCTCTTATACACATCTCCGAGCCCACGAGAC + min_len: 34 + max_len: 34 + onlist: null + regions: null + - !Region + parent_id: atac + region_id: atac-index7 + region_type: index7 + name: ATAC index7 + sequence_type: onlist + sequence: NNNNNNNN + min_len: 8 + max_len: 8 + onlist: null + regions: null + - !Region + parent_id: atac + region_id: atac-illumina_p7 + region_type: illumina_p7 + name: Illumina P7 + sequence_type: fixed + sequence: ATCTCGTATGCCGTCTTCTGCTTG + min_len: 24 + max_len: 24 + onlist: null + regions: null \ No newline at end of file