#!/usr/bin/env cwl-runner

cwl:tool: rhapsody

# This is a template YML file used to specify the inputs for a BD Rhapsody Sequence Analysis pipeline run.
# See the BD Rhapsody Sequence Analysis Pipeline User Guide for more details. Enter the following information:


## Reads (optional) - Path to your FASTQ.GZ formatted read files from libraries that may include:
#   - WTA mRNA
#   - Targeted mRNA
#   - AbSeq
#   - Sample Multiplexing
#   - VDJ
# You may specify as many R1/R2 read pairs as you want.
Reads:

 - class: File
   location: "test/WTALibrary_S1_L001_R1_001.fastq.gz"

 - class: File
   location: "test/WTALibrary_S1_L001_R2_001.fastq.gz"

## Reads_ATAC (optional) - Path to your FASTQ.GZ formatted read files from ATAC-Seq libraries.
## You may specify as many R1/R2/I2 files as you want.
Reads_ATAC:

 - class: File
   location: "test/ATACLibrary_S2_L001_R1_001.fastq.gz"

 - class: File
   location: "test/ATACLibrary_S2_L001_R2_001.fastq.gz"

 - class: File
   location: "test/ATACLibrary_S2_L001_I2_001.fastq.gz"


## Assay type will be inferred from the provided reference(s)
## Do not provide both Reference_Archive and Targeted_Reference at the same time
##
## Valid reference input combinations:
##   WTA Reference_Archive                                              (WTA only)
##   WTA Reference_Archive + AbSeq_Reference                            (WTA + AbSeq)
##   WTA Reference_Archive + Supplemental_Reference                     (WTA + extra transgenes)
##   WTA Reference_Archive + AbSeq_Reference + Supplemental_Reference   (WTA + AbSeq + extra transgenes)
##   WTA+ATAC-Seq Reference_Archive                                     (WTA + ATAC, ATAC only)
##   WTA+ATAC-Seq Reference_Archive + Supplemental_Reference            (WTA + ATAC + extra transgenes)
##   Targeted_Reference                                                 (Targeted only)
##   Targeted_Reference + AbSeq_Reference                               (Targeted + AbSeq)
##   AbSeq_Reference                                                    (AbSeq only)

## See the BD Rhapsody Sequence Analysis Pipeline User Guide for instructions on how to:
##    - Obtain a pre-built Rhapsody Reference file
##    - Create a custom Rhapsody Reference file

## WTA Reference_Archive (required for WTA mRNA assay) - Path to Rhapsody WTA Reference in the tar.gz format.
##
##   --Structure of reference archive--
##   BD_Rhapsody_Reference_Files/ # top level folder
##       star_index/ # sub-folder containing STAR index
##           [files created with STAR --runMode genomeGenerate]
##       [GTF for gene-transcript-annotation e.g. "gencode.v43.primary_assembly.annotation.gtf"]
##
## WTA+ATAC-Seq Reference_Archive (required for ATAC-Seq or Multiomic ATAC-Seq (WTA+ATAC-Seq) assays) - Path to Rhapsody WTA+ATAC-Seq Reference in the tar.gz format.
##
##   --Structure of reference archive--
##   BD_Rhapsody_Reference_Files/ # top level folder
##       star_index/ # sub-folder containing STAR index
##           [files created with STAR --runMode genomeGenerate]
##       [GTF for gene-transcript-annotation e.g. "gencode.v43.primary_assembly.annotation.gtf"]
##
##       mitochondrial_contigs.txt # mitochondrial contigs in the reference genome - one contig name per line. e.g. chrMT or chrM, etc.
##
##       bwa-mem2_index/ # sub-folder containing bwa-mem2 index
##          [files created with bwa-mem2 index]
##
Reference_Archive:
  class: File
  location: "test/RhapRef_Human_WTA_2023-02.tar.gz"
# location: "test/RhapRef_Human_WTA-ATAC_2023-08.tar.gz"

## Targeted_Reference (required for Targeted mRNA assay) - Path to the targeted reference file in FASTA format.
#Targeted_Reference:
# - class: File
#   location: "test/BD_Rhapsody_Immune_Response_Panel_Hs.fasta"

## AbSeq_Reference (optional) - Path to the AbSeq reference file in FASTA format.  Only needed if BD AbSeq Ab-Oligos are used.
## For putative cell calling using an AbSeq dataset, please provide an AbSeq reference fasta file as the AbSeq_Reference.
#AbSeq_Reference:
# - class: File
#   location: "test/AbSeq_reference.fasta"

## Supplemental_Reference (optional) - Path to the supplemental reference file in FASTA format.  Only needed if there are additional transgene sequences to be aligned against in a WTA assay experiment
#Supplemental_Reference:
# - class: File
#   location: "test/supplemental_reference.fasta"

####################################
## Putative Cell Calling Settings ##
####################################

## Putative cell calling dataset (optional) - Specify the dataset to be used for putative cell calling: mRNA, AbSeq, ATAC, mRNA_and_ATAC
## For putative cell calling using an AbSeq dataset, please provide an AbSeq_Reference fasta file above.
## For putative cell calling using an ATAC dataset, please provide a WTA+ATAC-Seq Reference_Archive file above.
## The default data for putative cell calling, will be determined the following way:
## If mRNA Reads and ATAC Reads exist:
##    Cell_Calling_Data: mRNA_and_ATAC
## If only ATAC Reads exist:
##    Cell_Calling_Data: ATAC
## Otherwise:
##    Cell_Calling_Data: mRNA
#Cell_Calling_Data: mRNA

## Putative cell calling bioproduct algorithm (optional) - Specify the bioproduct algorithm to be used for putative cell calling: Basic or Refined
## By default, the Basic algorithm will be used for putative cell calling.
#Cell_Calling_Bioproduct_Algorithm: Basic

## Putative cell calling ATAC algorithm (optional) - Specify the ATAC-seq algorithm to be used for putative cell calling: Basic or Refined
## By default, the Basic algorithm will be used for putative cell calling.
#Cell_Calling_ATAC_Algorithm: Basic

## Exact cell count (optional) - Set a specific number (>=1) of cells as putative, based on those with the highest error-corrected read count
#Exact_Cell_Count: 10000

## Expected Cell Count (optional) - Guide the basic putative cell calling algorithm by providing an estimate of the number of cells expected.  Usually this can be the number of cells loaded into the Rhapsody cartridge.  If there are multiple inflection points on the second derivative cumulative curve, this will ensure the one selected is near the expected. 
#Expected_Cell_Count: 20000


####################################
## Intronic Reads Settings ##
####################################

## Exclude_Intronic_Reads (optional)
## By default, the flag is false, and reads aligned to exons and introns are considered and represented in molecule counts. When the flag is set to true, intronic reads will be excluded.
## The value can be true or false.
#Exclude_Intronic_Reads: true

#######################
## Multiplex options ##
#######################

## Sample Tags Version (optional) - If Sample Tag Multiplexing was done, specify the appropriate version: human, mouse, flex, nuclei_includes_mrna, nuclei_atac_only
## If this is an SMK + Nuclei mRNA run or an SMK + Multiomic ATAC-Seq (WTA+ATAC-Seq) run (and not an SMK + ATAC-Seq only run), choose the "nuclei_includes_mrna" option.
## If this is an SMK + ATAC-Seq only run (and not SMK + Multiomic ATAC-Seq (WTA+ATAC-Seq)), choose the "nuclei_atac_only" option.
#Sample_Tags_Version: human

## Tag_Names (optional) - Specify the tag number followed by '-' and the desired sample name to appear in Sample_Tag_Metrics.csv
# Do not use the special characters: &, (), [], {},  <>, ?, |
#Tag_Names: [4-mySample, 9-myOtherSample, 6-alsoThisSample]

################
## VDJ option ##
################

## VDJ Version (optional) - If VDJ was done, specify the appropriate option: human, mouse, humanBCR, humanTCR, mouseBCR, mouseTCR
#VDJ_Version: human

##################
## ATAC options ##
##################

## Predefined ATAC Peaks - An optional BED file containing pre-established chromatin accessibility peak regions for generating the ATAC cell-by-peak matrix.
#Predefined_ATAC_Peaks:
#  class: File
#  location: "path/predefined_peaks.bed"

########################
## Additional Options ##
########################

## Run Name (optional)-  Specify a run name to use as the output file base name. Use only letters, numbers, or hyphens. Do not use special characters or spaces.
#Run_Name: my-experiment

## Generate Bam (optional, default: false) - Specify whether to create the BAM file output
#Generate_Bam: true

## Maximum_Threads (integer, optional, default: [use all cores of CPU]) - Set the maximum number of threads to use in the read processing steps of the pipeline:  QualCLAlign, AlignmentAnalysis, VDJ assembly
#Maximum_Threads: 16

## Use STARlong (optional, default: "auto" - i.e. autodetects based on read lengths) - Specify if the STARlong aligner should be used instead of STAR. Set to true if the reads are longer than 650bp.
## The value can be true or false.
#Long_Reads: true

########################
## Advanced Options   ##
########################
## NOTE: Only change these if you are really sure about what you are doing

## Modify STAR alignment parameters - Set this parameter to fully override default STAR mapping parameters used in the pipeline.
## For reference this is the default that is used:
##   Short Reads: --outFilterScoreMinOverLread 0 --outFilterMatchNminOverLread 0 --outFilterMultimapScoreRange 0 --clip3pAdapterSeq AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --seedSearchStartLmax 50 --outFilterMatchNmin 25 --limitOutSJcollapsed 2000000
##   Long Reads: Same as Short Reads + --seedPerReadNmax 10000
## This applies to fastqs provided in the Reads user input 
## Do NOT set any non-mapping related params like --genomeDir, --outSAMtype, --outSAMunmapped, --readFilesIn, --runThreadN, etc.
## We use STAR version 2.7.10b
#Custom_STAR_Params: --alignIntronMax 6000 --outFilterScoreMinOverLread 0.1 --limitOutSJcollapsed 2000000

## Modify bwa-mem2 alignment parameters - Set this parameter to fully override bwa-mem2 mapping parameters used in the pipeline
## The pipeline does not specify any custom mapping params to bwa-mem2 so program default values are used
## This applies to fastqs provided in the Reads_ATAC user input 
## Do NOT set any non-mapping related params like -C, -t, etc.
## We use bwa-mem2 version 2.2.1
#Custom_bwa_mem2_Params: -k 16 -w 200 -r
