annotate ChoosePatterns.R @ 30:689cba393d6b draft

Uploaded
author ning
date Mon, 16 Jun 2014 16:21:33 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
689cba393d6b Uploaded
ning
parents:
diff changeset
1 sink(file="/tmp/none")
689cba393d6b Uploaded
ning
parents:
diff changeset
2 sink("/dev/null")
689cba393d6b Uploaded
ning
parents:
diff changeset
3 options(warn=-1)
689cba393d6b Uploaded
ning
parents:
diff changeset
4 options(echo=F)
689cba393d6b Uploaded
ning
parents:
diff changeset
5
689cba393d6b Uploaded
ning
parents:
diff changeset
6 #invisible("EBSeq")
689cba393d6b Uploaded
ning
parents:
diff changeset
7 #suppressMessages(library("EBSeq")) ##cms - changed on 11/11/13. Don't need EBSeq package.
689cba393d6b Uploaded
ning
parents:
diff changeset
8
689cba393d6b Uploaded
ning
parents:
diff changeset
9 args <- commandArgs(trailingOnly = T)
689cba393d6b Uploaded
ning
parents:
diff changeset
10 inputfile <- args[1]
689cba393d6b Uploaded
ning
parents:
diff changeset
11 Idx <- args[2]
689cba393d6b Uploaded
ning
parents:
diff changeset
12 outputfile <- args[3]
689cba393d6b Uploaded
ning
parents:
diff changeset
13
689cba393d6b Uploaded
ning
parents:
diff changeset
14 print(args)
689cba393d6b Uploaded
ning
parents:
diff changeset
15
689cba393d6b Uploaded
ning
parents:
diff changeset
16 ReadIn=read.table(inputfile,stringsAsFactors=F,header=T, sep="\t")
689cba393d6b Uploaded
ning
parents:
diff changeset
17
689cba393d6b Uploaded
ning
parents:
diff changeset
18 IndexIn=strsplit(Idx,split=",")[[1]]
689cba393d6b Uploaded
ning
parents:
diff changeset
19 Index=as.numeric(IndexIn)
689cba393d6b Uploaded
ning
parents:
diff changeset
20
689cba393d6b Uploaded
ning
parents:
diff changeset
21 #Mat=data.matrix(ReadIn)
689cba393d6b Uploaded
ning
parents:
diff changeset
22 Mat=data.matrix(ReadIn[,-1]) ##cms - changed on 11/11/13. Otherwise pattern IDs are replaced with NA.
689cba393d6b Uploaded
ning
parents:
diff changeset
23 rownames(Mat)=ReadIn[,1] ##cms - also added on 11/11/13 to add pattern IDs back in.
689cba393d6b Uploaded
ning
parents:
diff changeset
24
689cba393d6b Uploaded
ning
parents:
diff changeset
25 Out=Mat[Index,]
689cba393d6b Uploaded
ning
parents:
diff changeset
26
689cba393d6b Uploaded
ning
parents:
diff changeset
27
689cba393d6b Uploaded
ning
parents:
diff changeset
28 #write.table(Out,file=outputfile,quote=F,col.names=T,row.names=T,sep = "\t")
689cba393d6b Uploaded
ning
parents:
diff changeset
29 write.table(Out,file=outputfile,quote=F,col.names=NA,row.names=T,sep = "\t") ##cms - changed on 11/11/13
689cba393d6b Uploaded
ning
parents:
diff changeset
30