## exoTras delineates exosome profiles at droplet resolution from single-cell transcriptomes
exoTras /ˈɛkoʊˌtɹeɪs/ stands for <ins>exo</ins>some-containing droplet identification and source <ins>tra</ins>cking in <ins>s</ins>cRNA-seq data.

You can freely use exoTras to explore exosome heterogeneity at single droplet, characterize cell type dynamics in light of exosome activity and unlock diagnostic potential of exosomes in concert with cells.

<p align="center">
  <img src='./docs/exoTras_overview.png'>
</p>
<p align="center">
  Overview of exoTras.
</p>

### Prerequisites
    "numpy", "pandas", "scipy",
    "scanpy", "statsmodels", "gseapy"

### Installation
```bash
pip install exoTras
```
We also suggest to use a separate conda environment for installing exoTras.
```bash
conda create -y -n exoTras_env python=3.7
conda activate exoTras_env
pip install exoTras
```

### Basic Usage
Input for exoTras is a cell-by-gene matrix. In the case of scRNA-seq dataset using 10X Genomics, we used `raw_feature_bc_matrix` directory generated by Cell Ranger as input. Output of exoTras consists of the score of exosome signals and classification for each droplet. Such exosome information will be used for downstream analysis and as basis for the construction of the exosome secretion activity index (ESAI) and source tracking functions.

We implemented four functions for exosomes recognizing and functional analyses. In exoTras, `exosomes_recognizer` recognizes exosome-containing droplets in the raw scRNA-seq data; `source_tracker` and `ESAI_celltype` trace these droplets to their original cell type and estimited corresponding exosome secretion activity; and `cellfree_simulator` simulates transcriptional profile of cell free droplets in scRNA-seq.

### Examples
For a study with multiple scRNA-seq samples, we support two input ways.
```bash
### first    if samples locate in one directory
exoTras.exosomes_recognizer(input_path='directory_path', sample_file='sample_name', out_path='output_path', species='Homo')
### second   if samples locate in differet directories
exoTras.exosomes_recognizer(sample_file='sample_path', out_path='output_path', species='Homo')
```
In the first way, `directory_path` is the path for the directory that contains all sample; and `sample_name` is the file that list each sample in th directory row by row. Every sample should contain directory structure like 'sample/outs/raw_feature_bc_matrix/', and exoTras would automatically recognize for each sample. The second way supports one sample file with abosulte path for each sample, if they are not in one directory.

And `out_path` defines the output of exoTras that is one h5ad file, named 'raw_exoTras.h5ad', with exoTras score and exosome classification in the 'obs' for all droplets, and one named 'exosomes_exoTras.h5ad' with only exosome-containing droplets.

Then, we could source these recoginzed exosomes to original cell type and calculate the exosome secretion activity.
```bash
celltype_exosome_number, adata_exo, adata_combined = exoTras.source_tracker(adata_exo, adata_cell, OBSsample='batch', OBScelltype='celltype')

exo_activity_dat = exoTras.ESAI_celltype(adata_exo, adata_cell, OBSsample='batch', OBScelltype='celltype')
```
In the parameters, the two adata variable represent the exosome- and cell- anndata objects. And `batch` and `celltype` are the indexes of sample names and cell types in the anndata of cells. The output of `source_tracker` is in the 'obsm' of 'adata_exo' indexed as 'source'.

Further tutorials please refer to  https://exoTras.readthedocs.io/.

