-
Notifications
You must be signed in to change notification settings - Fork 1
/
runERC.R
32 lines (20 loc) · 1.1 KB
/
runERC.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
require(devtools)
#install TreeTools
remotes::install_github("ms609/TreeTools")
#this takes a few seconds and only needs to be done once per session
source("updates2022.R")
source("ERC.R")
Rcpp::sourceCpp("cppFuncs.cpp")
##put in the file with all gene trees here
treefile = "physical_interaction_paper/domains_trees.tre"
outputfile = "out.RDS"
## readTrees reads in your file of trees and constructs a master tree based on them
comptrees=readTrees(treefile)
comptrees=transformPaths(comptrees, transform = "sqrt",impute = F)
compResid=getAllResiduals(comptrees, n.pcs = 0)
rMat=getRMat(compResid, all = T, weights = comptrees$weights)
clusterList=getClusterList(comptrees)
##Here is where you will edit the threshold you want, minSp is the number of species two genes have to share
##If you only want to run a few genes you can set doOnly = c("genea","geneb")
##If you want the plot of the RERs set plot = T (I would only recommend doing this for a few genes because it uses up a lot of space)
corres=computeERC(rMat, comptrees, parallel = F, clusterListOutput = clusterList, minSp = 15, saveFile = outputfile)