Virus genome assembly with Unicycler and Spades.
Help improve this workflow!
This workflow has been published but could be further improved with some additional meta data:- Keyword(s) in categories input, output, operation
You can help improve this workflow by suggesting the addition or removal of keywords, suggest changes and report issues, or request to become a maintainer of the Workflow .
Virus genome assembly with Unicycler and Spades, The 2 assemblers works in parallel. The graph visualization is made with Bandage. workflow git repository : https://github.com/fjrmoreews/cwl-workflow-SARS-CoV-2/blob/master/Assembly/workflow/assembly-wf-virus.cwl Based on https://github.com/galaxyproject/SARS-CoV-2/blob/master/genomics/2-Assembly/as_wf.png
Code Snippets
72 73 74 75 76 77 78 | baseCommand: bash arguments: [bandage_image_launch.sh] hints: DockerRequirement: dockerPull: "fjrmore/bandage" |
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - entryname: bandage_image_launch.sh entry: | #!/bin/bash ########################### # Bandage image wrapper export QT_QPA_PLATFORM=minimal TMPDIR=$PWD"/tmp_runtime-bandage" mkdir -p $TMPDIR export XDG_RUNTIME_DIR=$TMPDIR GRAPH="$(inputs.graph.path)" IMAGE="$(inputs.graph.nameroot).$(inputs.format)" Bandage image $GRAPH $IMAGE \\ ${ var opt="" if(inputs.height!=null){ opt+=" --height "+inputs.height+ " " } if(inputs.width!=null){ opt+=" --width "+inputs.width +" " } if(inputs.node_length==true){ opt+=" --names " } if(inputs.node_length==true){ opt+=" --lengths " } return opt } |
46 47 48 49 50 51 52 | baseCommand: bash arguments: [bandage_info_launch.sh] hints: DockerRequirement: dockerPull: "fjrmore/bandage" |
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - entryname: bandage_info_launch.sh entry: | #!/bin/bash ########################### # Bandage info wrapper export QT_QPA_PLATFORM=minimal TMPDIR=$PWD"/tmp_runtime-bandage" mkdir -p $TMPDIR export XDG_RUNTIME_DIR=$TMPDIR Bandage info '$(inputs.graph.path)' \\ ${ var opt="" if(inputs.tsv==true){ opt+=" --tsv " } return opt } \\ > assembly_graph_info.txt |
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | baseCommand: - bash inputs: libraries_metadata: type: type: array items: type: record fields: lib_index: int? orientation: string? lib_type: string? doc: | reads library metadata related to libraries_fwd_rev and libraries_mono inputs lib_index(id) must match libraries_fwd_rev: type: type: array items: type: record fields: lib_index: int? fwd_reads: File? rev_reads: File? doc: | reads file orientation must be a value in ff, fr, rf K-mer choices can be chosen by SPAdes instead of being entered manually libraries_mono: type: type: array items: type: record fields: lib_index: int? file_type: string? reads: File? doc: | reads file file_type value must be in : interleaved, merged, unpaired pacbio_reads: type: File[]? nanopore_reads: type: File[]? sanger_reads: type: File[]? trusted_contigs: type: File[]? untrusted_contigs: type: File[]? auto_kmer_choice: type: boolean default: true doc: | Automatically choose k-mer values. K-mer choices can be chosen by SPAdes instead of being entered manually kmers: type: string default: "21,33,55" doc: | K-mers to use, separated by commas. Comma-separated list of k-mer sizes to be used (all values must be odd, less than 128, listed in ascending order, and smaller than the read length). The default value is 21,33,55 cov_state: type: - "null" - type: enum symbols: - off - value - auto doc: | Coverage cutoff ( 'auto', or 'off', or 'value'). auto if null when cov_state=value (User Specific) , cov_cutoff must be provided cov_cutoff: type: float? doc: | coverage cutoff value (a positive float number ) iontorrent: type: boolean default: false doc: | true if Libraries are IonTorrent reads. sc: type: boolean default: false doc: | This option is required for MDA. true if single-cell data. onlyassembler: type: boolean default: false doc: | Run only assembly if true (without read error correction) careful: type: boolean default: true doc: | Careful correction. Tries to reduce number of mismatches and short indels. Also runs MismatchCorrector, a post processing tool, which uses BWA tool (comes with SPAdes). outputs: out_contig_stats: type: File outputBinding: glob: out_contig_stats.* doc: "contig stats, default column_names: name,length,coverage" out_scaffold_stats: type: File outputBinding: glob: out_scaffold_stats.* doc: "scaffold stats, default column_names: name,length,coverage" out_contigs: type: File outputBinding: glob: contigs.fasta doc: "contigs (fasta sequence)" out_scaffolds: type: File outputBinding: glob: scaffolds.fasta doc: "scaffolds (fasta sequence)" # - id: all_script # type: # - type: array # items: File # outputBinding: # glob: "*.sh" # doc: "generated script to run spades. for learning purpose" all_log: type: - type: array items: File outputBinding: glob: "*.log" doc: "spades output log and warnings" # - id: out_log # type: File # outputBinding: # glob: spades.log # doc: "spades output log" assembly_graph: type: File outputBinding: glob: assembly_graph.fastg doc: "assembly graph" assembly_graph_with_scaffolds: type: File outputBinding: glob: assembly_graph_with_scaffolds.gfa doc: "assembly graph with scaffolds" arguments: - spades_wrapper.sh |
171 172 173 174 175 176 177 178 179 180 181 182 | - entryname: write_tsv.py entry: | #######input file here #!/usr/bin/env python import sys,re search_str = r'^>(NODE|\S+)_(\d+)(?:_|\s)length_(\d+)_cov_(\d+\.*\d*).*\$' replace_str = r'\1_\2\t\3\t\4' cmd = re.compile(search_str) sys.stdout.write('#name\tlength\tcoverage\n') for i,line in enumerate(sys.stdin): if cmd.match(line): sys.stdout.write(cmd.sub(replace_str,line)) |
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | - entryname: spades_wrapper.sh entry: | ####################spades launcher #!/bin/bash ## An example command looks like: ## spades.py -k 21,33,55,77,99,127 --careful -1 Y.fastq.gz -2 X.fastq.gz -t 24 -o output read -d '' MEMORY_GB << EOF ${ //compute memory limits var mem="250" if(runtime.ram){ var bt=runtime.ram * 1048576 //mebibytes to bytes bt=bt*0.000000001 //bytes to Gigabytes mem=parseInt(bt) } return "-"+mem } EOF #echo "MEMORY_GB limit: \$MEMORY_GB" read -d '' CORES << EOF ${ //compute core / slot var cores="16" if(runtime.cores){ cores=runtime.cores } return cores } EOF #echo "CORES : \$CORES" read -d '' SPADES_OPT << EOF ${ var opt="" if (inputs.sc==true){ opt+=" --sc " } if (inputs.onlyassembler==true){ opt+=" --only-assembler " } if (inputs.careful==true){ opt+=" --careful " } return opt } EOF read -d '' CMD_BASE << EOF spades.py -o . --disable-gzip-output \$SPADES_OPT -t \$CORES -m \$MEMORY_GB ${ var opt="" if (inputs.auto_kmer_choice==false){ opt+=" -k "+inputs.kmers } return opt } ${ var opt="" if (inputs.cov_state==null || inputs.cov_state == "auto"){ opt+=" --cov-cutoff 'auto' " } else if (inputs.cov_state == "value"){ opt+=" --cov-cutoff '"+inputs.cov_cutoff+"' " } if (inputs.iontorrent==true ){ opt+=" --iontorrent " } return opt } EOF ########################################## ##Sequence files from libraries read -d '' CMD_READ1 << EOF ${ var opt="" var lib_prefix = {} var lib_meta=inputs.libraries_metadata if (lib_meta!=null){ for(var j=0; j<lib_meta.length;j++){ var prefix="" var lmeta=lib_meta[j] if (lmeta.lib_type !=null && lmeta.lib_type == "paired_end"){ prefix = 'pe' } else if (lmeta.lib_type !=null && lmeta.lib_type == "mate_paired"){ prefix = 'mp' } else if (lmeta.lib_type !=null && lmeta.lib_type == "nxmate_paired"){ prefix = 'nxmate' } else { prefix = 'hqmp' } var idx=lmeta.lib_index lib_prefix[idx]=prefix opt+=" --"+prefix+idx+"-"+lmeta.orientation+" " } } var libraries = [] if(inputs.libraries_fwd_rev!=null){ for (var i = 0; i < inputs.libraries_fwd_rev.length ; i++) { var lib=inputs.libraries_fwd_rev[i] lib.file_type="separate" libraries[i] = lib } } if(inputs.libraries_mono!=null){ for (var i = 0; i < inputs.libraries_mono.length ; i++) { var ei= libraries.length libraries[ei] = inputs.libraries_mono[i] } } for(var j=0; j<libraries.length;j++){ var lib=libraries[j] var idx=lib.lib_index var prefix=lib_prefix[idx] if(lib.file_type!=null){ if ( lib.file_type == "separate"){ opt+=" --"+prefix+idx+"-1 "+"fastq:"+lib.fwd_reads.path+" " opt+=" --"+prefix+idx+"-2 "+"fastq:"+lib.rev_reads.path+" " }else{ var suffix if ( lib.file_type == "interleaved"){ suffix="12" } if ( lib.file_type == "merged"){ suffix="m" } if ( lib.file_type == "unpaired"){ suffix="s" } opt+=" --"+prefix+idx+"-"+suffix+" "+"fastq:"+lib.reads.path+" " } } } return opt } EOF ########################################## #########################>DEBUG ########################################## ##Sequence files from libraries read -d '' ZZDEBUG << EOF ${ //var opt="inputs.libraries_metadata.length:"+inputs.libraries_metadata.length+" " //var str = JSON.stringify(inputs.libraries_metadata) var opt="" var lib_prefix = {} var lib_meta=inputs.libraries_metadata if (lib_meta!=null){ opt+=" not null " for(var j=0; j<lib_meta.length;j++){ var prefix="" var lmeta=lib_meta[j] opt+=" !!-AA-"+lmeta.lib_index+"-"+lmeta.orientation+" " } } var libraries = [] if(inputs.libraries_fwd_rev!=null){ for (var i = 0; i < inputs.libraries_fwd_rev.length ; i++) { var lib=inputs.libraries_fwd_rev[i] lib.file_type="separate" libraries[i] = lib } } if(inputs.libraries_mono!=null){ for (var i = 0; i < inputs.libraries_mono.length ; i++) { var ei= libraries.length libraries[ei] = inputs.libraries_mono[i] } } for(var j=0; j<libraries.length;j++){ var lib=libraries[j] var idx=lib.lib_index var prefix=lib_prefix[idx] if(lib.file_type!=null){ if ( lib.file_type == "separate"){ opt+=" --"+prefix+idx+"-1 "+"fastq:"+lib.fwd_reads.path+" " opt+=" --"+prefix+idx+"-2 "+"fastq:"+lib.rev_reads.path+" " }else{ var suffix if ( lib.file_type == "interleaved"){ suffix="12" } if ( lib.file_type == "merged"){ suffix="m" } if ( lib.file_type == "unpaired"){ suffix="s" } opt+=" --"+prefix+idx+"-"+suffix+" "+"fastq:"+lib.reads.path+" " } } } return opt } EOF ########################################## #########################<DEBUG read -d '' CMD_READ2 << EOF ${ var opt="" if (inputs.pacbio_reads!=null){ for(var i=0; i<inputs.pacbio_reads.length;i++){ var read=inputs.pacbio_reads[i] opt+=" --pacbio fastq:"+read.path+" " } } if (inputs.nanopore_reads!=null){ for(var i=0; i<inputs.nanopore_reads.length;i++){ var read=inputs.nanopore_reads[i] opt+=" --nanopore fastq:"+read.path+" " } } if (inputs.sanger_reads!=null){ for(var i=0; i<inputs.sanger_reads.length;i++){ var read=inputs.sanger_reads[i] opt+=" --sanger fastq:"+read.path+" " } } if (inputs.trusted_contigs!=null){ for(var i=0; i<inputs.trusted_contigs.length;i++){ var read=inputs.trusted_contigs[i] opt+=" --trusted-contigs fastq:"+read.path+" " } } if (inputs.untrusted_contigs!=null){ for(var i=0; i<inputs.untrusted_contigs.length;i++){ var read=inputs.untrusted_contigs[i] opt+=" --untrusted-contigs fastq:"+read.path+" " } } return opt } EOF ########################################## read -d '' CMD_POST << EOF && python write_tsv.py < contigs.fasta > out_contig_stats.tab && python write_tsv.py < scaffolds.fasta > out_scaffold_stats.tab EOF ########################################## # echo "CMD_BASE : \$CMD_BASE" > zz.txt \\ # && echo "CMD_READ1 : \$CMD_READ1" >> zz.txt \\ # && echo "CMD_READ2 : \$CMD_READ2" >> zz.txt \\ # && echo "CMD_POST : \$CMD_POST" >> zz.txt COMMAND="\$CMD_BASE \$CMD_READ1 \$CMD_READ2 \$CMD_POST" COMMAND=\$(echo $COMMAND|tr -d '\\n') echo "\$COMMAND" > run_spades.sh bash ./run_spades.sh |
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | - entryname: unicycler_launch.sh entry: | #!/bin/bash ########################### # unicycler launcher ########################### ##preparing input files #check permission / chmod is issues ${ var fl="" var lncmd="" var fq1="" var fq2="" var lr="" //###################paired case if (inputs.fastq_file_type =="paired" ){ if( inputs.fastq1_type=='fastqsanger' ){ fq1 = "fq1.fastq" } else if( inputs.fastq1_type=='fastqsanger.gz' ){ fq1 = "fq1.fastq.gz" } if( inputs.fastq2_type=='fastqsanger' ){ fq2 = "fq2.fastq" } else if( inputs.fastq2_type=='fastqsanger.gz' ){ fq2 = "fq2.fastq.gz" } lncmd+="fq1='"+fq1+"'" lncmd+=" && " lncmd+="fq2='"+fq2+"'" lncmd+=" && " lncmd+=" ln -s '"+inputs.fastq1.path+"' $fq1 " lncmd+=" && " lncmd+=" ln -s '"+inputs.fastq2.path+"' $fq2 " } //###################single case if (inputs.fastq_file_type =="single" ){ if( inputs.fastq1_type=='fastqsanger' ){ fq1 = "fq1.fastq" } else if( inputs.fastq1_type=='fastqsanger.gz' ){ fq1 = "fq1.fastq.gz" } lncmd+="fq1='"+fq1+"'" lncmd+=" && " lncmd+=" ln -s '"+inputs.fastq1.path+"' $fq1 " } //####### long reads if ( inputs.sequence_long !== null) { if (inputs.sequence_long_type=='fastqsanger'){ lr = "lr.fastq" } else if (inputs.sequence_long_type=='fastqsanger.gz') { lr = "lr.fastq.gz" } else if (inputs.sequence_longg_type=='fasta') { lr = "lr.fasta" } lncmd+="lr='"+lr+"'" lncmd+=" && " lncmd+= " ln -s '"+inputs.sequence_long.path+"' '$lr' " } return lncmd } ##general options read -d '' GENERALOPT << EOF ${ var opt="" //## General Unicycler Options section opt+=" --mode "+inputs.mode+" " opt+=" --min_fasta_length "+inputs.min_fasta_length+" " opt+=" --linear_seqs "+inputs.linear_seqs+" " if (inputs.min_anchor_seg_len != null ){opt+=" --min_anchor_seg_len "+inputs.min_anchor_seg_len+" "} //## Spades Options section if(inputs.spades_no_correct==true){opt+=" --no_correct "} opt+=" --min_kmer_frac "+inputs.spades_min_kmer_frac+" " opt+=" --max_kmer_frac "+inputs.spades_max_kmer_frac+" " if (inputs.spades_kmers != null){opt+=" --kmers "+inputs.spades_kmers+" "} opt+=" --kmer_count "+inputs.spades_kmer_count+" " opt+=" --depth_filter "+inputs.spades_depth_filter+" " if (inputs.spades_largest_component){opt+=" --largest_component "} //## Rotation Options section if(inputs.rotation_no_rotate == true){ opt+=" --no_rotate "} if (inputs.rotation_start_genes!=null){opt+=" --start_genes "+ inputs.rotation_start_genes.path+ " "} opt+=" --start_gene_id "+inputs.rotation_start_gene_id+" " opt+=" --start_gene_cov "+inputs.rotation_start_gene_cov+" " return opt } EOF ##additionnal option read -d '' ADDOPT << EOF ${ var opt="" if (inputs.pilon_no_pilon == true){ opt+=" --no_pilon " } if (inputs.pilon_min_polish_size != null){opt+=" --min_polish_size "+inputs.pilon_min_polish_size + " "} //## Long Read Alignment Options if ( inputs.lr_align_contamination!=null){opt+=" --contamination "+inputs.lr_align_contamination + " "} opt+=" --scores "+inputs.lr_align_scores+" " if (inputs.lr_align_low_score != null){opt+=" --low_score "+inputs.lr_align_low_score+" "} return ''+ opt + '' } EOF ## Get location for pilon jar file ${ var cmd="" cmd+="PILONJAR=/usr/share/java/pilon.jar " return cmd } ## Build Unicycler command ${ var cmd_base="" var opt="" cmd_base+=" unicycler -t "+inputs.compute_slots+" " cmd_base+=" -o ./ " cmd_base+=" --verbosity 3 " cmd_base+=" --pilon_path \$PILONJAR " if ( inputs.fastq_file_type == "paired"){ opt+=" -1 $fq1 -2 $fq2 " } else if ( inputs.fastq_file_type == "paired_collection"){ opt+=" -1 $fq1 -2 $fq2 " } else if ( inputs.fastq_file_type == "single"){ opt+=" -s $fq1 " } if ( inputs.sequence_long !== null) { opt+=" -l $lr " } //## Unicycler command var cmdl=cmd_base+" "+opt+" \$GENERALOPT \$ADDOPT " return cmdl } |
362 363 364 365 366 367 368 369 | baseCommand: bash arguments: - unicycler_launch.sh hints: DockerRequirement: dockerPull: biocontainers/unicycler:v0.4.7dfsg-2-deb_cv1 |
Support
Do you know this workflow well? If so, you can
request seller status , and start supporting this workflow.
Created: 1yr ago
Updated: 1yr ago
Maitainers:
public
URL:
https://github.com/fjrmoreews/cwl-workflow-SARS-CoV-2/blob/master/Assembly/workflow/assembly-wf-virus.cwl
Name:
cwl-workflow-sars-cov-2
Version:
Version 1
Downloaded:
0
Copyright:
Public Domain
License:
MIT License
- Future updates
Related Workflows
ENCODE pipeline for histone marks developed for the psychENCODE project
psychip pipeline is an improved version of the ENCODE pipeline for histone marks developed for the psychENCODE project.
The o...
Near-real time tracking of SARS-CoV-2 in Connecticut
Repository containing scripts to perform near-real time tracking of SARS-CoV-2 in Connecticut using genomic data. This pipeli...
snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...
ATLAS - Three commands to start analyzing your metagenome data
Metagenome-atlas is a easy-to-use metagenomic pipeline based on snakemake. It handles all steps from QC, Assembly, Binning, t...
raw sequence reads
Genome assembly
Annotation track
checkm2
gunc
prodigal
snakemake-wrapper-utils
MEGAHIT
Atlas
BBMap
Biopython
BioRuby
Bwa-mem2
cd-hit
CheckM
DAS
Diamond
eggNOG-mapper v2
MetaBAT 2
Minimap2
MMseqs
MultiQC
Pandas
Picard
pyfastx
SAMtools
SemiBin
Snakemake
SPAdes
SqueezeMeta
TADpole
VAMB
CONCOCT
ete3
gtdbtk
h5py
networkx
numpy
plotly
psutil
utils
metagenomics
RNA-seq workflow using STAR and DESeq2
This workflow performs a differential gene expression analysis with STAR and Deseq2. The usage of this workflow is described ...
This Snakemake pipeline implements the GATK best-practices workflow
This Snakemake pipeline implements the GATK best-practices workflow for calling small germline variants. The usage of thi...