-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3_Transposed_aCGH.R
executable file
·55 lines (37 loc) · 1.46 KB
/
3_Transposed_aCGH.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# This programs creates the transposed version of the data set
# to feed into 4_hom_stats.py.
# Input: xxxx_data_full.txt
# Output: xxxx_data.txt
#################################################
# COMMAND LINE ARGUMENTS
# 4. loc (local, gonzalez)
# 5. dataSet (sj, sim6, simC3 climent, etc.)
# EXAMPLE
# Note: use vanilla when testing and slave when ready to avoid the log
# R --slave --args set < 3_Transposed_aCGH.R
# R --vanilla --args horlings < 3_Transposed_aCGH.R
# Get the command line arguments
args = commandArgs();
dataSet <- args[4];
CGH_start <- 6;
###############################
# READ FILES
begPath <- "..";
dataFile <- paste(dataSet, "data", "full.txt", sep="_");
dataPath <- paste(begPath, "Data", dataSet, dataFile, sep="/");
print(dataPath);
data <- read.table(dataPath, header=T, sep='\t', comment.char="");
###############################
# BEGIN PROGRAM
# Keeping Chrom and Arm info in a transposed data frame
dataT <- as.data.frame(t(data$Chrom));
dataT <- rbind(dataT, t(as.character(data$Arm)));
# Getting the number of rows and columns from data_full
cols <- ncol(data);
rows <- nrow(data);
# Adding to the data frame the transposed patients aCGH info
dataT <- rbind(dataT, t(data[,c(CGH_start:cols)]));
# Setup and write the dictionary file
newFile <- paste(dataSet, "data.txt", sep="_");
newPath <- paste(begPath, "Data", dataSet, newFile, sep="/");
write.table(dataT, newPath, sep='\t', row.names=FALSE, col.names=FALSE);