Skip to content

Commit

Permalink
Modify configuration file loading in R scripts to avoid character str…
Browse files Browse the repository at this point in the history
…ings being loaded as factors, following #24
  • Loading branch information
lentendu committed Mar 7, 2024
1 parent 76cbeb1 commit a67dc5d
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rscripts/clean_mat.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ suppressMessages(library(doParallel))
suppressMessages(library(compositions))

# read options
config<-read.table("config",h=T,as.is=2)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))
mat<-read.table(config$mat,h=T)
write(nrow(mat),"nbsamp_ori")
write(ncol(mat),"nbotu_ori")
Expand Down
2 changes: 1 addition & 1 deletion rscripts/edges_p.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ suppressMessages(library(rhdf5))
block<-as.numeric(commandArgs()[7])

# read options
config<-read.table("config",h=T,as.is=2)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))
for (i in 4:ncol(config)){assign(names(config)[i],config[1,i])}

# get p.values of edges above threshold (one block at a time)
Expand Down
2 changes: 1 addition & 1 deletion rscripts/edges_p_ex.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ suppressMessages(library(rhdf5))
block<-as.numeric(commandArgs()[7])

# read options
config<-read.table("config",h=T,as.is=2)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))
for (i in 4:ncol(config)){assign(names(config)[i],config[1,i])}

# get p.values of edges above threshold
Expand Down
2 changes: 1 addition & 1 deletion rscripts/edges_r.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ threshold<-scan("threshold",quiet=T)
threshold_ex<-scan("ex_threshold",quiet=T)

# read options
config<-read.table("config",h=T,as.is=2)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))
for (i in 4:ncol(config)){assign(names(config)[i],config[1,i])}

# Read Spearman's rho from noise added matrix (one block at a time)
Expand Down
2 changes: 1 addition & 1 deletion rscripts/network.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ncores<-as.numeric(commandArgs()[7])
blocks<-as.numeric(commandArgs()[8])

# read options
config<-read.table("config",h=T,as.is=2)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))
for (i in 4:ncol(config)){assign(names(config)[i],config[1,i])}

# load edges
Expand Down
2 changes: 1 addition & 1 deletion rscripts/rand_network.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ suppressMessages(library(igraph,quietly=T))
seed<-as.numeric(commandArgs()[7])

# Read options
config<-read.table("config",h=T,as.is=1)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))
for (i in 4:ncol(config)){assign(names(config)[i],config[1,i])}

# load normalize matrix
Expand Down
2 changes: 1 addition & 1 deletion rscripts/spearman.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ suppressMessages(library(rhdf5))
seed<-as.numeric(commandArgs()[7])

# read options
config<-read.table("config",h=T,as.is=2)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))

# load normalize matrix
mat<-readRDS("mat")
Expand Down
2 changes: 1 addition & 1 deletion rscripts/threshold_range.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ suppressMessages(library(igraph,quietly=T))
suppressMessages(library(rhdf5))

# read options
config<-read.table("config",h=T,as.is=2)
config<-read.table("config",h=T,colClasses=c(cksum="character",mat="character"))
for (i in 4:ncol(config)){assign(names(config)[i],config[1,i])}

# load normalize matrix
Expand Down

0 comments on commit a67dc5d

Please sign in to comment.