-
Notifications
You must be signed in to change notification settings - Fork 0
/
Script.R
27 lines (22 loc) · 885 Bytes
/
Script.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
# script to create a .txt file from the files get from GECO
# create the dataframe from the input files
prepare.data <- function (path){
fileNames <- Sys.glob(path)
dataFrame <- data.frame()
for(elem in fileNames){
tmp <- read.table(elem, sep = '\t', header = FALSE) [c(5,11)]
dataFrame <- rbind(dataFrame, tmp)
}
colnames(dataFrame) <- c('ensembl_gene_id', 'fpkm')
return(dataFrame)
}
# create a dataframe for the healthy samples
data.healthy <- prepare.data("provaData/healthy/*.bed")
data.healthy["is_healthy"] <- rep(1, times = dim(data.healthy)[1])
# create a dataframe for the tumoral samples
data.tumor <- prepare.data("provaData/tumor/*.bed")
data.tumor["is_healthy"] <- rep(0, times = dim(data.tumor)[1])
# combine the two dataframe
data <- rbind(data.healthy, data.tumor)
# create a file contaning the data
write.table(data, 'data.txt', sep="\t")