# scShiba usage

``` bash
usage: scshiba.py [-h] [-p PROCESS] [-s START_STEP] [-v] config

scShiba v0.6.3 - Pipeline for identification of differential RNA splicing in single-cell RNA-seq data

Step 1: gtf2event.py
    - Converts GTF files to event format.
Step 2: sc2junc.py
    - Counts junction reads from STARsolo output files.
Step 3: scpsi.py
    - Calculates PSI values and perform differential analysis.

positional arguments:
  config                Config file in yaml format

options:
  -h, --help            show this help message and exit
  -p PROCESS, --process PROCESS
                        Number of processors to use (default: 1)
  -s START_STEP, --start-step START_STEP
                        Start the pipeline from the specified step (default: 0, run all steps)
  -v, --verbose         Verbose mode
```

Please check the [Manual](../manual/diff_splicing_sc.md/#1-prepare-inputs) to learn how to prepare the `config.yaml`.

The above command will run the following steps:

1. `gtf2event.py`
2. `sc2junc.py`
3. `scpsi.py`

---

## Step1: `gtf2event.py`

``` bash
usage: gtf2event.py [-h] -i GTF [-r REFERENCE_GTF] -o OUTPUT [-p NUM_PROCESS] [-v]

Extract alternative splicing events from GTF file

optional arguments:
  -h, --help            show this help message and exit
  -i GTF, --gtf GTF     Input GTF file
  -r REFERENCE_GTF, --reference-gtf REFERENCE_GTF
                        Reference GTF file
  -o OUTPUT, --output OUTPUT
                        Output directory
  -p NUM_PROCESS, --num-process NUM_PROCESS
                        Number of processors to use
  -v, --verbose         Verbose output
```

Example of `EVENT_SE.txt`:

``` bash
event_id  pos_id  exon  intron_a  intron_b  intron_c  strand  gene_id  gene_name  label
SE_1  SE@GL456354.1@84521-85111@83560-85765  GL456354.1:84521-85111  GL456354.1:83560-84521  GL456354.1:85111-85765  GL456354.1:83560-85765  -  ENSMUSG00000094337  Gm3286  annotated
SE_2  SE@chr10@100080857-100080940@100080130-100087347  chr10:100080857-100080940  chr10:100080130-100080857  chr10:100080940-100087347  chr10:100080130-100087347  +  ENSMUSG00000019966  Kitl  annotated
SE_3  SE@chr10@100485051-100485125@100478022-100487162  chr10:100485051-100485125  chr10:100478022-100485051  chr10:100485125-100487162  chr10:100478022-100487162  -  ENSMUSG00000036676  Tmtc3  annotated
SE_4  SE@chr10@100485051-100485185@100478022-100487162  chr10:100485051-100485185  chr10:100478022-100485051  chr10:100485185-100487162  chr10:100478022-100487162  -  ENSMUSG00000036676  Tmtc3  annotated
SE_5  SE@chr10@100495641-100495661@100494954-100495823  chr10:100495641-100495661  chr10:100494954-100495641  chr10:100495661-100495823  chr10:100494954-100495823  +  ENSMUSG00000019971  Cep290  annotated
SE_6  SE@chr10@100578315-100578431@100577358-100583914  chr10:100578315-100578431  chr10:100577358-100578315  chr10:100578431-100583914  chr10:100577358-100583914  -  ENSMUSG00000046567  4930430F08Rik  annotated
SE_7  SE@chr10@100582263-100582322@100578431-100583914  chr10:100582263-100582322  chr10:100578431-100582263  chr10:100582322-100583914  chr10:100578431-100583914  -  ENSMUSG00000046567  4930430F08Rik  annotated
SE_8  SE@chr10@100594537-100594656@100592429-100595035  chr10:100594537-100594656  chr10:100592429-100594537  chr10:100594656-100595035  chr10:100592429-100595035  +  ENSMUSG00000056912  1700017N19Rik  annotated
SE_9  SE@chr10@100610596-100610715@100609254-100612429  chr10:100610596-100610715  chr10:100609254-100610596  chr10:100610715-100612429  chr10:100609254-100612429  +  ENSMUSG00000056912  1700017N19Rik  annotated
...
```

## Step2: `sc2junc.py`

``` bash
usage: sc2junc.py [-h] -i EXPERIMENT -o OUT [-v]

This script takes STARsolo SJ files and outputs junction read counts

optional arguments:
  -h, --help            show this help message and exit
  -i EXPERIMENT, --experiment EXPERIMENT
                        Experiment table (default: None)
  -o OUT, --out OUT     Output junction file (default: None)
  -v, --verbose         Verbose mode (default: False)
```

## Step3: `scpsi.py`

``` bash
usage: scpsi.py [-h] [-p NUM_PROCESS] [-f FDR] [-d PSI] [-r REFERENCE] [-a ALTERNATIVE] [-m MINIMUM_READS] [--onlypsi] [--excel] [-v] junctions event output

PSI calculation for alternative splicing events in scRNA-seq data

positional arguments:
  junctions             A bed file of Junction read counts generated by bam2junc.sh
  event                 Directory that contains text files of alternative splicing events generated by gtf2event.py
  output                Directory for output files

optional arguments:
  -h, --help            show this help message and exit
  -p NUM_PROCESS, --num-process NUM_PROCESS
                        Number of processors to use (default: 1)
  -f FDR, --fdr FDR     FDR for detecting differential events (default: 0.05)
  -d PSI, --psi PSI     Threshold of delta PSI for detecting differential events (default: 0.1)
  -r REFERENCE, --reference REFERENCE
                        Reference group for detecting differential events (default: None)
  -a ALTERNATIVE, --alternative ALTERNATIVE
                        Alternative group for detecting differential events (default: None)
  -m MINIMUM_READS, --minimum-reads MINIMUM_READS
                        Minumum value of total reads for each junction for detecting differential events (default: 10)
  --onlypsi             Just calculate PSI for each sample, not perform statistical tests (default: False)
  --excel               Make result files in excel format (default: False)
  -v, --verbose         Verbose output (default: False)
```
