-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRCmds
executable file
·28 lines (24 loc) · 1.03 KB
/
RCmds
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
# two R dependencies (packages) are required, ips and parallel
# While in R, use install.packages(c("ips", "parallel")) to install.
library(ips)
library(parallel)
setwd("/my/working/directory/")
files=list.files(pattern = '.nexus')
nex = length(files)
# get number of files for 1:length(1:n files)
for(i in 1:length(1:nex)){
phylip = read.nex(files[i])
this.name = files[i]
newname=sub(".nexus",".phy",files[i])
print(newname)
save.path = getwd()
save.path = paste(save.path,"/",sub(".nexus","",files[i]),sep = "")
write.phy(phylip, file=file.path(save.path, newname), interleave=FALSE)
}
phy_files_list = list.files(pattern = "*.phy$", recursive = TRUE, path = getwd(), full.names = TRUE)
cmd =list()
for(i in 1:length(phy_files_list)){
cmd[[i]] = paste(getwd(), "/run_RAxML.sh ", phy_files_list[i], sep="")
}
# make sure your system has 48 cores or change the 48 to an appropriate number of threads.
final_raxml = mclapply(cmd, system, mc.cores=getOption("mc.cores", 48)) ### 48 threads