diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..19a2b26 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +apps/cellranger/0.1/common/test/* diff --git a/apps/cellranger/0.1/common/cellranger_common.sh b/apps/cellranger/0.1/common/cellranger_common.sh new file mode 100644 index 0000000..f6a4fc3 --- /dev/null +++ b/apps/cellranger/0.1/common/cellranger_common.sh @@ -0,0 +1,121 @@ +# +# Toy common functions +# +# This script relies upon global variables +# source toy_common.sh +# +# Author: Scott Christley +# Date: Aug 17, 2020 +# + +# required global variables: +# PYTHON +# AGAVE_JOB_ID +# and... +# The agave app input and parameters + +# the app +export APP_NAME=cellranger + +# ---------------------------------------------------------------------------- +function expandfile () { + fileBasename="${1%.*}" # file.txt.gz -> file.txt + fileExtension="${1##*.}" # file.txt.gz -> gz + + if [ ! -f $1 ]; then + echo "Could not find input file $1" 1>&2 + exit 1 + fi + + if [ "$fileExtension" == "gz" ]; then + gunzip $1 + export file=$fileBasename + # don't archive the intermediate file + elif [ "$fileExtension" == "bz2" ]; then + bunzip2 $1 + export file=$fileBasename + elif [ "$fileExtension" == "zip" ]; then + unzip -o $1 + export file=$fileBasename + else + export file=$1 + fi +} + +# prevent Agave from archiving the file +function noArchive() { + echo $1 >> .agave.archive +} + +# ---------------------------------------------------------------------------- +# Analysis provenance +function initProvenance() { + # nothing yet + echo "initProvenance" +} + +# ---------------------------------------------------------------------------- +# Toy workflow + +function print_versions() { + echo "VERSIONS:" + #echo " $(DefineClones.py --version 2>&1)" + singularity exec ${singularity_image} cellranger --version + echo -e "\nSTART at $(date)" +} + +function print_parameters() { + echo "Input files:" + echo "singularity_image=${singularity_image}" + echo "input_file=${input_file}" + echo "input_file=${input_csv}" + echo "" + echo "Application parameters:" + echo "single_flag=${single_flag}" + echo "optional_number=${optional_number}" + echo "optional_enum=${optional_enum}" +} + +function run_cellranger_workflow() { + initProvenance + + fileBasename=${input_file##*/} + # launcher job file + if [ -f joblist ]; then + echo "Warning: removing file 'joblist'. That filename is reserved." 1>&2 + rm joblist + touch joblist + fi + noArchive "joblist" + + singularity exec cellranger4-bcl.sif cellranger mkfastq --id=tutorial_walk_through \ + --run=${fileBasename%.tar.gz} \ + --csv=${input_csv} + + #ARGS="--format airr --act set --model ham --sym min --norm len --dist 0.165" + #if [ -n "$define_clones_mode" ]; then + # ARGS="$ARGS --mode $define_clones_mode" + #fi + #if [ -n "$define_clones_nproc" ]; then + # ARGS="$ARGS --nproc $define_clones_nproc" + #fi + + # Define Clones + #if [[ $define_clones -eq 1 ]]; then + # echo "DefineClones.py -d ${filename} -o ${fileOutname} $ARGS" >> joblist + #fi + + + # check number of jobs to be run + numJobs=$(cat joblist | wc -l) + export LAUNCHER_PPN=$LAUNCHER_LOW_PPN + if [ $numJobs -lt $LAUNCHER_PPN ]; then + export LAUNCHER_PPN=$numJobs + fi + + # run launcher + #$LAUNCHER_DIR/paramrun + + ls -l + +} diff --git a/apps/cellranger/0.1/ls5/cellranger.json b/apps/cellranger/0.1/ls5/cellranger.json new file mode 100644 index 0000000..7385520 --- /dev/null +++ b/apps/cellranger/0.1/ls5/cellranger.json @@ -0,0 +1,185 @@ +{ + "name": "irplus-cellranger-ls5-franasa", + "version": "0.1", + "label": "cellranger", + "defaultQueue": "normal", + "defaultNodeCount": 1, + "defaultProcessorsPerNode": 40, + "defaultRequestedTime": "1:00:00", + "shortDescription": "cellranger 4.0 on Lonestar5", + "longDescription": "iReceptor+ cellranger app", + "executionType": "HPC", + "executionSystem": "irplus-ls5.tacc.utexas.edu", + "parallelism": "PARALLEL", + "checkpointable": false, + "deploymentPath": "/irplus/apps/cellranger/franasa/ls5/", + "deploymentSystem": "data.vdjserver.org", + "templatePath": "cellranger.sh", + "testPath": "test/test.sh", + "ontology": [ + "http://sswapmeet.sswap.info/agave/apps/Application" + ], + "modules": [ + "purge", + "load TACC" + ], + "inputs": [ + { + "id": "singularity_image", + "details": { + "label": "", + "description": "Singularity image file", + "showAttribute": false + }, + "semantics": { + "minCardinality": 1, + "maxCardinality": 1, + "ontology": [ + "http://sswapmeet.sswap.info/mime/application/Json" + ], + "fileTypes": [ + "text-0" + ] + }, + "value": { + "default": "", + "visible": true, + "required": true + } + }, + { + "id": "input_file", + "details": { + "label": "", + "description": "Test file cellranger-tiny-bcl-1.2.0.tar.gz", + "showAttribute": false + }, + "semantics": { + "minCardinality": 1, + "maxCardinality": 1, + "ontology": [ + "http://sswapmeet.sswap.info/mime/application/Json" + ], + "fileTypes": [ + "text-0" + ] + }, + "value": { + "default": "", + "visible": true, + "required": true + } + + }, + { + "id": "input_csv", + "details": { + "label": "", + "description": "csv file cellranger-tiny-bcl-simple-1.2.0.csv", + "showAttribute": false + }, + "semantics": { + "minCardinality": 1, + "maxCardinality": 1, + "ontology": [ + "http://sswapmeet.sswap.info/mime/application/Json" + ], + "fileTypes": [ + "text-0" + ] + }, + "value": { + "default": "", + "visible": true, + "required": true + } + } + ], + "parameters": [ + { + "id": "creator", + "value": { + "visible": true, + "required": true, + "type": "string", + "default": "" + }, + "details": { + "label": "Creator", + "description": "Username that created this job." + }, + "semantics": { + "minCardinality": 1, + "maxCardinality": 1, + "ontology": [ + "xsd:string" + ] + } + }, + { + "id": "single_flag", + "value": { + "visible": true, + "required": true, + "type": "bool", + "order": 0, + "enquote": false, + "default": false, + "validator": null + }, + "details": { + "label": "", + "description": "Boolean flag parameter", + "argument": null, + "showArgument": false, + "repeatArgument": false + }, + "semantics": { + "minCardinality": 1, + "maxCardinality": 1, + "ontology": [ + "xsd:boolean" + ] + } + }, + { + "id": "optional_number", + "value": { + "visible": true, + "required": false, + "type": "number" + }, + "details": { + "label": "", + "description": "Optional number parameter" + }, + "semantics": { + "minCardinality": 0, + "maxCardinality": 1, + "ontology": [ + "xsd:integer" + ] + } + }, + { + "id": "optional_enum", + "value": { + "visible": true, + "required": false, + "type": "enumeration", + "enumValues": [ "allele", "gene" ] + }, + "details": { + "label": "", + "description": "Optional enum parameter" + }, + "semantics": { + "minCardinality": 0, + "maxCardinality": 1, + "ontology": [ + "xsd:string" + ] + } + } + ] +} diff --git a/apps/cellranger/0.1/ls5/cellranger.sh b/apps/cellranger/0.1/ls5/cellranger.sh new file mode 100644 index 0000000..1b7413d --- /dev/null +++ b/apps/cellranger/0.1/ls5/cellranger.sh @@ -0,0 +1,72 @@ +# +# wrapper script +# for Lonestar5 +# + +# Configuration settings + +# These get set by Tapis + +# input files +singularity_image="${singularity_image}" +input_file="${input_file}" +input_csv="${input_csv}" + +# application parameters +single_flag=${single_flag} +optional_number="${optional_number}" +optional_enum="${optional_enum}" + +# Agave info +AGAVE_JOB_ID=${AGAVE_JOB_ID} +AGAVE_JOB_NAME=${AGAVE_JOB_NAME} +AGAVE_LOG_NAME=${AGAVE_JOB_NAME}-${AGAVE_JOB_ID} + +# ---------------------------------------------------------------------------- +# unpack tiny test folder +tar -zxvf ${input_file} +#cellranger-tiny-bcl-1.2.0.tar.gz + + +# modules +module load python3 +module load launcher/3.4 +module load tacc-singularity + +PYTHON=python3 + +export PATH="$PWD/bin:${PATH}" +export PYTHONPATH=$PWD/lib/python3.7/site-packages:$PYTHONPATH + +# bring in common functions +source ./cellranger_common.sh + +# ---------------------------------------------------------------------------- +# Launcher to use multicores on node +export LAUNCHER_WORKDIR=$PWD +export LAUNCHER_LOW_PPN=1 +export LAUNCHER_MID_PPN=8 +export LAUNCHER_MAX_PPN=25 +export LAUNCHER_PPN=1 +export LAUNCHER_JOB_FILE=joblist +export LAUNCHER_SCHED=interleaved + +# Start +printf "START at $(date)\n\n" + +# If you want to tell Tapis that the job failed +export JOB_ERROR=0 + +print_parameters +print_versions +run_cellranger_workflow + +# End +printf "DONE at $(date)\n\n" + +# remove binaries before archiving +rm -rf bin lib + +if [[ $JOB_ERROR -eq 1 ]]; then + ${AGAVE_JOB_CALLBACK_FAILURE} +fi diff --git a/apps/cellranger/0.1/ls5/test/test-cellranger.json b/apps/cellranger/0.1/ls5/test/test-cellranger.json new file mode 100644 index 0000000..4f7819e --- /dev/null +++ b/apps/cellranger/0.1/ls5/test/test-cellranger.json @@ -0,0 +1,18 @@ +{ + "name":"test_cellranger", + "appId": "irplus-cellranger-ls5-franasa-0.1", + "batchQueue": "normal", + "maxRunTime": "01:00:00", + "nodeCount": 1, + "archive": false, + "archiveSystem": "data.vdjserver.org", + "inputs": { + "singularity_image": "agave://data.vdjserver.org//irplus/images/cellranger4/cellranger4-bcl.sif", + "input_file": "agave://data.vdjserver.org//irplus/apps/cellranger/test_files/cellranger-tiny-bcl-1.2.0.tar.gz", + "input_csv": "agave://data.vdjserver.org//irplus/apps/cellranger/test_files/cellranger-tiny-bcl-simple-1.2.0.csv" + }, + "parameters": { + "creator": "franasa", + "single_flag": true + } +} diff --git a/apps/cellranger/0.1/ls5/test/test.sh b/apps/cellranger/0.1/ls5/test/test.sh new file mode 100644 index 0000000..e69de29 diff --git a/apps/cellranger/0.1/ls5/upload-bundle.sh b/apps/cellranger/0.1/ls5/upload-bundle.sh new file mode 100755 index 0000000..07d6040 --- /dev/null +++ b/apps/cellranger/0.1/ls5/upload-bundle.sh @@ -0,0 +1,37 @@ +# +TOOL=cellranger +SYSTEM=ls5 +#VER=0.1 +VER=franasa + +# Copy all of the object files to the bundle directory +# and create a binaries.tgz +# +# For example: +# cd bundle + +# tar zcvf binaries.tgz bin lib + +# delete old working area in tapis +tapis files delete agave:///irplus/apps/$TOOL/$VER/$SYSTEM + +# create directory structure +tapis files mkdir agave:///irplus/apps $TOOL +tapis files mkdir agave:///irplus/apps/$TOOL $VER +tapis files mkdir agave:///irplus/apps/$TOOL/$VER $SYSTEM +tapis files mkdir agave:///irplus/apps/$TOOL/$VER/$SYSTEM test + +# upload app assets +tapis files upload agave:///irplus/apps/$TOOL/$VER/$SYSTEM cellranger.sh +tapis files upload agave:///irplus/apps/$TOOL/$VER/$SYSTEM cellranger.json +tapis files upload agave:///irplus/apps/$TOOL/$VER/$SYSTEM ../common/cellranger_common.sh +tapis files list agave:///irplus/apps/$TOOL/$VER/$SYSTEM + +# upload test assets +tapis files upload agave:///irplus/apps/$TOOL/$VER/$SYSTEM/test test/test.sh +# tapis files upload agave:///irplus/apps/$TOOL/$VER/$SYSTEM/test ../common/test/IGH_SRR1383450.airr.tsv.gz +tapis files list agave:///irplus/apps/$TOOL/$VER/$SYSTEM/test + +#files-upload -F test/test.sh /irplus/apps/$TOOL/$VER/$SYSTEM/test +#files-upload -F test/test-clones.json /irplus/apps/$TOOL/$VER/$SYSTEM/test +#files-upload -F ../common/test/SRR1383450_2.igblast.airr.tsv.gz /irplus/apps/$TOOL/$VER/$SYSTEM/test