Skip to content

Commit

Permalink
fixed sourmash DB issues on > ubuntu18
Browse files Browse the repository at this point in the history
  • Loading branch information
replikation committed Dec 19, 2019
1 parent e75a5fc commit 9b2b5b9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ sudo usermod -a -G docker $USER
* try out the installation by entering the following

```bash
nextflow run replikation/What_the_Phage -r v0.1 --fasta ~/.nextflow/assets/replikation/What_the_Phage/test-data/T7_draft.fa
nextflow run replikation/What_the_Phage -r v0.2 --fasta ~/.nextflow/assets/replikation/What_the_Phage/test-data/T7_draft.fa
```

### Normal Installation
Expand Down Expand Up @@ -93,24 +93,24 @@ nextflow run replikation/What_the_Phage -r v0.1 --fasta ~/.nextflow/assets/repli
./phage.nf --fasta 'test-data/*.fasta'
```

* or execute it directly via a release candidate ( `-r releasenumber` , e.g. `-r v0.1`)
* or execute it directly via a release candidate ( `-r releasenumber` , e.g. `-r v0.2`)

```bash
nextflow run replikation/What_the_Phage -r v0.1 --fasta 'your-fasta-files/*.fasta'
nextflow run replikation/What_the_Phage -r v0.2 --fasta 'your-fasta-files/*.fasta'
# or
nextflow run replikation/What_the_Phage -r v0.1 --fasta your-file.fasta
nextflow run replikation/What_the_Phage -r v0.2 --fasta your-file.fasta
```

* long-read input is supported via `--fastq`

### Tool control

* all the analysis tools included can be separatly turned via adding the option flags
* do `nextflow run replikation/What_the_Phage -r v0.1 --help` for all options
* do `nextflow run replikation/What_the_Phage -r v0.2 --help` for all options

```bash
# in this case Marvel (ma) and deepvirfinder (dv) are deactivated
nextflow run replikation/What_the_Phage -r v0.1 --fasta your-file.fasta --dv --ma
nextflow run replikation/What_the_Phage -r v0.2 --fasta your-file.fasta --dv --ma
```


Expand Down
8 changes: 5 additions & 3 deletions modules/sourmash.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@ process sourmash {
label 'sourmash'
input:
tuple val(name), file(fasta_dir)
tuple file(database), file(dir)
file(database)
//file(database)
output:
tuple val(name), file("${name}_*.list")
shell:
"""
rnd=${Math.random()}
tar xzf ${database}
for fastafile in ${fasta_dir}/*.fa; do
sourmash compute -p ${task.cpus} --scaled 100 -k 21 \${fastafile}
done
for signature in *.sig; do
sourmash search -k 21 \${signature} ${database} -o \${signature}.temporary
sourmash search -k 21 \${signature} phages.sbt.json -o \${signature}.temporary
done
touch ${name}_\${rnd//0.}.list
Expand Down
5 changes: 3 additions & 2 deletions modules/sourmash_download_DB.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process sourmash_download_DB {
if (params.cloudProcess) {
publishDir "${params.cloudDatabase}/sourmash/", mode: 'copy', pattern: "phages.sbt.json"
publishDir "${params.cloudDatabase}/sourmash/", mode: 'copy', pattern: "phages.sbt.json.tar.gz"
}
else {
storeDir "nextflow-autodownload-databases/sourmash/"
Expand All @@ -9,10 +9,11 @@ process sourmash_download_DB {
input:
file(references)
output:
tuple file("phages.sbt.json"), file(".sbt.phages")
file("phages.sbt.json.tar.gz")
script:
"""
sourmash compute --scaled 100 -k 21 --singleton --seed 42 -p 8 -o phages.sig ${references}
sourmash index phages phages.sig
tar czf phages.sbt.json.tar.gz phages.sbt.json .sbt.phages
"""
}
21 changes: 10 additions & 11 deletions phage.nf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ println " "}
exit 1, "input missing, use [--fasta] or [--fastq]"}
if ( params.fasta && params.fastq ) {
exit 1, "please use either [--fasta] or [--fastq] as input"}
if ( params.ma && params.mp && params.vf && params.vs && params.pp && params.dv ) {
if ( params.ma && params.mp && params.vf && params.vs && params.pp && params.dv && params.sm ) {
exit 0, "You deactivated all the tools, so iam done ;) "}

// fasta input or via csv file
Expand Down Expand Up @@ -69,11 +69,14 @@ println " "}

include './modules/PPRmeta' params(output: params.output, cpus: params.cpus)
include './modules/deepvirfinder' params(output: params.output, cpus: params.cpus)
include './modules/download_references' params(cloudProcess: params.cloudProcess, cloudDatabase: params.cloudDatabase)
include './modules/fastqTofasta' params(output: params.output)
include './modules/filter_PPRmeta' params(output: params.output)
include './modules/filter_deepvirfinder' params(output: params.output)
include './modules/filter_marvel' params(output: params.output)
include './modules/filter_metaphinder' params(output: params.output)
include './modules/filter_sourmash' params(output: params.output)
include './modules/filter_tool_names' params(output: params.output)
include './modules/filter_virfinder' params(output: params.output)
include './modules/filter_virsorter' params(output: params.output, cpus: params.cpus)
include './modules/input_suffix_check' params(fastq: params.fastq)
Expand All @@ -83,19 +86,15 @@ println " "}
include './modules/ppr_download_dependencies' params(cloudProcess: params.cloudProcess, cloudDatabase: params.cloudDatabase)
include './modules/r_plot.nf' params(output: params.output)
include './modules/r_plot_reads.nf' params(output: params.output)
include './modules/upsetr.nf' params(output: params.output)
include './modules/removeSmallReads' params(output: params.output)
include './modules/samtools' params(output: params.output)
include './modules/sourmash' params(output: params.output)
include './modules/sourmash_download_DB' params(cloudProcess: params.cloudProcess, cloudDatabase: params.cloudDatabase)
include './modules/split_multi_fasta' params(output: params.output)
include './modules/upsetr.nf' params(output: params.output)
include './modules/virfinder' params(output: params.output, cpus: params.cpus)
include './modules/virsorter' params(output: params.output, cpus: params.cpus)
include './modules/virsorter_download_DB' params(cloudProcess: params.cloudProcess, cloudDatabase: params.cloudDatabase)
include './modules/filter_tool_names' params(output: params.output)
include './modules/samtools' params(output: params.output)
include './modules/split_multi_fasta' params(output: params.output)

include './modules/download_references' params(cloudProcess: params.cloudProcess, cloudDatabase: params.cloudDatabase)
include './modules/sourmash_download_DB' params(cloudProcess: params.cloudProcess, cloudDatabase: params.cloudDatabase)
include './modules/sourmash' params(output: params.output)
include './modules/filter_sourmash' params(output: params.output)

/*************
* DATABASES
Expand Down Expand Up @@ -133,7 +132,7 @@ workflow sourmash_database {
if (!params.cloudProcess) { sourmash_download_DB(references); db = sourmash_download_DB.out }
// cloud storage via db_preload.exists()
if (params.cloudProcess) {
db_preload = file("${params.cloudDatabase}/sourmash/phages.sbt.json")
db_preload = file("${params.cloudDatabase}/sourmash/phages.sbt.json.tar.gz")
if (db_preload.exists()) { db = db_preload }
else { sourmash_download_DB(phage_references()); db = sourmash_download_DB.out }
}
Expand Down

1 comment on commit 9b2b5b9

@replikation
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.