Skip to content
Snippets Groups Projects
Working.md 7.23 KiB
Newer Older
selva's avatar
selva committed
# WORKING WITH BiTIA 

To List available commands and options in bitia, execute `bitia --help`

<div id="termynal" data-termynal>
    <span data-ty="input">python -m bitia --help </span>
    <span data-ty>Usage: python -m bitia [OPTIONS] COMMAND [ARGS]...                                                                                              
                                                                                                                                                 
 <b>Callback</b>                                                                                                                                        
                                                                                                                                                 
<b><i>Options</i></b> <br><br>
<b>--verbose</b>                             [debug|info|warning]  [default: VerbosityLevel.warning]<br>
<b>--plain</b>                 --no-plain                          [default: no-plain]&nbsp;&nbsp;&nbsp;<br>
<b>--server</b>                              TEXT                  [default: None]                                                                   <br>
<b>--install-completion</b>                                        Install completion for the current shell.                                         <br>
<b>--show-completion</b>                                           Show completion for the current shell, to copy it or customize the installation.  <br>
<b>--help </b>                                                      Show this message and exit.                                                       <br>

 <b><i>Commands</i></b> <br><br>

 <b>checksum</b>          value that represents the number of bits in a transmission message<br>
 <b>create-container</b>  Create container for the pipeline. The container starts running immediately on the server. Use command `logs` to stream the output.                                                                                                                     <br>
 <b>list-container</b>    List the remote server associated with the pipeline.                                                                        <br>
 <b>logs</b>              Stream logs for the most recent run of a given pipeline.                                                                    <br>
 <b>run</b>               Run a pipeline                                                                                                              <br>
 <b>submit</b>            Submit your pipelin (url, directory, zip_file).                                                                             <br>
 <b>version</b>           version information                                                                                                         <br>

</span>

</div>

selva's avatar
selva committed
The three commands that are the core of BiTIA's functionality are:
selva's avatar
selva committed
- run
- submit
selva's avatar
selva committed
- logs
selva's avatar
selva committed

selva's avatar
selva committed
<link type="text/css" href="../_static/./css/termynal.css" />
selva's avatar
selva committed


selva's avatar
selva committed
## Bitia run 

<div id="termynal1" data-termynal>
    <span data-ty="input"><b>python -m bitia run --help</span>
    <span data-ty>
Usage: python -m bitia run [OPTIONS] USER_INPUT<br>                     
                                                                      
 Run a pipeline<br>                                                       
                                                                      
 <b><i>Arguments</i></b> <br><br>
 \*    <b>user_input</b>      TEXT  [default: None] [required]<br><br>
<i><b>Options</i></b> <br><br>
<b>--rerun</b>           --no-rerun          [default: no-rerun]         
<b>--output-lines </b>                 TEXT<      
<b>--help </b>                               Show this message and exit. 
</span>
</div>
selva's avatar
selva committed

selva's avatar
selva committed
### 1. Running commands
selva's avatar
selva committed

selva's avatar
selva committed
<div id="termynal2" data-termynal>
selva's avatar
selva committed
    <span data-ty="input">bitia run "samtools convert <foo.fa|http://y.com/foo.fa>"</span>
selva's avatar
selva committed
    <span data-ty="progress"></span>
</div>
selva's avatar
selva committed
The above code will: 
selva's avatar
selva committed
- Checks for the input file `foo.fa` in the current working directory
selva's avatar
selva committed
- Download the input file from the given link `http://example.com/foo.fa` and name it `foo.fa`
selva's avatar
selva committed
- Add the given command `samtools convert <foo.fa|http://example.com/foo.fa` into a pipeline file.
selva's avatar
selva committed
- Extract the current working directory with the pipeline as a zip file that contains a unique hash and send it to the server `public.bitia.link`
- The BiTIA runner in the server will execute the pipeline by: 
    - Installing the given command  `samtools`
selva's avatar
selva committed
    - Downloading the given input file from the link  `http://example.com/foo.fa` and name it `foo.fa`
    - Executing the command `samtools convert foo.fa` 
selva's avatar
selva committed
- Display the resulting output to the user console
selva's avatar
selva committed

selva's avatar
selva committed
### 2. Running Pipelines
selva's avatar
selva committed

selva's avatar
selva committed
<div id="termynal3" data-termynal>
selva's avatar
selva committed
    <span data-ty="input">bitia run pipeline.sh</span>
selva's avatar
selva committed
    <span data-ty="progress"></span>
</div>

selva's avatar
selva committed
for `pipeline.sh`:
```bash
#!/usr/bin/env bash

fastqc *.gz

for file in *_1.fastq.gz
do
   trim_galore --cores 8 --gzip --fastqc --max_n 2 --output_dir Trimmed_Data/ --paired $file ${file%_1.fastq.gz}_2.fastq.gz
done

hisat2-build -p 8 ./Homo_sapiens/UCSC/hg38/Sequence/WholeGenomeFasta/genome.fa index
```

selva's avatar
selva committed
The above code will:
selva's avatar
selva committed
- Extract the current working directory with the `pipeline.sh` as a zip file containing a unique hash and send it to the public `server.bitia.link`
- The BiTIA runner in the server will execute the pipeline .
    - Installing the given commands `fastqc`, `trim_galore`,`hisat2`.
selva's avatar
selva committed
    - executing the commands given in the pipeline
selva's avatar
selva committed
- Displays the resulting output to the user console
selva's avatar
selva committed

selva's avatar
selva committed
### 3. Running Directories with multiple required files
selva's avatar
selva committed


selva's avatar
selva committed
<div id="termynal4" data-termynal>
selva's avatar
selva committed
    <span data-ty="input">bitia run work/</span>
    <span data-ty="progress"></span>
</div>
selva's avatar
selva committed


selva's avatar
selva committed
Here `work` directory has two files `main.bitia.sh` and `input_file_links.txt`

for `main.bitia.sh`:
```bash
#!/usr/bin/env bash

fastqc *.gz

for file in *_1.fastq.gz
do
   trim_galore --cores 8 --gzip --fastqc --max_n 2 --output_dir Trimmed_Data/ --paired $file ${file%_1.fastq.gz}_2.fastq.gz
done

hisat2-build -p 8 ./Homo_sapiens/UCSC/hg38/Sequence/WholeGenomeFasta/genome.fa index
```

and `input_file_links.txt`
```bash
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR200/058/SRR20076358/SRR20076358_1.fastq.gz
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR200/058/SRR20076358/SRR20076358_2.fastq.gz
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR200/061/SRR20076361/SRR20076361_1.fastq.gz
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR200/061/SRR20076361/SRR20076361_2.fastq.gz
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR200/063/SRR20076363/SRR20076363_1.fastq.gz
ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR200/063/SRR20076363/SRR20076363_2.fastq.gz
```


The above code will:
- Extract the given directory with `main.bitia.sh` as a zip file containing a unique hash and send it to the public `server.bitia.link`
- The BiTIA runner in the server will execute the pipeline by:
    - Downloading the given input files which are mentioned in `input_files.txt`.
    - Installing the given commands `fastqc`, `trim_galore`,`hisat2`.
    - Executing the commands given in the pipeline
- Displays the resulting output to the user console


selva's avatar
selva committed
<script type="text/javascript" src="https://raw.githack.com/tiangolo/fastapi/master/docs/en/docs/js/termynal.js" data-termynal-container="#termynal|#termynal1|#termynal2|#termynal3|#termynal4"></script>

selva's avatar
selva committed