Mercurial > repos > peter-waltman > ucsc_cluster_tools2
comparison cluster.tools/cluster.tab.2.rdata.R @ 8:a58527c632b7 draft
Uploaded
author | peter-waltman |
---|---|
date | Mon, 11 Mar 2013 16:31:29 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
7:2efa1a284546 | 8:a58527c632b7 |
---|---|
1 #!/usr/bin/env Rscript | |
2 argspec <- c("tab.2.cdt.R converts a data matrix to cdt format | |
3 | |
4 Usage: | |
5 tab.2.cdt.R -d <data.file> | |
6 Optional: | |
7 -o <output_file> | |
8 \n\n") | |
9 args <- commandArgs(TRUE) | |
10 if ( length( args ) == 1 && args =="--help") { | |
11 write(argspec, stderr()) | |
12 q(); | |
13 } | |
14 | |
15 | |
16 lib.load.quiet <- function( package ) { | |
17 package <- as.character(substitute(package)) | |
18 suppressPackageStartupMessages( do.call( "library", list( package=package ) ) ) | |
19 } | |
20 lib.load.quiet(getopt) | |
21 | |
22 | |
23 spec <- matrix( c( "data.fname", "d", 1, "character", | |
24 "output.fname", "o", 2, "character" | |
25 ), | |
26 nc=4, | |
27 byrow=TRUE | |
28 ) | |
29 | |
30 opt <- getopt( spec=spec ) | |
31 if ( is.null( opt$output.fname ) ) opt$output.fname <- sub( "tab$|csv$", "cdt", opt$data.fname ) | |
32 | |
33 cl <- as.matrix( read.delim( opt$data.fname, row.names=1, check.names=FALSE ) ) | |
34 cl <- cl[,1] | |
35 save( file=opt$output.fname, cl ) |