Metadata-Version: 2.4
Name: yeasti
Version: 0.1.1
Summary: Small dataset of yeast chromosome I
Author-email: Anthony Aylward <anthony.aylward@protonmail.com>
Project-URL: Homepage, https://gitlab.com/aaylward/yeasti
Project-URL: Documentation, https://aaylward.gitlab.io/yeasti
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: biopython
Requires-Dist: pysradb
Dynamic: license-file

# YeastI

## Introduction

This package contains a set of minimal eukaryotic genome and transcriptome datasets from chromosme I of *Saccharomyces cerevisiae*. They may, for example, be useful for rapidly testing a RNA-seq bioinformatics pipeline.

## Installation

Ensure your computing environment includes Python 3.11 or later and the following bioinformatics tools:
- sra-tools
- pigz
- fastp
- kraken2

Conda is useful for setting up this environment. Then, YeastI can be installed with Pip:

```sh
conda create -c conda-forge -c bioconda -n yeasti \
  biopython pysradb sra-tools pigz fastp kraken2
conda activate yeasti
pip install yeasti
```

## Usage

Run `yeasti` without arguments to list the help text of all subcommands

```sh
yeasti
```
```
usage: yeasti [-h] [--version] {init,path,metadata,download,sheet,trim,classify} ...

Small dataset of yeast chromosome 1

positional arguments:
  {init,path,metadata,download,sheet,trim,classify}
    init                fully initialize the dataset by downloading, trimming, and classifying RNA-seq reads
    path                show paths to data directory and files
    metadata            fetch sra metadata
    download            download RNA-seq reads
    sheet               sample sheet for yeasti rna-seq dataset
    trim                trim downloaded reads
    classify            classify downloaded reads

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
```

To download and downsample all RNA-seq data, run:

```sh
yeasti init
```

Use `yeasti path` to get the absolute path for a data file
```sh
yeasti path data-dir
yeasti path genome
yeasti path cds
yeasti path pep
yeasti path gff
yeasti path gtf
yeasti path sheet
```

To see the sample sheet listing the locations of the RNA-seq reads:
```sh
yeasti sheet
```

If you need the data at another location, you can symbolically link to the YeastI dataset, or copy the contents to another directory
```sh
ln -s `yeasti path data-dir` test_data/
cp -r `yeasti path data-dir` test_data/
```

To see the SRA metadata of the RNA-seq reads:
```sh
yeasti metadata
```

To execute the initialization steps individually:
```sh
yeasti download
yeasti trim
yeasti classify
```

## Datasets
![yeasti-datasets.png](docs/source/_static/yeasti-datasets.png)

There are two groups of datasets: 
1. The directly included package data of **chromosome I** sequence and annotation from assembly R64-1-1 at [Ensembl](https://mart.ensembl.org/Saccharomyces_cerevisiae/Info/Index), including:
    - Genome sequence (FASTA)
    - Coding sequences (FASTA)
    - Peptide sequences (FASTA)
    - Gene annotation (GFF3, GTF)
2. The RNA-seq reads from [Prigent et al. (2024)](https://www.nature.com/articles/s41467-024-51309-6), which are downloaded from [SRA/NCBI BioProject PRJNA842028](https://www.ncbi.nlm.nih.gov/bioproject/PRJNA842028/) and downsampled to include only chromosome I reads by running an included script.
    - The study sequenced mRNA from *S. cerevisiae* under sulfur starvation at four timepoints with three replicates each, but only two of the timepoints are included in YeastI (T0 and T120).
    - Other similar dataset references can also be found at the [Saccharomyces Genome Database](https://www.yeastgenome.org/).

## Downsampling RNA-seq
![yeasti-init.png](docs/source/_static/yeasti-init.png)

During the initialization process, after the RNA-seq reads are downloaded they are downsampled by:
1. Adapter and quality trimming with `fastp`
2. Classification with `kraken2` to filter out all reads that do not match chromosome I

## Configuration
You can configure some YEASTI settings using environment variables or a TOML file.

### Environment variables
```sh
export YEASTI_DOWNLOAD_DIR = /absolute/path/to/directory/
export YEASTI_TAXID = <integer>
export YEASTI_SAMPLE_SHEET = /absolute/path/to/sample_sheet.csv
export YEASTI_KRAKEN2_DB /absolute/path/to/kraken2_db/
```

### Config file
By default, YeastI looks for configuration in TOML format at `$HOME/.yeasti.toml`

```toml
download_dir = /absolute/path/to/directory/
taxid = <integer>
sample_sheet = /absolute/path/to/sample_sheet.csv
kraken2_db = /absolute/path/to/kraken2_db/
```

The location of the config file can also be set using an environment variable:
```sh
export YEASTI_CONFIG_FILE=/absolute/path/to/alternate/config.toml
```

## Python API

YeastI resources can also be accessed from within python:

```python
import yeasti
yeasti.init()
yeasti.path('genome')
metadata = yeasti.metadata()
sample_sheet = yeasti.create_sample_sheet(metadata)
yeasti.write_sample_sheet(sample_sheet, 'sample_sheet.csv')
yeasti.download()
yeasti.trim('reads_1.fastq.gz', 'reads_2.fastq.gz')
yeasti.classify('reads_1.fastq.gz', 'reads_2.fastq.gz')
```

