Just simple methods to keep the code clean.
Inspired by progrium/bashstyle and Kfir Lavi post.
- All code goes in a function
- Always double quote variables
Just simple methods to keep the code clean.
Inspired by progrium/bashstyle and Kfir Lavi post.
| #!/usr/bin/env Rscript | |
| #PBS -V | |
| # This script will call copy number variants using cn.mops | |
| # usage: Rscript cn.mops.R --help | |
| library(optparse) | |
| option_list = list( | |
| make_option(c("-i", "--input_dir"), type="character", default=NULL, |
The set lines
set -euxo pipefail is short for:set -e
set -u
| #!/bin/bash | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: $0 <input_gtf_file>" | |
| exit 1 | |
| fi | |
| input_gtf="$1" | |
| output_prefix="output" | |
| sorted_gtf="${output_prefix}.sorted.gtf" |
| #! /bin/bash | |
| ## See also https://github.com/nextflow-io/nextflow/discussions/4308 | |
| ## cd to a parent directory for a Nextflow pipeline executation, i.e. contains .nextflow and work directories | |
| WORKDIR=$1 | |
| ## Find work directories essential to the last pipeline run, as absolute paths | |
| nextflow log last > $WORKDIR/preserve_dirs.txt | |
| ## Find all work directories, as absolute paths |
| #!/usr/bin/env bash | |
| # usage function | |
| function usage() | |
| { | |
| cat << HEREDOC | |
| Usage: $progname [--threads NUM] [--con NUM] [--db STR] [--outdir STR] [--remove STR] [--verbose] [--list] [--extract] | |
| optional arguments: |