#!/usr/bin/env Rscript
###############################################################################
# #
# Copyright (c) 2013 J. Craig Venter Institute. #
# All rights reserved. #
# #
###############################################################################
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see . #
# #
###############################################################################
###############################################################################
library('getopt')
params=c(
"zero_flag", "z", 0, "logical", # if specified eliminate rows that are all 0/blank/null or sum to zero
"col_only_flag", "C", 0, "logical", # if specified only remove columns not rows
"input_file", "i", 1, "character", # file containing matrix/data frame/table with row and column headers
"output_file", "o", 1, "character", # output file name to write subset of input matrix
"column_labels", "c", 1, "character", # column names to keep
"row_labels", "r", 2, "character" # row names to keep (optional if not specified then same as column names
)
opt=getopt(spec=matrix(params, ncol=4, byrow=TRUE), debug=FALSE)
script_name=unlist(strsplit(commandArgs(FALSE)[4],"=")[1])[2]
usage = paste (
"\nUsage:\n\n", script_name,
"\n",
" -i \n",
" -o