Commit cd0f1347 authored by Keller Patrick's avatar Keller Patrick

Changed some methods for better readability

parent 6947b97f
cloneTest @ b6bcec5d
Subproject commit b6bcec5dd4ef7377e4700ab3c380139437c2468a
......@@ -133,8 +133,8 @@ class CWLRestAPI(FlaskView):
"""
The status of the workflow matching the given ID (toil Workflow ID) with all job infos is returned in JSON format.
"""
wf = self.__wfManager.restartWorkflow(workflowID)
return json.dumps(wf)
#wf = self.__wfManager.restartWorkflow(workflowID)
return json.dumps(self.__wfManager.restartWorkflow(workflowID))
@route('/workflows/<workflowID>', methods=['DELETE'])
def killWorkflow(self, workflowID):
......@@ -258,10 +258,10 @@ class WorkflowManager:
if i.workflowID == workflowID:
wfToRestart = i
break
wfToRestart.restart = True
wfToRestart.stopped = False
wfToRestart.callToilRunner()
wfToRestart.restart = False
wfToRestart.restartToilRunner()
return {"workflow_id":wf.workflowID}
def getWorkflowInfoByID(self, id):
"""
......@@ -473,9 +473,18 @@ class WorkflowWrapper(threading.Thread):
"""
The thread specific method run() is called when the thread is started.
"""
self.callToilRunner()
if not self.restart:
self.callToilRunner()
if not self.stopped:
wesParser.parse_log(self.logFilePath, wesDAO, self.workflowDBID)
def restartToilRunner(self):
self.stopped = False
self.toilProcess = threading.Thread(target=callToilRunner)
self.toilProcess.start()
self.toilProcess.join()
#self.callToilRunner()
self.restart = False
def killToilRunner(self):
self.stopped = True
......
......@@ -31,7 +31,7 @@ class CWLParser(ABCParser):
if userid is None:
userid = wes_dao.add_User(authtoken)
workflowid = wes_dao.add_Workflow(userid,'',workflow_name,workflow_descriptor, workflow_type, workflow_type_version,'','QUEUEING')
workflowid = wes_dao.add_Workflow(userid,'',workflow_name,workflow_descriptor, workflow_type, workflow_type_version,'','QUEUED')
for key, value in yaml_json.items():
match = inputs.get(key)
......@@ -67,4 +67,4 @@ class CWLParser(ABCParser):
if __name__ == '__main__':
wesdao = WES_DAO()
parser = CWLParser()
parser.parse_workflow("iwos", "test1","data/ex2.cwl",wesdao, "data/ex2.yml")
\ No newline at end of file
parser.parse_workflow("iwos", "test1","data/ex2.cwl",wesdao, "data/ex2.yml")
FROM ubuntu:16.04
LABEL ubuntu.version="16.04" cutadapt.version="1.16" \
maintainer="christina.herrmann@unibas.ch"
RUN apt-get update && apt-get -yy install python-pip \
&& pip install cutadapt==1.16
WORKDIR /data/
### Optional Inputs ###
# Options that influence how the adapters are found:
adapter:
- TGGAATTCTCGGGTGCCAAGG
#- AAAAAA$
#- GGGGGG$
#front:
# - CCCCCC
#anywhere:
# - GGGGGGG
#errorRate: 0.1
#noIndels: true
#times: 2
#overlap: 4
#matchReadWildcards: true
# PairedEnd options:
#adapterPaired:
# - AAA$
# - GGG$
#frontPaired:
# - CCCCCC
#anywherePaired:
# - GGGGGGG
# Options that influence what gets output to where:
#quiet: true
#infoFile: info.txt
#restFile: rest.txt
#wildcardFile: wildcard.txt
#tooShortOutput: tooshort.txt
#tooLongOutput: toolong.txt
#untrimmedOutput: untrimmed.txt
# Options for filtering of processed reads:
#discardUntrimmed: true
#discardTrimmed: true
#noTrim: true
#maskAdapter: true
minimumLength: 4
#maximumLength: 70
#maxN: 1
# Additional modifications to the reads:
#bwa: true
#stripF3: true
#maq: true
#trimN: true
#noZeroCap: true
#doubleEncode: true
#colorspace: true
#cut: -20
#qualityCutoff: [5]
#qualityBase: 5
#prefix: PRE___
#suffix: ___SUF
#stripSuffix: GCA
#lengthTag: "123"
#untrimmedPairedOutput: untrimmedpaired.txt
#cutPaired: 5
#pairedOutput: cuttedFasta2
# Misc:
#format: .fasta does not work
### Necessary Inputs ###
inputFile:
class: File
# Path has to be relative to location of this yaml file
path: ../../tests/testfiles_Aseq_cl/valid5p_fq2fa_ungzip.fa
#path: ../gzipOutTest.fq
#class: File
#path: ../fasta_test_cut_adapt_2.fa
targetFileName: cutadapt_valid5p_fq2fa_ungzip.fa
### Optional Inputs ###
# Options that influence how the adapters are found:
adapter:
- TGGAATTCTCGGGTGCCAAGG
#- AAAAAA$
#- GGGGGG$
#front:
# - CCCCCC
# - ^CCCCCC
#anywhere:
# - GGGGGGG
#errorRate: 0.1
#noIndels: true
#times: 2
#overlap: 4
#matchReadWildcards: true
# PairedEnd options:
#adapterPaired:
# - AAA$
# - GGG$
#frontPaired:
# - CCCCCC
#anywherePaired:
# - GGGGGGG
# Options that influence what gets output to where:
#quiet: true
#infoFile: info.txt
#restFile: rest.txt
#wildcardFile: wildcard.txt
#tooShortOutput: tooshort.txt
#tooLongOutput: toolong.txt
#untrimmedOutput: untrimmed.txt
# Options for filtering of processed reads:
#discardUntrimmed: true
#discardTrimmed: true
#noTrim: true
#maskAdapter: true
minimumLength: 4
#maximumLength: 70
#maxN: 1
# Additional modifications to the reads:
#bwa: true
#stripF3: true
#maq: true
#trimN: true
#noZeroCap: true
#doubleEncode: true
#colorspace: true
#cut: -20
#qualityCutoff: [5]
#qualityBase: 5
#prefix: PRE___
#suffix: ___SUF
#stripSuffix: GCA
#lengthTag: "123"
#untrimmedPairedOutput: untrimmedpaired.txt
#cutPaired: 5
#pairedOutput: cuttedFasta2
# Misc:
#format: .fasta does not work
### Necessary Inputs ###
inputFile:
class: File
# Path has to be relative to location of this yaml file
path: ../../testfiles_Aseq_cl/valid5p_fq2fa_ungzip.fa
#path: ../gzipOutTest.fq
#class: File
#path: ../fasta_test_cut_adapt_2.fa
targetFileName: cutadapt_valid5p_fq2fa_ungzip.fa
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
label: "FASTQ to FASTA"
doc: |
executes the fastq_to_fasta command of FASTX implemented for version 0.0.14:
optional args:
[rename, keepUnknown, verbose, compress]
fixed args:
[inputFile, targetFileName]
baseCommand: fastq_to_fasta
requirements:
# - $import: runtimeSettingsMedium.yml
- class: InlineJavascriptRequirement
hints:
- class: DockerRequirement
dockerPull: cjh4zavolab/fastx:0.0.14
- class: SoftwareRequirement
packages:
fastx-toolkit:
specs: ["http://identifiers.org/RRID:SCR_005534"]
version: ["0.0.14"]
inputs:
### Optional Inputs ###
rename: #tested
type: boolean?
inputBinding:
position: 1
prefix: -r
doc: |
Rename sequence identifiers to numbers.
keepUnknown: #tested
type: boolean?
inputBinding:
position: 2
prefix: -n
doc: |
keep sequences with unknown (N) nucleotides.
Default is to discard such sequences.
verbose: #tested
type: boolean?
inputBinding:
position: 3
prefix: -v
doc: |
Verbose - report number of sequences.
If [-o] is specified, report will be printed to STDOUT.
If [-o] is not specified (and output goes to STDOUT),
report will be printed to STDERR.
compress: # TODO: runs through but cant be decompressed
type: boolean?
inputBinding:
position: 4
prefix: -z
doc: |
Compress output with GZIP. (take care of the targetFileName to have .gz as suffix)
quality:
type: boolean?
inputBinding:
position: 5
prefix: -Q33
doc: |
Make the most qualities readable
### Necessary Inputs ###
inputFile: #tested
type: File
inputBinding:
position: 5
prefix: -i
doc: |
FASTAQ input file.
targetFileName: #tested #drawback: outPath must be relative, prefix is location of cwl tool
type: string
doc: |
Name of the outputfile. Given as String.
outputs:
q2aResult:
type: stdout
format: edam:format_1929
stdout: $(inputs.inputFile.nameroot).fa
doc: |
usage: fastq_to_fasta [-h] [-r] [-n] [-v] [-z] [-i INFILE] [-o OUTFILE]
Part of FASTX Toolkit 0.0.14 by A. Gordon (assafgordon@gmail.com)
[-h] = This helpful help screen.
[-r] = Rename sequence identifiers to numbers.
[-n] = keep sequences with unknown (N) nucleotides.
Default is to discard such sequences.
[-v] = Verbose - report number of sequences.
If [-o] is specified, report will be printed to STDOUT.
If [-o] is not specified (and output goes to STDOUT),
report will be printed to STDERR.
[-z] = Compress output with GZIP.
[-i INFILE] = FASTA/Q input file. default is STDIN.
[-o OUTFILE] = FASTA output file. default is STDOUT.
############################
s:dateModified: "2018-02-28"
s:author:
- class: s:Person
s:name: Students
- class: s:Person
s:name: Christina J. Herrmann
$namespaces:
s: https://schema.org/
edam: http://edamontology.org/
$schemas:
- https://schema.org/docs/schema_org_rdfa.html
- http://edamontology.org/EDAM_1.18.owl
#!/bin/bash
#SBATCH -Q
#SBATCH -J norm_job_0
#SBATCH --mem=1024
#SBATCH --cpus-per-task=1
module load FASTX-Toolkit/0.0.14-goolf-1.7.20
fastq_to_fasta -r -n -i ../repetitions.fq > repet.fa
\ No newline at end of file
inputFile:
class: File
# Path has to be relative to location of this yaml file
path: ../../tests/testfiles_Aseq_cl/ungzip_fastq.fq
rename: true
keepUnknown: false
#verbose: true
#compress: true
quality: true
targetFileName: fastq2fasta_ungzip.fa
FROM ubuntu:16.04
ENV libgtextutils_version 0.7
ENV fastx_version 0.0.14
RUN apt-get update \
&& apt-get install --yes gcc g++ pkg-config wget \
&& wget https://github.com/agordon/libgtextutils/releases/download/${libgtextutils_version}/libgtextutils-${libgtextutils_version}.tar.gz \
&& tar -xzf libgtextutils-${libgtextutils_version}.tar.gz \
&& cd libgtextutils-${libgtextutils_version} \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& wget https://github.com/agordon/fastx_toolkit/releases/download/${fastx_version}/fastx_toolkit-${fastx_version}.tar.bz2 \
&& tar -xjf fastx_toolkit-${fastx_version}.tar.bz2 \
&& cd fastx_toolkit-${fastx_version} \
&& ./configure \
&& make \
&& make install \
&& cd ..
LABEL maintainer "christina.herrmann@unibas.ch"
FROM ubuntu:16.04
ENV libgtextutils_version 0.7
ENV fastx_version 0.0.14
RUN apt-get update \
&& apt-get install --yes gcc g++ pkg-config wget \
&& wget https://github.com/agordon/libgtextutils/releases/download/${libgtextutils_version}/libgtextutils-${libgtextutils_version}.tar.gz \
&& tar -xzf libgtextutils-${libgtextutils_version}.tar.gz \
&& cd libgtextutils-${libgtextutils_version} \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& wget https://github.com/agordon/fastx_toolkit/releases/download/${fastx_version}/fastx_toolkit-${fastx_version}.tar.bz2 \
&& tar -xjf fastx_toolkit-${fastx_version}.tar.bz2 \
&& cd fastx_toolkit-${fastx_version} \
&& ./configure \
&& make \
&& make install \
&& cd ..
LABEL maintainer "christina.herrmann@unibas.ch"
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
label: "FASTQ/A Reverse Complement"
doc: |
executes the fastx_reverse_complement command of FASTX implemented for version 0.0.13:
optional args:
[compress]
fixed args:
[inputFile, targetFileName]
Producing the Reverse-complement of each sequence in a FASTQ/FASTA file.
usage: fastx_reverse_complement [-h] [-r] [-z] [-v] [-i INFILE] [-o OUTFILE]
Part of FASTX Toolkit 0.0.13 by A. Gordon (assafgordon@gmail.com)
[-h] = This helpful help screen.
[-z] = Compress output with GZIP.
[-i INFILE] = FASTA/Q input file. default is STDIN.
[-o OUTFILE] = FASTA/Q output file. default is STDOUT.
baseCommand: fastx_reverse_complement
stdout: $(inputs.targetFileName)
requirements:
# - $import: runtimeSettingsMedium.yml
- class: InlineJavascriptRequirement
hints:
- class: DockerRequirement
dockerPull: cjh4zavolab/fastx:0.0.14
#dockerFile: >
# $import: fastx-Dockerfile
- class: SoftwareRequirement
packages:
fastx-toolkit:
specs: ["http://identifiers.org/RRID:SCR_005534"]
version: ["0.0.13"]
inputs:
### Optional Inputs ###
compress: # TODO: runs through but cant be decompressed ???
type: boolean?
inputBinding:
position: 1
prefix: -z
doc: |
Compress output with GZIP. (take care of the targetFileName to have .gz as suffix)
### Necessary Inputs ###
inputFile:
type: File
#format: [edam:format_1929, edam:format_1930]
inputBinding:
position: 5
prefix: -i
doc: |
FASTAQ input file.
targetFileName:
type: string
doc: |
Name of the outputfile. Given as String.
outputs:
reverse_complement_out:
type: stdout
#format: edam:format_1929
############################
s:dateCreated: "2017-11-30"
s:author:
- class: s:Person
s:name: Christina J. Herrmann
s:email: mailto:christina.herrmann@unibas.ch
$namespaces:
s: https://schema.org/
edam: http://edamontology.org/
$schemas:
- https://schema.org/docs/schema_org_rdfa.html # Might need to pip install html5lib
- http://edamontology.org/EDAM_1.18.owl
inputFile:
class: File
format: http://edamontology.org/format_1929
# Path has to be relative to location of this yaml file
path: ../../tests/testfiles_Aseq_cl/cutadapt_valid5p_fq2fa_ungzip.fa
targetFileName: "revComp_cutadapt_valid5p_fq2fa_ungzip.fa"
compress: false
cwlVersion: v1.0
class: CommandLineTool
baseCommand: gzip
doc: |
executes the gzip command implemented for version 1.3.12:
optional args:
[decompress, ascii, force, list, name, no-name, quiet, recursive, suffix, test, verbose, (best | fast | speed)]
fixed args:
[stdout, zipFile, targetFileName]
This commandline tool can zip or unzip Files into or from .gz files.
requirements:
# - $import: runtimeSettingsMedium.yml
- class: InlineJavascriptRequirement
hints:
- class: DockerRequirement
dockerPull: cjh4zavolab/gzip:1 #the system temporary directory which
#must be located at /tmp.
stdout: $(inputs.targetFileName)
#passing arguments via boolean: allows to specify the possible arguments
arguments: ["--stdout"] # Doesn't work without --stdout, its necessary because off the stdout output in both cases(decompress and compress) is always streamed to a file
inputs:
### Optional Inputs ###
decompress: #tested
type: boolean?
inputBinding:
position: 1
prefix: --decompress #if true this will be displayed, if false this woun't appear
doc: |
Decompress.
ascii: #TODO: test
type: boolean?
inputBinding:
position: 3
prefix: --ascii
doc: |
Ascii text mode: convert end-of-lines using local conventions.
Not supported for all linux Versions
force: #tested
type: boolean?
inputBinding:
position: 3
prefix: --force
doc: |
Force compression or decompression even if the file has multiple
links or the corresponding file already exists, or if the compressed
data is read from or written to a terminal.
If the input data is not in a format recognized by gzip,
and if the option --stdout is also given, copy the input data
without change to the standard output
list: #tested
type: boolean?
inputBinding:
position: 4
prefix: --list
doc: |
For each compressed file, list the following fields:
compressed size: size of the compressed file
uncompressed size: size of the uncompressed file
ratio: compression ratio (0.0% if unknown)
uncompressed_name: name of the uncompressed file
The uncompressed size is given as -1 for files not
in gzip format, such as compressed .Z files
name: #TODO: test
type: boolean?
inputBinding:
position: 5
prefix: --name
doc: |
When compressing, always save the original file name and time stamp;
this is the default. When decompressing, restore the original file name
and time stamp if present. This option is useful on systems
which have a limit on file name length or when the time stamp
has been lost after a file transfer.
no-name: #TODO: test
type: boolean?
inputBinding:
position: 6
prefix: --no-name
doc: |
When compressing, do not save the original file name and time stamp by default.
(The original name is always saved if the name had to be truncated.)
When decompressing, do not restore the original file name if present
(remove only the gzip suffix from the compressed file name)
and do not restore the original time stamp if present
(copy it from the compressed file).
quiet: #tested
type: boolean?
inputBinding:
position: 7
prefix: --quiet
doc: |
Suppress all warnings.
recursive: #TODO: test
type: boolean?
inputBinding:
position: 8
prefix: --recursive
doc: |
Travel the directory structure recursively.
If any of the file names specified on the command line are directories,
gzip will descend into the directory and compress all the files it finds there
(or decompress them in the case of gunzip ).
suffix: #TODO: test
type: string?
inputBinding:
position: 9
prefix: --suffix
doc: |
Use suffix .suf instead of .gz. Any suffix can be given,
but suffixes other than .z and .gz should be avoided to avoid confusion
when files are transferred to other systems.
test: #tested
type: boolean?
inputBinding:
position: 10
prefix: --test
doc: |
Test. Check the compressed file integrity.
verbose: #tested
type: boolean?
inputBinding:
position: 11
prefix: --verbose
doc: |
Verbose. Display the name and percentage reduction for each file compressed or decompressed.
excSpeedParameter: #TODO: test #call exclusive_parameters and add decompress?, This one has to appear in yml, even if it has no content
type:
- type: record
name: best
fields:
best:
type: boolean
inputBinding:
prefix: --best
- type: record
name: fast
fields:
fast:
type: boolean
inputBinding:
prefix: --fast
- type: record
name: speed
fields:
fast:
type: int #value should be between 1 and 9
inputBinding:
prefix: "-"
separate: false #don't add a space between prefix and value
- "null" #makes this input optional
doc: |
Set the block size to 100 k, 200 k ... 900 k when compressing.
Has no effect when decompressing. For faster compressing.
### Necessary Inputs ###
zipFile: #tested
type: File
inputBinding:
position: 100 #position is relative, if arguments are added via inputs they should be before this one
doc: |
The input zip file which will be unzipped or zipped. If you compress it pay attention to the right file ending.