Skip to content
Open
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# seqspec

![github version](https://img.shields.io/badge/Version-0.3.1-informational)
[![pypi version](https://img.shields.io/pypi/v/seqspec)](https://pypi.org/project/seqspec/0.3.1/)
![github version](https://img.shields.io/badge/Version-0.3.0-informational)
![python versions](https://img.shields.io/pypi/pyversions/seqspec)
[![license](https://img.shields.io/pypi/l/seqspec)](LICENSE)

Expand Down
10 changes: 1 addition & 9 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ authors:

# Installation

The development version can be installed with

```bash
pip install git+https://github.com/pachterlab/seqspec@devel
```

The official release can be installed directly from pypi

```bash
pip install seqspec
pip install git+https://github.com/IGVF-DACC/seqspec.git@main
```

Verify the installation
Expand Down
80 changes: 78 additions & 2 deletions docs/SEQSPEC_TOOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ Check that the `seqspec` file is correctly formatted and consistent with the [sp
seqspec check [-h] [-o OUT] yaml
```

```python
from seqspec.seqspec_check import run_check

run_check(schema_fn: str, spec_fn: str, o: str)
```

- optionally, `-o OUT` can be used to write the output to a file.
- `yaml` corresponds to the `seqspec` file.

Expand Down Expand Up @@ -133,6 +139,12 @@ $ seqspec check spec.yaml
seqspec find [-h] [-o OUT] [-s Selector] -m MODALITY [-i IDs] yaml
```

```python
from seqspec.seqspec_find import run_find

run_find(spec_fn: str, modality: str, id: str, idtype: str, o: str)
```

- optionally, `-o OUT` can be used to write the output to a file.
- optionally, `-s Selector` is the type of the ID you are searching for (default: region). Can be one of
- read
Expand Down Expand Up @@ -195,6 +207,12 @@ $ seqspec find -m rna -s region-type -i barcode spec.yaml
seqspec file [-h] [-o OUT] [-i IDs] -m MODALITY [-s SELECTOR] [-f FORMAT] [-k KEY] yaml
```

```python
from seqspec.seqspec_file import run_file

run_file(spec_fn: str, m: str, ids: List[str], idtype: str, fmt: str, k: str, o: str, fp=False)
```

- optionally, `-o OUT` can be used to write the output to a file.
- optionally, `-s Selector` is the type of the ID you are searching for (default: read). Can be one of
- read
Expand Down Expand Up @@ -266,6 +284,11 @@ Automatically fill in missing fields in the spec.
seqspec format [-h] [-o OUT] yaml
```

```python
from seqspec.seqspec_format import run_format
run_format(spec_fn: str, o: str)
```

- `-o OUT` the path to create the formatted `seqspec` file.
- `yaml` corresponds to the `seqspec` file.

Expand All @@ -283,11 +306,16 @@ $ seqspec format -o spec.yaml spec.yaml

Identify the position of elements in a spec for use in downstream tools. Returns the 0-indexed position of elements contained in a given region in the 5'->3' direction.

```
```bash
seqspec index [-o OUT] [-t TOOL] [--rev] -m MODALITY -r REGION yaml
seqspec index [-h] [-o OUT] [-t TOOL] [-s SELECTOR] [--rev] -m MODALITY [-i IDs] yaml
```

```python
from seqspec.seqspec_index import run_index
run_index(spec_fn: str, modality: str, ids: List[str], idtype: str, fmt: str, rev: str, subregion_type: str, o)
```

- optionally, `-o OUT` can be used to write the output to a file.
- optionally, `--rev` can be set to return the 3'->5' index.
- optionally, `-t TOOL` returns the indices in the format specified by the tool. One of:
Expand Down Expand Up @@ -342,6 +370,11 @@ $ seqspec index -m atac -t kb -s file spec.yaml
seqspec info [-h] [-k KEY] [-f FORMAT] [-o OUT] yaml
```

```python
from seqspec.seqspec_info import run_info
run_info(spec_fn: str, f: str, k=None, o=None)
```

- optionally, `-o OUT` path to write the info.
- optionally, `-k KEY` the object to display (default: meta). Can be one of
- modalities
Expand Down Expand Up @@ -413,6 +446,11 @@ $ seqspec info -f json -k sequence_spec spec.yaml
seqspec init [-h] -n NAME -m MODALITIES -r READS [-o OUT] newick
```

```python
from seqspec.seqspec_info import run_info
run_info(spec_fn: str, f: str, k: str = None, o: str = None)
```

- optionally, `-o OUT` path to create `seqspec` file.
- `-m MODALITIES` is a comma-separated list of modalities (e.g. rna,atac)
- `-n NAME` is the name associated with the `seqspec` file.
Expand All @@ -432,14 +470,19 @@ $ seqspec init -n myassay -m rna -o spec.yaml -r rna,R1.fastq.gz,r1_primer,26,po
$ seqspec init -n myassay -m rna,atac -o spec.yaml -r rna,rna_R1.fastq.gz,rna_r1_primer,26,pos:rna,rna_R2.fastq.gz,rna_r2_primer,100,neg:atac,atac_R1.fastq.gz,atac_r1_primer,100,pos:atac,atac_R2.fastq.gz,atac_r1_primer,16,neg:atac,atac_R3.fastq.gz,atac_r2_primer,100,neg "(((rna_r1_primer:0,barcode:16,umi:12,cdna:150,rna_r2_primer:0)rna),(barcode:16,atac_r1_primer:1,gdna:150,atac_r2_primer)atac)"
```

## `seqsoec methods`: Convert seqspec file into methods section
## `seqspec methods`: Convert seqspec file into methods section

Generate a methods section from a seqspec file.

```bash
seqspec methods [-h] -m MODALITY [-o OUT] yaml
```

```python
from seqspec.seqspec_methods import run_methods
run_methods(spec_fn: str, m: str, o: str)
```

- optionally, `-o OUT` path to write the methods section.
- `-m MODALITY` is the modality to write the methods for.
- `yaml` corresponds to the `seqspec` file.
Expand Down Expand Up @@ -479,6 +522,13 @@ The library was sequenced on a Illumina NovaSeq 6000 (EFO:0008637) using the Nov
seqspec modify [-h] [--read-id READID] [--read-name READNAME] [--primer-id PRIMERID] [--strand STRAND] [--files FILES] [--region-id REGIONID] [--region-type REGIONTYPE] [--region-name REGIONNAME] [--sequence-type SEQUENCETYPE] [--sequence SEQUENCE] [--min-len MINLEN] [--max-len MAXLEN] [-o OUT] [-i IDs] [-s SELECTOR] -m MODALITY yaml
```

```python
from seqspec.seqspec_modify import run_modify_read, run_modify_region

run_modify_read(spec, modality, target_read, read_id, read_name, primer_id, min_len, max_len, strand, files)
run_modify_region(spec, modality, target_region, region_id, region_type, name, sequence_type, sequence, min_len, max_len)
```

Read modifications

- optionally, `--read-id READID` specifies the new `read_id`.
Expand Down Expand Up @@ -529,6 +579,12 @@ $ seqspec modify -m atac -o mod_spec.yaml -i atac_R1 --files "R1_1.fastq.gz,fast
seqspec onlist [-h] [-o OUT] [-s SELECTOR] [-f FORMAT] [-i IDs] -m MODALITY yaml
```

```python
from seqspec.seqspec_onlist import run_onlist

run_onlist(spec_fn, modality, ids, idtype, fmt, o)
```

- optionally, `-o OUT` to set the path of the onlist file.
- `-m MODALITY` is the modality in which you are searching for the region.
- `-i ID` is the `id` of the object to search for the onlist.
Expand Down Expand Up @@ -563,6 +619,11 @@ Print sequence and/or library structure as ascii, png, or html.
seqspec print [-h] [-o OUT] [-f FORMAT] yaml
```

```python
from seqspec.seqspec_print import run_seqspec_print
run_seqspec_print(spec_fn, fmt, o)
```

- optionally, `-o OUT` to set the path of printed file.
- optionally, `-f FORMAT` is the format of the printed file. Can be one of:
- `library-ascii`: prints an ascii tree of the library_spec
Expand Down Expand Up @@ -651,6 +712,11 @@ $ seqspec print -o spec.png -f seqspec-png spec.yaml
seqspec split [-h] -o OUT yaml
```

```python
from seqspec.seqspec_split import run_split
run_split(spec_fn, o)
```

- optionally, `-o OUT` name prepended to split specs.
- `yaml` corresponds to the `seqspec` file.

Expand All @@ -673,6 +739,11 @@ split.tag.yaml
seqspec version [-h] [-o OUT] yaml
```

```python
from seqspec.seqspec_version import run_version
run_version(spec_fn, o)
```

- optionally, `-o OUT` path to file to write output.
- `yaml` corresponds to the `seqspec` file.

Expand All @@ -693,6 +764,11 @@ This is a hidden subcommand that upgrades an old version of the spec to the curr
seqspec upgrade [-h] [-o OUT] yaml
```

```python
from seqspec.seqspec_upgrade import run_upgrade
run_upgrade(spec_fn, o)
```

### Examples

```bash
Expand Down
1 change: 1 addition & 0 deletions docs/SPECIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Each `Region` has the following properties which are useful to annotate the elem
- `rna`: The modality corresponding to assaying RNA.
- `s5`: A sequencing primer or adaptor typically used in the Nextera kit in conjunction with ME1.
- `s7`: A sequencing primer or adaptor typically used in the Nextera kit in conjunction with ME2.
- `sgrna_target`: A sequence corresponding to the guide RNA spacer region that determines the genomic target of CRISPR-based perturbations.
- `tag`: A short sequence of DNA or RNA used to label or identify a sample, protein, or other grouping.
- `truseq_read1`: The first read primer in a paired-end sequencing run using the Illumina TruSeq Library preparation kit.
- `truseq_read2`: The second read primer in a paired-end sequencing run using the Illumina TruSeq Library preparation kit.
Expand Down
2 changes: 1 addition & 1 deletion docs/assays/10xcrispr.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ library_spec:
parent_id: crispr
- !Region
region_id: sgrna_target
region_type: crispr
region_type: sgrna_target
name: sgrna_target
sequence_type: onlist
sequence: NNNNNNNNNNNNNNNNNXXX
Expand Down
2 changes: 1 addition & 1 deletion docs/assays/sccrispra.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ library_spec:
- !Region
parent_id: crispr_R2_001.fastq.gz
region_id: gRNA
region_type: gRNA
region_type: sgrna_target
name: Guide RNAs
sequence_type: onlist
sequence: NNNNNNNNNNNNNNNNNNNN
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ jsonschema
newick
requests
biopython
packaging
packaging
matplotlib>=3.4.0
24 changes: 8 additions & 16 deletions seqspec/File.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,18 @@ def __init__(
self.md5 = md5

def __repr__(self) -> str:
d = {
"file_id": self.file_id,
"filename": self.filename,
"filetype": self.filetype,
"filesize": self.filesize,
"url": self.url,
"urltype": self.urltype,
"md5": self.md5,
}
d = self.to_dict()
return f"{d}"

def to_dict(self):
d = {
"file_id": self.file_id,
"filename": self.filename,
"filetype": self.filetype,
"filesize": self.filesize,
"url": self.url,
"urltype": self.urltype,
"md5": self.md5,
"file_id": getattr(self, "file_id", None),
"filename": getattr(self, "filename", None),
"filetype": getattr(self, "filetype", None),
"filesize": getattr(self, "filesize", None),
"url": getattr(self, "url", None),
"urltype": getattr(self, "urltype", None),
"md5": getattr(self, "md5", None),
}
return d

Expand Down
17 changes: 3 additions & 14 deletions seqspec/Read.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,13 @@ def set_files(self, files: Optional[List["File"]] = []):
self.files = files

def __repr__(self) -> str:
d = {
"read_id": self.read_id,
"name": self.name,
"modality": self.modality,
"primer_id": self.primer_id,
"min_len": self.min_len,
"max_len": self.max_len,
"strand": self.strand,
"files": self.files,
}
d = self.to_dict()
return f"{d}"

def to_dict(self):
# TODO is this necessary for backwards compatibility?
if self.files:
files = [i.to_dict() for i in self.files]
else:
files = []
files = getattr(self, "files", [])
files = [i.to_dict() for i in files]
d = {
"read_id": self.read_id,
"name": self.name,
Expand Down
2 changes: 1 addition & 1 deletion seqspec/Region.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def __init__(
url: str,
urltype: str,
md5: str,
location: Optional[str],
# location: Optional[str],
) -> None:
super().__init__()
self.file_id = file_id
Expand Down
9 changes: 8 additions & 1 deletion seqspec/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
__version__ = "0.3.1"
__version__ = "0.3.0"


def get_version():
"""
Returns the version of the package.
"""
return __version__
Loading