view signac-find_neighbours.R @ 0:6e0b320d8b6a draft default tip

"planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
author gaelcge
date Tue, 02 Aug 2022 19:11:27 +0000
parents
children
line wrap: on
line source

#!/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)