Skip to content

Commit

Permalink
Update pipeline to accept threads argument
Browse files Browse the repository at this point in the history
  • Loading branch information
reagank committed Feb 6, 2023
1 parent 3279dcd commit 9f4b8bd
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.with_refs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN mkdir /build && cd /build &&\
tar -xvjf samtools-1.11.tar.bz2 && cd samtools-1.11/ && ./configure --prefix=/varpipe_wgs/tools/a/samtools && make && make install &&\
cp /varpipe_wgs/tools/a/samtools/bin/samtools /varpipe_wgs/tools/ && cd / && rm -rf /build

RUN ln -s /usr/bin/python2.7 /usr/bin/python &&\
RUN ln -s /usr/bin/python2.7 /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python2 &&\
wget -O- https://bootstrap.pypa.io/pip/2.7/get-pip.py >get-pip.py && python get-pip.py &&\
pip2 install pyyaml fpdf

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.without_refs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN mkdir /build && cd /build &&\
tar -xvjf samtools-1.11.tar.bz2 && cd samtools-1.11/ && ./configure --prefix=/varpipe_wgs/tools/a/samtools && make && make install &&\
cp /varpipe_wgs/tools/a/samtools/bin/samtools /varpipe_wgs/tools/ && cd / && rm -rf /build

RUN ln -s /usr/bin/python2.7 /usr/bin/python &&\
RUN ln -s /usr/bin/python2.7 /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python2 &&\
wget -O- https://bootstrap.pypa.io/pip/2.7/get-pip.py >get-pip.py && python get-pip.py &&\
pip2 install pyyaml fpdf

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ docker run -it -v <path to data>:/varpipe_wgs/data -v <path to references>:/varp

Those commands will download the most recent version of the pipeline and then start the container and connect to it.

When connected to the container you will be in the directory /varpipe_wgs/data. From there simply start the pipeline with the command
When connected to the container you will be in the directory /varpipe_wgs/data. From there simply start the pipeline with the command, where \<threads\> is the number of threads you would like to run (Default: 4)

```console
cd /varpipe_wgs/data
./runVarpipeline.sh
./runVarpipeline.sh <threads>
```

That will identify all gzipped fastq files in the directory and run the pipeline over them, creating a results folder named "Output_\<MM\>_\<DD\>_\<YYYY\>"
Expand Down Expand Up @@ -99,7 +99,7 @@ When connected to the container you will be in your home directory. You must cd

```console
cd /varpipe_wgs/data
./runVarpipeline.sh
./runVarpipeline.sh <threads>
```

That will identify all gzipped fastq files in the directory and run the pipeline over them, creating a results folder named "Output_\<MM\>_\<DD\>_\<YYYY\>"
Expand All @@ -113,6 +113,7 @@ When the pipeline is finished you can disconnect from and close the container by
To run the pipeline locally, you will need to have the following programs installed:

- Python 2.7
- Python 3
- Java 1.8
- Singularity >=3.5

Expand All @@ -136,11 +137,11 @@ Latly, update the script tools/clockwork-0.11.3/clockwork script to correctly po

### Run the Pipeline ###

After the data has been added to the data/ directory, cd into data/ and run the pipeline with the commands
After the data has been added to the data/ directory, cd into data/ and run the pipeline with the command, where \<threads\> is the number of threads you would like to run (Default: 4)

```console
cd data/
./runVarpipeline.sh
./runVarpipeline.sh <threads>
```

That will identify all gzipped fastq files in the directory and run the pipeline over them, creating a results folder named "Output_\<MM\>_\<DD\>_\<YYYY\>"
Expand Down
9 changes: 8 additions & 1 deletion data/runVarpipeline.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/bash

if [ -z "$1" ]; then
THREADS=4
else
THREADS="$1"
fi

if [ -n '*_L001_R2_001*' ]
then

Expand Down Expand Up @@ -35,8 +41,9 @@ then

fi

ls *_R1_001.fastq.gz | sed 's/_R1_001.fastq.gz//g' | awk '{print "../tools/Varpipeline -q "$0"_R1_001.fastq.gz -r ../tools/ref2.fa -n "$0" -q2 "$0"_R2_001.fastq.gz -a -v"}' > run_3.sh
ls *_R1_001.fastq.gz | sed 's/_R1_001.fastq.gz//g' | awk '{print "../tools/Varpipeline -q "$0"_R1_001.fastq.gz -r ../tools/ref2.fa -n "$0" -q2 "$0"_R2_001.fastq.gz -a -v -t '${THREADS}' "}' > run_3.sh

cat run_3.sh

sh run_3.sh
rm *.fastq.gz
Expand Down
5 changes: 3 additions & 2 deletions tools/Varpipeline
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python2

if __name__ == '__main__':
import sys
Expand All @@ -16,6 +16,7 @@ if __name__ == '__main__':
group1.add_argument('-r', '--reference', required=True, metavar="STRING", help='Reference genome in FASTA format.')
group1.add_argument('-n', '--name', required=True, metavar="STRING", help='Sample name to be used as a prefix.')
group1.add_argument('-q2', '--fastq2', default='', metavar="STRING", help='Second paired-end FASTQ file.')
group1.add_argument('-t', '--threads', action='store', metavar="INT", help='Specify how many threads to use')
group2 = parser.add_argument_group('Output', '')
group2.add_argument('-o', '--outdir', help='Output directory', metavar="STRING")
group2.add_argument('--keepfiles', action='store_true', help='Keep intermediate files.')
Expand Down Expand Up @@ -94,7 +95,7 @@ if __name__ == '__main__':

# All is well let's get started!
s = Varpipeline.snp(args.fastq, args.outdir, args.reference, args.name, paired, args.fastq2,
args.verbose, ' '.join(sys.argv))
args.verbose, args.threads, ' '.join(sys.argv))
# run Clockwork decontamination
s.runClockwork()

Expand Down
3 changes: 2 additions & 1 deletion tools/Varpipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class snp():

def __init__(self, input, outdir, reference, name, paired,input2, verbose, argString):
def __init__(self, input, outdir, reference, name, paired,input2, verbose, threads, argString):
i = datetime.now()
self.name = name
self.flog = "Output_" + i.strftime('%m_%d_%Y')
Expand All @@ -39,6 +39,7 @@ def __init__(self, input, outdir, reference, name, paired,input2, verbose, argSt
self.__mixed = ''
self._low = ''
self.__exception = ''
self.__threads = threads


# Create the output directory, and start the log file.
Expand Down
2 changes: 1 addition & 1 deletion tools/clockwork-0.11.3/clockwork
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

singularity exec tools/clockwork-0.11.3/clockwork_v0.11.3.img clockwork "$@"
singularity exec ../tools/clockwork-0.11.3/clockwork_v01.11.3.img clockwork "$@"
2 changes: 1 addition & 1 deletion tools/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ scripts:
create_report: /create_report.py
print_report: /pdf_print.py
other:
threads: '12'
threads: '4'

0 comments on commit 9f4b8bd

Please sign in to comment.