view metacyto_checkpanel.R @ 0:67d79ba0f7aa draft default tip

"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/check_headers commit 14b2e4d834a9856236affb7b77debecca360c542"
author azomics
date Tue, 27 Jul 2021 21:47:56 +0000
parents
children
line wrap: on
line source

#!/usr/bin/env Rscript
######################################################################
#                  Copyright (c) 2018 Northrop Grumman.
#                          All rights reserved.
######################################################################
#
# Version 1 - January 2018
# Author: Cristel Thomas
#
#

library(MetaCyto)

check_panel <- function(df, outfile = "") {
  report <- panelSummary(df, ".", cluster = F, width = 30, height = 20)
  markers <- data.frame("Markers" = row.names(report))
  s <- cbind(markers, report)
  write.table(s, file = outfile, quote = F, row.names = F, col.names = T, sep = "\t")
}

check_input_format <- function(infile = "", outfile = "") {
  df <- read.table(infile, sep = "\t", header = T, colClasses = "character")
  nm <- colnames(df)
  check_ab <- if ("antibodies" %in% nm) TRUE else FALSE
  check_sdy <- if ("study_id" %in% nm) TRUE else FALSE

  if (check_sdy && check_ab) {
    check_panel(df, outfile)
  } else {
    quit(save = "no", status = 10, runLast = FALSE)
  }
}

################################################################################
args <- commandArgs(trailingOnly = TRUE)

check_input_format(args[1], args[2])