changeset 0:6e0b320d8b6a draft default tip

"planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
author gaelcge
date Tue, 02 Aug 2022 19:11:27 +0000
parents
children
files Dockerfile LICENSE Planemo_tool_creation_cmds.md README.txt Signac.R signac-LSI.R signac-add_gene_annotations.R signac-createAssayObject.R signac-createObject.R signac-dimplot.R signac-find_clusters.R signac-find_neighbours.R signac-geneactivity.R signac-runQC.R signac-subset.R signac-template.R signac-umap.R signac-vlnplot.R signac_LSI.xml signac_add_gene_annotations.xml signac_createAssayObject.xml signac_createObject.xml signac_dimplot.xml signac_find_clusters.xml signac_find_neighbours.xml signac_geneactivity.xml signac_macros.xml signac_runQC.xml signac_subset.xml signac_umap.xml signac_vlnplot.xml
diffstat 31 files changed, 2026 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Dockerfile	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,14 @@
+FROM condaforge/mambaforge:4.10.3-7
+
+COPY . .
+
+RUN mamba create -n signac
+
+RUN mamba install --yes -c conda-forge -c bioconda \
+    bats==0.4.0 \
+    r-optparse==1.7.1 \
+    libpng==1.6.37 \
+    r-cairo==1.5_12.2 \
+    r-hdf5r==1.3.5 \
+    r-workflowscriptscommon==0.0.7 \
+    r-signac==1.4.0
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Planemo_tool_creation_cmds.md	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,6 @@
+## CreateObject function
+planemo tool_init --force \
+  --id 'signac_createObject' \
+  --name 'Reads in output files from CellRanger-ATAC and creates a Seurat object containing a ChromatinAssay assay.'\
+  --example_command 'r-signac-createObject.R' \
+  --cite_url 'https://satijalab.org/signac/articles/pbmc_vignette.html'
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.txt	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,21 @@
+# Introduction
+This repository contains code for Galaxy wrappers for the r-signac package to analyze scATAC-seq data.
+
+!!! This package is currently in open development so check back recently to find new functions integrated. All functions will be available via the Galaxy test and main toolsheds once completed. !!!
+
+# Processing raw ATAC-seq data
+To process your raw scATAC-seq fastq files, you can use CellRanger-ATAC, either from the command line or you can use our CellRanger-ATAC galaxy tool, which you can find here:
+
+GenAP2 CellRanger-ATAC: https://github.com/Single-Cell-Academy/genap2_cellranger_ATAC
+
+# External sites
+Original Signac project: https://github.com/timoast/signac
+
+Signac vignettes for R: https://satijalab.org/signac/articles/pbmc_vignette.html
+
+# Additional information
+Due to the related nature of Seurat and Signac, the structure and organization of the Galaxy and R code in this repo is attempting to follow similar principles established by the EBI single-cell tools. 
+
+Some of the code for running Rscripts via the command line have been directly copied over from their repositories which can be found here:
+r-seurat-scripts: https://github.com/ebi-gene-expression-group/r-seurat-scripts/blob/develop/seurat-read.R
+Seurat galaxy wrappers: https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/tree/develop/tools/tertiary-analysis/seurat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Signac.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,170 @@
+rm(list = ls())
+
+library(Signac)
+library(Seurat)
+library(GenomeInfoDb)
+library(EnsDb.Hsapiens.v75)
+library(ggplot2)
+library(patchwork)
+
+library(future)
+plan("multicore", workers = (availableCores()-1))
+options(future.globals.maxSize = 3000000 * 1024^2)
+
+setwd("/home/gaelcge/projects/def-jsjoyal/gaelcge/scATACseq/10XData/atac_v1_pbmc_10k_output/")
+
+counts <- Read10X_h5(filename = "./atac_v1_pbmc_10k_filtered_peak_bc_matrix.h5")
+
+
+metadata <- read.csv(
+  file = "./atac_v1_pbmc_10k_singlecell.csv",
+  header = TRUE,
+  row.names = 1
+)
+
+metadata <- metadata[colnames(counts),]
+
+chrom_assay <- CreateChromatinAssay(
+  counts = counts,
+  sep = c(":", "-"),
+  genome = 'hg19',
+  fragments = './atac_v1_pbmc_10k_fragments.tsv.gz',
+  min.cells = 10,
+  min.features = 200
+)
+
+pbmc <- CreateSeuratObject(
+  counts = chrom_assay,
+  assay = "peaks",
+  meta.data = metadata
+)
+
+setwd("/home/gaelcge/projects/def-jsjoyal/gaelcge/scATACseq/Signac_analysis/atac_pbmc_500_nextgem")
+
+pbmc[['peaks']]
+
+granges(pbmc)
+
+# extract gene annotations from EnsDb
+annotations <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v75)
+
+# change to UCSC style since the data was mapped to GRCh38
+seqlevelsStyle(annotations) <- 'UCSC'
+genome(annotations) <- "GRCh38"
+
+# add the gene information to the object
+Annotation(pbmc) <- annotations
+
+
+# compute nucleosome signal score per cell
+pbmc <- NucleosomeSignal(object = pbmc)
+
+# compute TSS enrichment score per cell
+pbmc <- TSSEnrichment(object = pbmc, fast = FALSE)
+
+# add blacklist ratio and fraction of reads in peaks
+pbmc$pct_reads_in_peaks <- pbmc$peak_region_fragments / pbmc$passed_filters * 100
+pbmc$blacklist_ratio <- pbmc$blacklist_region_fragments / pbmc$peak_region_fragments
+
+
+
+pbmc$high.tss <- ifelse(pbmc$TSS.enrichment > 2, 'High', 'Low')
+
+png("Tssplot.png")
+TSSPlot(pbmc, group.by = 'high.tss') + NoLegend()
+dev.off()
+
+
+
+pbmc$nucleosome_group <- ifelse(pbmc$nucleosome_signal > 4, 'NS > 4', 'NS < 4')
+png("FragmentHistogram.png")
+FragmentHistogram(object = pbmc, group.by = 'nucleosome_group')
+dev.off()
+
+png("VlnPlot_QC.png", width=1000)
+VlnPlot(
+  object = pbmc,
+  features = c('pct_reads_in_peaks', 'peak_region_fragments',
+               'TSS.enrichment', 'blacklist_ratio', 'nucleosome_signal'),
+  pt.size = 0.1,
+  ncol = 5
+)
+dev.off()
+
+
+pbmc <- subset(
+  x = pbmc,
+  subset = peak_region_fragments > 3000 &
+    peak_region_fragments < 20000 &
+    pct_reads_in_peaks > 15 &
+    blacklist_ratio < 0.05 &
+    nucleosome_signal < 2 &
+    TSS.enrichment > 1
+)
+pbmc
+
+
+pbmc <- RunTFIDF(pbmc)
+pbmc <- FindTopFeatures(pbmc, min.cutoff = 'q0')
+pbmc <- RunSVD(pbmc)
+
+png("DepthCor.png")
+DepthCor(pbmc)
+dev.off()
+
+pbmc <- RunUMAP(object = pbmc, reduction = 'lsi', dims = 2:30)
+pbmc <- FindNeighbors(object = pbmc, reduction = 'lsi', dims = 2:30)
+pbmc <- FindClusters(object = pbmc, verbose = FALSE, algorithm = 3)
+
+
+png("UMAP.png")
+DimPlot(object = pbmc, label = TRUE) + NoLegend()
+dev.off()
+
+
+gene.activities <- GeneActivity(pbmc)
+
+
+# add the gene activity matrix to the Seurat object as a new assay and normalize it
+pbmc[['RNA']] <- CreateAssayObject(counts = gene.activities)
+pbmc <- NormalizeData(
+  object = pbmc,
+  assay = 'RNA',
+  normalization.method = 'LogNormalize',
+  scale.factor = median(pbmc$nCount_RNA)
+)
+
+
+DefaultAssay(pbmc) <- 'RNA'
+
+png("FeaturePlot_knownMarkers.png", width=1000)
+FeaturePlot(
+  object = pbmc,
+  features = c('MS4A1', 'CD3D', 'LEF1', 'NKG7', 'TREM1', 'LYZ'),
+  pt.size = 0.1,
+  max.cutoff = 'q95',
+  ncol = 3
+)
+dev.off()
+
+
+saveRDS(pbmc, paste("Seurat_object.rds", sep="."))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+q("no")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-LSI.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,78 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--min-cutoff"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--output-depthcor"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "TSS output plot."
+  ),
+  make_option(
+    c("-w", "--png-width"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Width of png (px)."
+  ),
+  make_option(
+    c("-j", "--png-height"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Height of png file (px)."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+
+signac_object <- RunTFIDF(signac_object)
+signac_object <- FindTopFeatures(signac_object, min.cutoff = opt$min_cutoff)
+signac_object <- RunSVD(signac_object)
+
+## Plot the Depth correlation plot
+png(filename = opt$output_depthcor, width = opt$png_width, height = opt$png_height)
+DepthCor(signac_object)
+dev.off()
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-add_gene_annotations.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,70 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Filtered peak BC matrix file in h5 format."
+  ),
+  make_option(
+    c("--ens-db-genome"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Metadata file."
+  ),
+  make_option(
+    c("--annotations"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Genome version."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+suppressPackageStartupMessages(require(GenomeInfoDb))
+suppressPackageStartupMessages(require(EnsDb.Hsapiens.v75))
+suppressPackageStartupMessages(require(EnsDb.Mmusculus.v79))
+
+set.seed(1234)
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+annotations <- GetGRangesFromEnsDb(ensdb = EnsDb.Hsapiens.v75)
+print(annotations)
+
+# change to UCSC style since the data was mapped to hg19
+seqlevelsStyle(annotations) <- "UCSC"
+genome(annotations) <- opt$annotations
+
+# add the gene information to the object
+Annotation(signac_object) <- annotations
+
+print(signac_object)
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-createAssayObject.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,98 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "A Seurat object."
+  ),
+  make_option(
+    c("--counts"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Counts Matrix."
+  ),
+  make_option(
+    c("--name"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Assay Name."
+  ),
+  make_option(
+    c("--min-cells"),
+    action = "store",
+    default = NA,
+    type = 'numeric',
+    help = "Min Cells."
+  ),
+  make_option(
+    c("--min-features"),
+    action = "store",
+    default = NA,
+    type = 'numeric',
+    help = "Min Features."
+  ),
+  make_option(
+    c("--method"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Method for normalization."
+  ),
+  make_option(
+    c("--scale-factor"),
+    action = "store",
+    default = 10000,
+    type = 'numeric',
+    help = "Sets the scale factor for cell-level normalization."
+  ),
+  make_option(
+    c("--margin"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "If performing CLR normalization, normalize across features (1) or cells (2)."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'numeric',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+if (! file.exists(opt$signac_object)){
+  stop((paste('File', opt$signac_object, 'does not exist')))
+}
+if (! file.exists(opt$counts)){
+  stop((paste('File', opt$counts, 'does not exist')))
+}
+
+signac_object <- readRDS(file = opt$signac_object)
+counts <- readRDS(opt$counts)
+
+signac_object[[opt$name]] <- CreateAssayObject(counts = counts)#, min.cells = opt$min_cells, min.features = opt$min_features)
+
+signac_object <- NormalizeData(object = signac_object, normalization.method = opt$method, scale.factor = opt$scale_factor, margin = opt$margin, assay = opt$name)
+
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-createObject.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,110 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--h5-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Filtered peak BC matrix file in h5 format."
+  ),
+  make_option(
+    c("--metadata"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Metadata file."
+  ),
+  make_option(
+    c("--genome"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Genome version."
+  ),
+    make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ),
+  make_option(
+    c("--fragment-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Fragment file from CellRanger-ATAC."
+  ),
+    make_option(
+    c("--min-cells"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Lower number of cells identified per peak."
+  ),
+    make_option(
+    c("--min-features"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Minimum number of features per cell to be retained."
+  )
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+atac_h5_matrix <- Read10X_h5(filename = opt$h5_file)
+print(paste("counts:",dim(atac_h5_matrix)))
+
+metadata <- read.csv(
+  file = opt$metadata,
+  header = TRUE,
+  row.names = 1
+)
+print(paste("metadata:",dim(metadata)))
+
+chrom_assay <- CreateChromatinAssay(
+  counts = atac_h5_matrix,
+  sep = c(":", "-"),
+  genome = opt$genome,
+  fragments = opt$fragment_file,
+  min.cells = as.numeric(opt$min_cells),
+  min.features = as.numeric(opt$min_features)
+)
+print(chrom_assay)
+
+#metadata <- subset(metadata,rownames(metadata) %in% colnames(chrom_assay))
+
+signac_object <- CreateSeuratObject(
+  counts = chrom_assay,
+  assay = "peaks",
+  meta.data = metadata
+)
+print(signac_object)
+print(signac_object[['peaks']])
+print(granges(signac_object))
+# cat(c(
+#   '# Object summary', 
+#   capture.output(print(signac_object)), 
+#   '\n# Metadata sample', 
+#   capture.output(head(signac_object@meta.data))
+# ), 
+# sep = '\n')
+
+# Output to a serialized R object
+
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-dimplot.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,96 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--dims"),
+    action = "store",
+    type = 'character',
+    help = "Dimension for x-axis (default 1)"
+  ),
+  make_option(
+    c("-p", "--pt-size"),
+    action = "store",
+    default = 1,
+    type = 'integer',
+    help = "Adjust point size for plotting"
+  ),
+  make_option(
+    c("-l", "--label-size"),
+    action = "store",
+    default = 4,
+    type = 'integer',
+    help = "Sets size of labels."
+  ),
+  make_option(
+    c("-d", "--do-label"),
+    action = "store",
+    default = FALSE,
+    type = 'logical',
+    help = "Whether to label the clusters."
+  ),
+  make_option(
+    c("--group-by"),
+    action = "store",
+    default = 'ident',
+    type = 'character',
+    help = "Group (color) cells in different ways (for example, orig.ident)."
+  ),
+  make_option(
+    c("--png-width"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Width of png (px)."
+  ),
+  make_option(
+    c("--png-height"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Height of png file (px)."
+  ),
+  make_option(
+    c("--output_image_file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+dims_use <- opt$dims
+if ( ! is.null(dims_use)){
+  dims_parsed <- wsc_parse_numeric(opt, 'dims')
+  dims_use <- seq(from = dims_parsed[1], to = dims_parsed[2])
+}
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+png(filename = opt$output_image_file, width = opt$png_width, height = opt$png_height)
+DimPlot(object = signac_object, dims = dims_use, pt.size = opt$pt_size, label.size = opt$label_size, group.by = opt$group_by) + NoLegend()
+dev.off()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-find_clusters.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,50 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--algorithm"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+signac_object <- FindClusters(object = signac_object, verbose = FALSE, algorithm = as.numeric(opt$algorithm))
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-find_neighbours.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,63 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--reduction-use"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--dims-use"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+dims_use <- opt$dims_use
+if ( ! is.null(dims_use)){
+  dims_parsed <- wsc_parse_numeric(opt, 'dims_use')
+  dims_use <- seq(from = dims_parsed[1], to = dims_parsed[2])
+}
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+signac_object <- FindNeighbors(object = signac_object, reduction = opt$reduction_use, dims = dims_use)
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-geneactivity.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,107 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "A Seurat object."
+  ),
+  make_option(
+    c("--fragment-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Fragments file."
+  ),
+  make_option(
+    c("--assay"),
+    action = "store",
+    default = NULL,
+    type = 'character',
+    help = "Assay."
+  ),
+  make_option(
+    c("--features"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Features."
+  ),
+  make_option(
+    c("--extend-upstream"),
+    action = "store",
+    default = NA,
+    type = 'numeric',
+    help = "Number of bases to extend upstream of the TSS."
+  ),
+  make_option(
+    c("--extend-downstream"),
+    action = "store",
+    default = NA,
+    type = 'numeric',
+    help = "Number of bases to extend downstream of the TSS."
+  ),
+  make_option(
+    c("--biotypes"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Gene biotypes to include. If NULL, use all biotypes in the gene annotation."
+  ),
+  make_option(
+    c("--max-width"),
+    action = "store",
+    default = NA,
+    type = 'numeric',
+    help = "Maximum allowed gene width for a gene to be quantified."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+if (! file.exists(opt$signac_object)){
+  stop((paste('File', opt$signac_object, 'does not exist')))
+}
+
+signac_object <- readRDS(file = opt$signac_object)
+
+signac_object@assays$peaks@fragments[[1]]@path <- opt$fragment_file
+
+# Check features
+features <- NULL
+if (! is.null(opt$features) && opt$features != 'NULL'){
+  if (file.exists(opt$features)){
+    features <- readLines(opt$features)
+  }
+}
+
+# Check assay
+assay <- NULL
+if (! is.null(opt$assay) && opt$assay != 'NULL'){
+  assay <- opt$assay
+}
+
+saveRDS(GeneActivity(object = signac_object, assay = assay, features = features, extend.upstream = opt$extend_upstream, extend.downstream = opt$extend_downstream, biotypes = opt$biotypes, max.width = opt$max_width), file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-runQC.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,120 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--tss-threshold"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "TSS enrichment threshold for marking regions as high tss regions."
+  ),
+  make_option(
+    c("--output-tss-plot"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "TSS output plot."
+  ),
+  make_option(
+    c("--frag-history-plot"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Fragment length periodicity plot."
+  ),
+  make_option(
+    c("--fragment-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "Fragment file."
+  ),
+  make_option(
+    c("-w", "--png-width"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Width of png (px)."
+  ),
+  make_option(
+    c("-j", "--png-height"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Height of png file (px)."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+suppressPackageStartupMessages(require(GenomeInfoDb))
+suppressPackageStartupMessages(require(EnsDb.Hsapiens.v75))
+suppressPackageStartupMessages(require(EnsDb.Mmusculus.v79))
+
+set.seed(1234)
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+## Modify fragments file location
+# current_wd <- getwd()
+# new_framgent_file_loc <- paste(current_wd,"fragments.tsv.gz",sep = "/")
+# signac_object@assays$peaks@fragments[[1]]@path <- new_framgent_file_loc
+# signac_object@assays$peaks@fragments[[1]]@path <- opt$fragment_file
+#print(normalizePath(path = paste0(opt$fragment_file, '.tbi'), mustWork = TRUE))
+#system(paste0("mv ", paste0(opt$fragment_file, '.tbi'), ' ', normalizePath(path = paste0(opt$fragment_file, '.tbi'), mustWork = TRUE)))
+# The error was that the fragment file and fragment index file were not being imported into galaxy properly. They should be imported as tabluar.gz
+signac_object@assays$peaks@fragments[[1]] <- UpdatePath(signac_object@assays$peaks@fragments[[1]], opt$fragment_file)
+
+# compute nucleosome signal score per cell
+signac_object <- NucleosomeSignal(object = signac_object)
+
+# compute TSS enrichment score per cell
+signac_object <- TSSEnrichment(object = signac_object, fast = FALSE)
+
+# add blacklist ratio and fraction of reads in peaks
+signac_object$pct_reads_in_peaks <- signac_object$peak_region_fragments / signac_object$passed_filters * 100
+signac_object$blacklist_ratio <- signac_object$blacklist_region_fragments / signac_object$peak_region_fragments
+
+signac_object$high.tss <- ifelse(signac_object$TSS.enrichment > as.numeric(opt$tss_threshold), 'High', 'Low')
+
+png(filename = opt$output_tss_plot, width = opt$png_width, height = opt$png_height)
+TSSPlot(signac_object, group.by = 'high.tss') + NoLegend()
+dev.off()
+
+signac_object$nucleosome_group <- ifelse(signac_object$nucleosome_signal > 4, 'NS > 4', 'NS < 4')
+
+png(filename = opt$frag_history_plot, width = opt$png_width, height = opt$png_height)
+FragmentHistogram(object = signac_object, group.by = 'nucleosome_group')
+dev.off()
+
+print(summary(signac_object@meta.data))
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-subset.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,104 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--peak-region-fragments-min"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--peak-region-fragments-max"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--pct-reads-in-peaks"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--blacklist-ratio"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--nucleosome-signal"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--tss-enrichment"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Signac))
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+
+## transform input parameters to numeric
+peak_region_fragments_min <- as.numeric(opt$peak_region_fragments_min)
+peak_region_fragments_max <- as.numeric(opt$peak_region_fragments_max)
+pct_reads_in_peaks_var <- as.numeric(opt$pct_reads_in_peaks)
+blacklist_ratio_var <- as.numeric(opt$blacklist_ratio)
+nucleosome_signal_var <- as.numeric(opt$nucleosome_signal)
+tss_enrichment_var <- as.numeric(opt$tss_enrichment)
+
+print("Signac object before filtering:")
+
+signac_object
+
+signac_object <- subset(signac_object, peak_region_fragments > peak_region_fragments_min)
+signac_object <- subset(signac_object, peak_region_fragments < peak_region_fragments_max)
+signac_object <- subset(signac_object, pct_reads_in_peaks > pct_reads_in_peaks_var)
+signac_object <- subset(signac_object, blacklist_ratio < blacklist_ratio_var)
+signac_object <- subset(signac_object, nucleosome_signal < nucleosome_signal_var)
+signac_object <- subset(signac_object, TSS.enrichment > tss_enrichment_var)
+
+print("Signac object after filtering:")
+
+signac_object
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-template.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,60 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+suppressPackageStartupMessages(require(GenomeInfoDb))
+suppressPackageStartupMessages(require(EnsDb.Hsapiens.v75))
+suppressPackageStartupMessages(require(EnsDb.Mmusculus.v79))
+
+set.seed(1234)
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-umap.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,64 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--reduction-use"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--dims-use"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "."
+  ),
+  make_option(
+    c("--output-object-file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+dims_use <- opt$dims_use
+if ( ! is.null(dims_use)){
+  dims_parsed <- wsc_parse_numeric(opt, 'dims_use')
+  print(str(dims_parsed))
+  dims_use <- seq(from = dims_parsed[1], to = dims_parsed[2])
+}
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+signac_object <- RunUMAP(object = signac_object, reduction = opt$reduction_use, dims = dims_use)
+
+# Output to a serialized R object
+saveRDS(signac_object, file = opt$output_object_file)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac-vlnplot.R	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,214 @@
+#!/usr/bin/env Rscript
+
+# Load optparse we need to check inputs
+
+suppressPackageStartupMessages(require(optparse))
+
+# Load common functions
+
+suppressPackageStartupMessages(require(workflowscriptscommon))
+
+# parse options
+
+option_list = list(
+  make_option(
+    c("--signac-object"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = ""
+  ),
+  make_option(
+    c("--features"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File to be used to derive a vector of genes to test."
+  ),
+  make_option(
+    c("--cols"),
+    action = "store",
+    default = NULL,
+    type = 'character',
+    help = "File to be used to derive a vector of colors."
+  ),
+  make_option(
+    c("-p", "--pt-size"),
+    action = "store",
+    default = 1,
+    type = 'integer',
+    help = "Adjust point size for plotting."
+  ),
+  make_option(
+    c("--group-by"),
+    action = "store",
+    default = "ident",
+    type = 'character',
+    help = "Group (color) cells in different ways (for example, orig.ident)."
+  ),
+  make_option(
+    c("--sort"),
+    action = "store",
+    type = 'logical',
+    help = "Sort identity classes (on the x-axis) by the average expression of the attribute being potted, can also pass 'increasing' or 'decreasing' to change sort direction."
+  ),
+  make_option(
+    c("--assay"),
+    action = "store",
+    default = NULL,
+    type = 'character',
+    help = "Name of assay to use, defaults to the active assay."
+  ),
+  # make_option(
+  #   c("--split-by"),
+  #   action = "store",
+  #   default = NULL,
+  #   type = 'character',
+  #   help = "A variable to split the violin plots by."
+  # ),
+  make_option(
+    c("--same-y-lims"),
+    action = "store",
+    default = FALSE,
+    type = 'logical',
+    help = "Set all the y-axis limits to the same values."
+  ),
+  make_option(
+    c("--log"),
+    action = "store",
+    default = FALSE,
+    type = 'logical',
+    help = "plot the feature axis on log scale."
+  ),
+  make_option(
+    c("--ncol"),
+    action = "store",
+    default = NULL,
+    type = 'integer',
+    help = "Number of columns if multiple plots are displayed."
+  ),
+  make_option(
+    c("--slot"),
+    action = "store",
+    default = 'data',
+    type = 'character',
+    help = "Use non-normalized counts data for plotting."
+  ),
+  # make_option(
+  #   c("--split-plot"),
+  #   action = "store",
+  #   default = FALSE,
+  #   type = 'logical',
+  #   help = "plot each group of the split violin plots by multiple or single violin shapes."
+  # ),
+  make_option(
+    c("--stack"),
+    action = "store",
+    default = FALSE,
+    type = 'logical',
+    help = "Horizontally stack plots for each feature."
+  ),
+  make_option(
+    c("--fill-by"),
+    action = "store",
+    default = 'feature',
+    type = 'character',
+    help = "Color violins/ridges based on either 'feature' or 'ident'."
+  ),  
+  make_option(
+    c("--flip"),
+    action = "store",
+    default = FALSE,
+    type = 'logical',
+    help = "flip plot orientation (identities on x-axis)."
+  ), 
+  make_option(
+    c("--png-width"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Width of png (px)."
+  ),
+  make_option(
+    c("--png-height"),
+    action = "store",
+    default = 1000,
+    type = 'integer',
+    help = "Height of png file (px)."
+  ),
+  make_option(
+    c("--output_image_file"),
+    action = "store",
+    default = NA,
+    type = 'character',
+    help = "File name in which to store serialized R matrix object."
+  ) 
+)
+
+opt <- wsc_parse_args(option_list)
+
+suppressPackageStartupMessages(require(Seurat))
+suppressPackageStartupMessages(require(Signac))
+
+set.seed(1234)
+
+if (! file.exists(opt$signac_object)){
+  stop((paste('File', opt$signac_object, 'does not exist')))
+}
+
+# Check features
+features <- NULL
+if (! is.null(opt$features) && opt$features != 'NULL'){
+  features <- strsplit(opt$features, ",")[[1]]
+}
+
+# Check cols
+cols <- NULL
+if (! is.null(opt$cols) && opt$cols != 'NULL'){
+  if (! file.exists(opt$cols)){
+    stop((paste('Supplied features file', opt$cols, 'does not exist')))
+  }else{
+    cols <- readLines(opt$cols)
+  }
+}
+
+# Check assay
+assay <- NULL
+if (! is.null(opt$assay) && opt$assay != 'NULL'){
+  assay <- opt$assay
+}
+
+# extract gene annotations from EnsDb
+signac_object <- readRDS(file = opt$signac_object)
+
+group_by <- if(opt$group_by == 'ident'){
+  NULL
+}else{
+  opt$group_by
+}
+
+# sort <- if(opt$sort == 'False'){
+#   FALSE
+# }else{
+#   TRUE
+# }
+
+png(filename = opt$output_image_file, width = opt$png_width, height = opt$png_height)
+VlnPlot(object = signac_object, 
+  features = features, 
+  cols = cols, 
+  pt.size = opt$pt_size, 
+  group.by = group_by,
+  sort = opt$sort,
+  assay = assay, 
+  #split.by = opt$split_by,
+  same.y.lims = opt$same_y_lims, 
+  log = opt$log, 
+  ncol = opt$ncol,
+  slot = opt$slot, 
+  #split.plot = opt$split_plot, 
+  stack = opt$stack,
+  fill.by = opt$fill_by, 
+  flip = opt$flip
+  )
+dev.off()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_LSI.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,26 @@
+<tool id="signac_lsi" name="Latent semantic indexing (LSI)" version="0.1.0" python_template_version="3.5">
+<description> pferofrms normalization and linear dimensional reduction (TF-IDF followed by SVD).</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-LSI.R --signac-object $signac_object --min-cutoff $min_cutoff --png-width $png_width --png-height $png_height --output-depthcor $output_depthcor_plot --output-object-file $rds_signac_seurat_file
+]]></command>
+<inputs>
+	<param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>	
+	<param type="text" name="min_cutoff" value='q0' label="Variable features cutoff to use." help='Cutoff for feature to be included in the VariableFeatures for the object.'/>
+	<param type="integer" name="png_width" value='1000' label="Figure width" help='Width of png in pixels.'/>
+	<param type="integer" name="png_height" value='1000' label="Figure height" help='Height of png in pixels.'/>
+</inputs>
+<outputs>
+	<data name="rds_signac_seurat_file" format="rdata" label="Signac Object RDS (LSI)"/>
+	<data name="output_depthcor_plot" format="png" from_work_dir="Signac.Depthcor_plot.png" label="Signac.Depthcor_plot.png"/>
+</outputs>
+<help><![CDATA[
+This tool runs the second step in the Signac pipeline, which will add gene annotations to the Signac object.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_add_gene_annotations.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,31 @@
+<tool id="signac_add_gene_annotations" name="Add gene annotations" version="0.1.0" python_template_version="3.5">
+<description> to your Signac object.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-add_gene_annotations.R --signac-object $signac_object --ens-db-genome $ens_db_genome --annotations $annotations --output-object-file $rds_signac_seurat_file
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="select" name="ens_db_genome" label="EnsDB genome version" multiple="false" format="text" optional="false">
+        <option value="EnsDb.Hsapiens.v75">EnsDb.Hsapiens.v75</option>
+        <option value="EnsDb.Mmusculus.v79">EnsDb.Mmusculus.v79</option>
+    </param>
+    <param type="select" name="annotations" label="" multiple="false" format="text" optional="false">
+	<option value="GRCh38">GRCh38</option>
+        <option value="hg19">hg19</option>
+	<option value="mm10">mm10</option>
+    </param>
+</inputs>
+<outputs>
+    <data name="rds_signac_seurat_file" format="rdata" label="Signac Object RDS (genes annotated)"/>
+</outputs>
+<help><![CDATA[
+This tool runs the second step in the Signac pipeline, which will add gene annotations to the Signac object.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_createAssayObject.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,36 @@
+<tool id="signac_createAssayObject" name="Create Assay Object" version="0.1.0" python_template_version="3.5">
+<description> Create Assay Object and Normalize Data</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-createAssayObject.R --signac-object $signac_object --counts $counts --name $name --min-cells $min_cells --min-features $min_features --method $method --scale-factor $scale_factor --margin $margin --output-object-file $rds_signac_seurat_file 
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="data" name="counts" label="Counts Matrix (Output of Gene Activity)" format="rdata" multiple="false" optional="true"/>
+    <param type="text" name="name" label="Assay Name." multiple="false" optional="true" value="RNA"/>    
+    <param type="integer" name="min_cells" label="Min Cells." multiple="false" optional="false" value="0"/>
+    <param type="integer" name="min_features" label="Min Features." multiple="false" optional="false" value="0"/>
+    <param type="select" name="method" label="Method for normalization." value="LogNormalize">
+        <option value="LogNormalize">LogNormalize</option>
+        <option value="CLR">CLR</option>
+        <option value="RC">RC</option>
+    </param>
+    <param type="float" name="scale_factor" value='10000' label="Sets the scale factor for cell-level normalization."/>
+    <param type="select" name="margin" label="If performing CLR normalization, normalize across features (1) or cells (2)." value="1">
+        <option value="1">1</option>
+        <option value="2">2</option>
+    </param>
+</inputs>
+<outputs>
+    <data name="rds_signac_seurat_file" format="rdata" label="Signac Object RDS (Create Assay Object - Normalized)"/>
+</outputs>
+<help><![CDATA[
+This tool creates a new assay and runs the NormalizeData function.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_createObject.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,34 @@
+<tool id="signac_createObject" name="CreateObject" version="0.1.0" python_template_version="3.5">
+<description> reads in output files from CellRanger-ATAC and creates a Seurat object containing a ChromatinAssay assay.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    ln -s $fragment_file fragments.tsv.gz &&
+    ln -s $fragment_index_file fragments.tsv.gz.tbi &&
+    Rscript '${__tool_directory__}'/signac-createObject.R --h5-file $h5_file --metadata $metadata --genome $genome --fragment-file fragments.tsv.gz --output-object-file $rds_signac_seurat_file --min-cells $min_cells --min-features $min_features
+]]></command>
+<inputs>
+    <param type="data" name="h5_file" label="Select the h5 file containing the filtered peak BC matrix." format="h5" multiple="false" optional="false"/>
+    <param type="data" name="metadata" label="Select the metadata file." format="csv" multiple="false" optional="false"/> 
+    <param type="select" name="genome" label="Select the respective genome." multiple="false" format="text" optional="false">
+        <option value="GRCh38">GRCh38/hg38</option>
+        <option value="hg19">GRCh37/hg19</option>
+		<option value="mm10">GRCm38/mm10</option>
+    </param>
+    <param type="integer" name="min_cells" value="10" label="Minimum number of cells features needs to be detected in." multiple="false" optional="false"/> 
+    <param type="integer" name="min_features" value="200" label="Minimum number of features for a cell to be retained." multiple="false" optional="false"/> 
+    <param type="data" name="fragment_file" label="Select the fragment file."  format="bgzip" multiple="false" optional="false"/>
+    <param type="data" name="fragment_index_file" label="Select the fragment index file." format="text" multiple="false" optional="false"/>
+</inputs>
+<outputs>
+    <data name="rds_signac_seurat_file" format="rdata" label="Signac Object RDS (CreateObject)"/>
+</outputs>
+<help><![CDATA[
+This tool runs the first step in the Signac pipeline, which is to read in the filtered peak BC matrix, the metadata and the fragment file and create a Seurat object.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_dimplot.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,28 @@
+<tool id="signac_dimplot" name="Plot dimensional reduction" version="0.1.0" python_template_version="3.5">
+<description> of your cell embeddings.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:"/>
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-dimplot.R --signac-object $signac_object --dims $dims --pt-size $pt_size --label-size $label_size --group-by $group_by --png-width $png_width --png-height $png_height --output_image_file $dimplot_file
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="text" name="dims" value='1,2' label="Dimensions to use." help='Dimension to use.'/>
+    <param type="float" name="pt_size" value='1' label="Point size" help='Adjust point size for plotting'/>
+    <param type="float" name="label_size" value='4' label="Label size" help='Sets size of labels'/>
+    <param type="text" name="group_by" value='ident' label='Group by' help='Group (color) cells in different ways'/>
+    <param type="integer" name="png_width" value='1000' label="Figure width" help='Width of png in pixels.'/>
+    <param type="integer" name="png_height" value='1000' label="Figure height" help='Height of png in pixels.'/>
+</inputs>
+<outputs>
+    <data name="dimplot_file" format="png" from_work_dir="Dimplot.png" label="Signac.dimplot.png"/>
+</outputs>
+<help><![CDATA[
+This tool runs the second step in the Signac pipeline, which will add gene annotations to the Signac object.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_find_clusters.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,23 @@
+<tool id="signac_find_clusters" name="Identify clusters" version="0.1.0" python_template_version="3.5">
+<description>of cells by a shared nearest neighbor (SNN) modularity optimization based clustering algorithm.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-find_clusters.R --signac-object $signac_object --algorithm $algorithm_use --output-object-file $rds_signac_seurat_file
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="integer" name="algorithm_use" value='3' label="Algorithm." help='Algorithm for modularity optimization (1 = original Louvain algorithm; 2 = Louvain algorithm with multilevel refinement; 3 = SLM algorithm; 4 = Leiden algorithm).'/>
+</inputs>
+<outputs>
+    <data name="rds_signac_seurat_file" format="rdata" label="${tool.name} on ${on_string}: Signac RDS"/>
+</outputs>
+<help><![CDATA[
+This tool runs the FindClusters step in the Signac workflow.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_find_neighbours.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,24 @@
+<tool id="signac_find_neighbours" name="Find neighbours" version="0.1.0" python_template_version="3.5">
+<description>using the k-nearest neighbour algorithm.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-find_neighbours.R --signac-object $signac_object --reduction $reduction_use --dims-use $dims_use --output-object-file $rds_signac_seurat_file
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="text" name="reduction_use" value='lsi' label="Dimensional reduction to use for Find neighbours (default:lsi)." help='Which dimensional reduction (PCA or ICA) to use for the Find neighbours input.'/>
+    <param type="text" name="dims_use" value='2,30' label="Dimensional reduction to use for Find neighbours (default:lsi)." help='How many dimensions to use for Find neighbours.'/>
+</inputs>
+<outputs>
+    <data name="rds_signac_seurat_file" format="rdata" label="${tool.name} on ${on_string}: Signac RDS"/>
+</outputs>
+<help><![CDATA[
+This tool runs the Find neighbours function in the Signac pipeline.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_geneactivity.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,32 @@
+<tool id="signac_geneactivity" name="Gene Activity" version="0.1.0" python_template_version="3.5">
+<description>Create gene activity matrix</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    ln -s $fragment_file fragments.tsv.gz &&
+    ln -s $fragment_index_file fragments.tsv.gz.tbi &&
+    Rscript '${__tool_directory__}'/signac-geneactivity.R --signac-object $signac_object --fragment-file fragments.tsv.gz --assay $assay --features $features --extend-upstream $extend_upstream --extend-downstream $extend_downstream --biotypes $biotypes --max-width $max_width --output-object-file $rds_sparse_matrix 
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="data" name="fragment_file" label="Select the fragment file."  format="bgzip" multiple="false" optional="false"/>
+    <param type="data" name="fragment_index_file" label="Select the fragment index file." format="text" multiple="false" optional="false"/>
+    <param type="text" name="assay" format="txt" value="NULL" label="Name of assay to use. If blank, use the default assay." multiple="false" optional="true"/>
+    <param type="data" name="features" label="Features (If NULL, use all features)" format="txt" multiple="false" optional="true"/>
+    <param type="integer" name="extend_upstream" label="Number of bases to extend upstream of the TSS" multiple="false" optional="false" value="2000"/>
+    <param type="integer" name="extend_downstream" label="Number of bases to extend downstream of the TSS" multiple="false" optional="false" value="0"/>
+    <param type="text" name="biotypes" label="Gene biotypes to include. If NULL, use all biotypes in the gene annotation" multiple="false" optional="false" value="protein_coding"/>
+    <param type="integer" name="max_width" label="Maximum allowed gene width for a gene to be quantified" multiple="false" optional="false" value="500000"/>
+</inputs>
+<outputs>
+    <data name="rds_sparse_matrix" format="rdata" label="Sparse Matrix (Gene Activity)"/>
+</outputs>
+<help><![CDATA[
+Compute counts per cell in gene body and promoter region.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_macros.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<macros>
+    <token name="@VERSION@">0.0.8</token>
+    <token name="@SIGNAC_VERSION@">1.4.0</token>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="0.4.0">bats</requirement>
+            <requirement type="package" version="1.7.1">r-optparse</requirement>
+            <requirement type="package" version="1.6.37">libpng</requirement>
+	    <requirement type="package" version="1.5_12.2">r-cairo</requirement>
+            <requirement type="package" version="1.3.5">r-hdf5r</requirement>
+            <requirement type="package" version="0.0.7">r-workflowscriptscommon</requirement>
+            <requirement type="package" version="1.42.0">bioconductor-biovizbase</requirement>
+            <requirement type="package" version="2.99.0">bioconductor-ensdb.hsapiens.v75</requirement>
+	    <requirement type="package" version="2.99.0">bioconductor-ensdb.mmusculus.v79</requirement>
+            <requirement type="package" version="1.30.0">bioconductor-genomeinfodb</requirement>
+	    <requirement type="package" version="@SIGNAC_VERSION@">r-signac</requirement>
+            <requirement type="package" version="4.0.2">r-seuratobject</requirement>
+        </requirements>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_runQC.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,31 @@
+<tool id="signac_runQC" name="Run quality control" version="0.1.0" python_template_version="3.5">
+<description> on Signac object and plot results.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    cp $fragment_file fragments.tsv.gz &&
+    cp $fragment_index_file fragments.tsv.gz.tbi &&
+    Rscript '${__tool_directory__}'/signac-runQC.R --signac-object $signac_object --fragment-file fragments.tsv.gz --tss-threshold $tss_threshold --output-object-file $rds_signac_seurat_file --output-tss-plot $output_tss_plot --frag-history-plot $frag_history_plot --png-width $png_width --png-height $png_height
+]]></command>
+<inputs>
+	<param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+	<param type="data" name="fragment_file" label="Select the fragment file."  format="bgzip" multiple="false" optional="false"/>
+	<param type="data" name="fragment_index_file" label="Select the fragment index file." format="text" multiple="false" optional="false"/>
+    <param type="integer" name="tss_threshold" value="2" label=" Transcription start site (TSS) enrichment score threshold for considering cells with a high TSS enrichment for the TSS plot." multiple="false" optional="false"/> 
+    <param type="integer" name="png_width" value='1000' label="Figure width" help='Width of png in pixels.'/>
+    <param type="integer" name="png_height" value='1000' label="Figure height" help='Height of png in pixels.'/>
+</inputs>
+<outputs>
+	<data name="rds_signac_seurat_file" format="rdata" label="Signac Object RDS (QC)"/>
+	<data name="output_tss_plot" format="png" from_work_dir="scATACseq.TSS_plot.png" label="scATACseq.TSS_plot.png"/>
+	<data name="frag_history_plot" format="png" from_work_dir="scATACseq.fraghist_plot.png" label="scATACseq.fraghist_plot.png"/>
+</outputs>
+<help><![CDATA[
+This tool runs the second step in the Signac pipeline, which will add gene annotations to the Signac object.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_subset.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,28 @@
+<tool id="signac_subset" name="Subset" version="0.1.0" python_template_version="3.5">
+<description> a Signac object based on user defined thresholds.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-subset.R --signac-object $signac_object --peak-region-fragments-min $peak_region_fragments_min --peak-region-fragments-max $peak_region_fragments_max --pct-reads-in-peaks $pct_reads_in_peaks --blacklist-ratio $blacklist_ratio --nucleosome-signal $nucleosome_signal --tss-enrichment $tss_enrichment --output-object-file $rds_signac_seurat_file
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="integer" name="peak_region_fragments_min" value='3000' label="Peak region format minimum." help=''/>
+    <param type="integer" name="peak_region_fragments_max" value='20000' label="Peak region format maximum." help=''/>
+    <param type="integer" name="pct_reads_in_peaks" value='15' label="Minimum percent of reads in peaks." help=''/>
+    <param type="float" name="blacklist_ratio" value='0.05' label="Blacklist ratio." help=''/>
+    <param type="integer" name="nucleosome_signal" value='4' label="Nucleosome signal threshold." help=''/>
+    <param type="integer" name="tss_enrichment" value='2' label="TSS enrichment signal threshold." help=''/>
+</inputs>
+<outputs>
+    <data name="rds_signac_seurat_file" format="rdata" label="Signac RDS (subset)"/>
+</outputs>
+<help><![CDATA[
+This tool runs the second step in the Signac pipeline, which will add gene annotations to the Signac object.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_umap.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,24 @@
+<tool id="signac_umap" name="Calculate UMAP" version="0.1.0" python_template_version="3.5">
+<description> embedding of scATAC-seq data.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:" />
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-umap.R --signac-object $signac_object --reduction $reduction_use --dims-use $dims_use --output-object-file $rds_signac_seurat_file 
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="text" name="reduction_use" value='lsi' label="Dimensional reduction to use for UMAP (default:lsi)." help='Which dimensional reduction (PCA or ICA) to use for the UMAP input.'/>
+    <param type="text" name="dims_use" value='2,30' label="Dimensional reduction to use for UMAP (default:lsi)." help='How many dimensions to use for UMAP.'/>
+</inputs>
+<outputs>
+    <data name="rds_signac_seurat_file" format="rdata" label="Signac Object RDS (UMAP)"/>
+</outputs>
+<help><![CDATA[
+This tool runs the second step in the Signac pipeline, which will add gene annotations to the Signac object.
+    ]]></help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signac_vlnplot.xml	Tue Aug 02 19:11:27 2022 +0000
@@ -0,0 +1,42 @@
+<tool id="signac_vlnplot" name="Violin Plot" version="0.1.0" python_template_version="3.5">
+<description> of selected features.</description>
+<macros>
+    <import>signac_macros.xml</import>
+</macros>
+<expand macro="requirements"/>
+<stdio>
+    <exit_code range="1:"/>
+</stdio>
+<command><![CDATA[
+    Rscript '${__tool_directory__}'/signac-vlnplot.R --signac-object $signac_object --features $features --cols $cols --pt-size $pt_size --group-by $group_by --sort $sort --assay $assay --same-y-lims $same_y_lims --log $log --ncol $ncol --slot $slot --stack $stack --fill-by $fill_by --flip $flip --png-width $png_width --png-height $png_height --output_image_file $vlnplot_file
+]]></command>
+<inputs>
+    <param type="data" name="signac_object" label="Signac object." format="rdata" multiple="false" optional="false"/>
+    <param type="text" name="features" label="Features (separated by a comma)" optional="false"/>
+    <param type="text" name="cols" label="Colours" value="NULL" format="txt" multiple="false" optional="false"/>
+    <param type="float" name="pt_size" value='1' label="Point size" optional="true"/>
+    <param type="text" name="group_by" value='ident' label="Group by"/>
+    <param type="boolean" name="sort" value='false' label="Sort"/>
+    <param type="text" name="assay" value='NULL' format="txt" label="Assay"/>
+    <!-- <param type="text" name="split_by" value='NULL' label="A split the violin plots by"/> -->
+    <param type="boolean" name="same_y_lims" value='false' label="Same y limits"/>
+    <param type="boolean" name="log" value='false' label="Plot on log scale"/>
+    <param type="integer" name="ncol" value='3' label="Number of columns"/>
+    <param type="text" name="slot" value='data' label="Data slot"/>
+    <!-- <param type="boolean" name="split_plot" value='false' label="Plot each group of the split violin plots by multiple or single violin shapes"/> -->
+    <param type="boolean" name="stack" value='false' label="Horizontally stack plots for each feature"/>
+    <param type="select" name="fill_by" label="Color violins/ridges based on either 'feature' or 'ident'">
+        <option value="feature">feature</option>
+        <option value="ident">ident</option>
+    </param>
+    <param type="boolean" name="flip" value='false' label="flip plot orientation (identities on x-axis)"/> 
+    <param type="integer" name="png_width" value='1000' label="Figure width" help='Width of png in pixels.'/>
+    <param type="integer" name="png_height" value='1000' label="Figure height" help='Height of png in pixels.'/>
+</inputs>
+<outputs>
+    <data name="vlnplot_file" format="png" from_work_dir="Vlnplot.png" label="Signac.vlnplot.png"/>
+</outputs>
+<help><![CDATA[
+This tool creates a violin plot and saves it as a .png file.
+    ]]></help>
+</tool>