Skip to content

5. Quick start

MikiSchikora edited this page Mar 28, 2022 · 8 revisions

Run perSVade modules

As an example, you can run the perSVade pipeline to align reads (module align_reads) with:

  • If you used the Singularity installation (recommended):

    singularity exec -e ./mikischikora_persvade_<tag>.sif bash -c 'source /opt/conda/etc/profile.d/conda.sh && conda activate perSVade_env && python /perSVade/scripts/perSVade align_reads -r <path to the reference genome (fasta)> -o <output_directory> -f1 <forward_reads.fastq.gz> -f2 <reverse_reads.fastq.gz>'

    NOTE: Here the <path to the reference genome (fasta)>, <output_directory>, <forward_reads.fastq.gz> and <reverse_reads.fastq.gz> are the actual files in the host machine. If you encounter environmental errors here, check this FAQ.

  • If you used the Docker installation:

    docker run -v <full_path_to_reference_genome>:/reference_genome_dir -v <full_path_to_output_directory>:/output_directory -v <full_path_to_readsDir>:/reads mikischikora/persvade:<tag> python -u ./scripts/perSVade align_reads -r /output_directory/reference_genome.fasta -o /output_directory -f1 /reads/reads1.fastq.gz -f2 /reads/reads2.fastq.gz

    Note that <full_path_to_reference_genome>, <full_path_to_output_directory> and <full_path_to_readsDir> should be the full paths to the directories in the host machine that contain the reference genome (called reference_genome.fasta), the desired output directory of perSVade and the raw reads (called reads1.fastq.gz and reads2.fastq.gz). Note that the arguments -r, -o, -r1 and -r2 of perSVade refer to paths inside the container, and the -v commmands define mounting points between the container and the host machine. These mounting points are thus essential to allow the input of files to perSVade and the persistence of the data generated.

    Note that the docker container runs the commands with the perSVade_env activated.

  • If you used the traditional installation:

    conda activate perSVade_env

    python ./scripts/perSVade align_reads -r <path to the reference genome (fasta)> -o <output_directory> -f1 <forward_reads.fastq.gz> -f2 <reverse_reads.fastq.gz>

Note that perSVade has many modules that can be combined in any desired way. See Examples and FAQs for more information.

Use perSVade's inner functions

You can import the file ./scripts/sv_functions.py as a python module, which is useful to run some specific functions from a python script/shell. This module can be loaded with these python commands:

import sys; sys.path.append("./scripts")

import sv_functions as fun

You can run a python script inside the Docker container that imports sv_functions, by using the -v option of docker run to share data between the host machine and the container (see above for more detailed examples on how to use the -v option).

Regarding running this in singularity, you can create a script that imports the functions from /perSVade/scripts/sv_functions.py and run it with singularity exec. Singularity has access to all the host machine files, so that you don't need to specify mounting points as with the docker image.

Run perSVade as a one-liner script (deprecated)

You can also use the script scripts/perSVade.py to execute multiple modules of perSVade with a single command. However, this script is less user friendly and error prone, and it will be no longer maintained after version 1.02.3.