Last updated: 2024-06-19
Checks: 7 0
Knit directory:
locust-comparative-genomics/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20221025) was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 5913857. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish or
wflow_git_commit). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .RData
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.DS_Store
Ignored: analysis/.Rhistory
Ignored: data/.DS_Store
Ignored: data/.Rhistory
Ignored: data/DEseq2_SAMER_SAMER_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SAMER_SAMER_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SAMER_SGREG_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SAMER_SGREG_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCANC_SCANC_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCANC_SCANC_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCANC_SGREG_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCANC_SGREG_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCUBE_SCUBE_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCUBE_SCUBE_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCUBE_SGREG_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SCUBE_SGREG_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SGREG_SGREG_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SGREG_SGREG_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SNITE_SGREG_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SNITE_SGREG_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SNITE_SNITE_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SNITE_SNITE_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SPICE_SGREG_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SPICE_SGREG_THORAX_STARnew_features/.DS_Store
Ignored: data/DEseq2_SPICE_SPICE_HEAD_STARnew_features/.DS_Store
Ignored: data/DEseq2_SPICE_SPICE_THORAX_STARnew_features/.DS_Store
Ignored: data/americana/.DS_Store
Ignored: data/americana/deg_counts/.DS_Store
Ignored: data/americana/deg_counts/STAR/.DS_Store
Ignored: data/americana/deg_counts/STAR/americana/.DS_Store
Ignored: data/americana/deg_counts/STAR/americana/featurecounts/.DS_Store
Ignored: data/americana/deg_counts/STAR/gregaria/.DS_Store
Ignored: data/americana/deg_counts/STAR/gregaria/featurecounts/.DS_Store
Ignored: data/americana/deg_counts/STAR_newparams/.DS_Store
Ignored: data/americana/deg_counts/STAR_newparams/americana/.DS_Store
Ignored: data/americana/deg_counts/STAR_newparams/americana/featurecounts/.DS_Store
Ignored: data/americana/deg_counts/STAR_newparams/gregaria/.DS_Store
Ignored: data/americana/deg_counts/STAR_newparams/gregaria/featurecounts/.DS_Store
Ignored: data/cancellata/.DS_Store
Ignored: data/cancellata/deg_counts/.DS_Store
Ignored: data/cancellata/deg_counts/STAR/.DS_Store
Ignored: data/cancellata/deg_counts/STAR_newparams/.DS_Store
Ignored: data/cubense/.DS_Store
Ignored: data/cubense/deg_counts/.DS_Store
Ignored: data/cubense/deg_counts/STAR/.DS_Store
Ignored: data/cubense/deg_counts/STAR/cubense/.DS_Store
Ignored: data/cubense/deg_counts/STAR/cubense/featurecounts/
Ignored: data/cubense/deg_counts/STAR/gregaria/
Ignored: data/cubense/deg_counts/STAR_newparams/.DS_Store
Ignored: data/cubense/deg_counts/STAR_newparams/cubense/.DS_Store
Ignored: data/cubense/deg_counts/STAR_newparams/gregaria/.DS_Store
Ignored: data/gregaria/.DS_Store
Ignored: data/gregaria/deg_counts/.DS_Store
Ignored: data/gregaria/deg_counts/STAR/.DS_Store
Ignored: data/gregaria/deg_counts/STAR_newparams/.DS_Store
Ignored: data/gregaria/deg_counts/STAR_newparams/gregaria/.DS_Store
Ignored: data/gregaria/deg_counts/STAR_newparams/gregaria/featurecounts/.DS_Store
Ignored: data/list/.DS_Store
Ignored: data/metadata/.DS_Store
Ignored: data/nitens/.DS_Store
Ignored: data/nitens/deg_counts/.DS_Store
Ignored: data/nitens/deg_counts/STAR_newparams/.DS_Store
Ignored: data/nitens/deg_counts/STAR_newparams/gregaria/.DS_Store
Ignored: data/nitens/deg_counts/STAR_newparams/gregaria/featurecounts/.DS_Store
Ignored: data/nitens/deg_counts/STAR_newparams/nitens/.DS_Store
Ignored: data/nitens/deg_counts/STAR_newparams/nitens/featurecounts/.DS_Store
Ignored: data/piceifrons/.DS_Store
Ignored: data/piceifrons/deg_counts/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR/gregaria/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR/gregaria/featurecounts/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR/piceifrons/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR/piceifrons/featurecounts/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR_newparams/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR_newparams/gregaria/.DS_Store
Ignored: data/piceifrons/deg_counts/STAR_newparams/piceifrons/.DS_Store
Ignored: figures/
Ignored: tables/
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/3_wgcna-network.Rmd) and
HTML (docs/3_wgcna-network.html) files. If you’ve
configured a remote Git repository (see ?wflow_git_remote),
click on the hyperlinks in the table below to view the files as they
were in that past version.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| html | e39d280 | Maeva A. TECHER | 2024-01-29 | Build site. |
| html | f701a01 | Maeva A. TECHER | 2024-01-29 | reupdate |
| html | 2d19904 | Maeva A. TECHER | 2024-01-29 | Build site. |
| Rmd | c448221 | Maeva A. TECHER | 2024-01-29 | wflow_publish("analysis/3_wgcna-network.Rmd") |
| html | 9f99582 | Maeva A. TECHER | 2024-01-24 | Build site. |
| html | 1b09cbe | Maeva A. TECHER | 2024-01-24 | remove |
| html | a3c4344 | Maeva A. TECHER | 2023-12-18 | Build site. |
| Rmd | 53877fa | Maeva A. TECHER | 2023-12-18 | add pages |
NEED TO EDIT AND CHANGE, RAW SCRIPTS FROM BERT
We are only showing the code for the head tissue, the code for the thorax tissue is mostly identical.
knitr::opts_chunk$set(echo = TRUE)
packages <- c("WGCNA")
sapply(packages, library, character.only = T)
options(stringsAsFactors = FALSE);
We start by loading all the files containing the read count data, selecting the needed columns, and merging all into one table.
setwd("C:/Users/Bert/Documents/Work/Papers/Transcriptomics-behavior/Revamped paper/WGCNA")
SPIC_CT1_count <- read.table("Transrate_SPIC_CT1_idxstats.tabular")
SPIC_CT2_count <- read.table("Transrate_SPIC_CT2_idxstats.tabular")
SPIC_CT3_count <- read.table("Transrate_SPIC_CT3_idxstats.tabular")
SPIC_CT4_count <- read.table("Transrate_SPIC_CT4_idxstats.tabular")
SPIC_CT5_count <- read.table("Transrate_SPIC_CT5_idxstats.tabular")
SPIC_IT1_count <- read.table("Transrate_SPIC_IT1_idxstats.tabular")
SPIC_IT2_count <- read.table("Transrate_SPIC_IT2_idxstats.tabular")
SPIC_IT3_count <- read.table("Transrate_SPIC_IT3_idxstats.tabular")
SPIC_IT4_count <- read.table("Transrate_SPIC_IT4_idxstats.tabular")
SPIC_IT5_count <- read.table("Transrate_SPIC_IT5_idxstats.tabular")
SAME_CT1_count <- read.table("Transrate_SAME_CT1_idxstats.tabular")
SAME_CT2_count <- read.table("Transrate_SAME_CT2_idxstats.tabular")
SAME_CT3_count <- read.table("Transrate_SAME_CT3_idxstats.tabular")
SAME_CT4_count <- read.table("Transrate_SAME_CT4_idxstats.tabular")
SAME_CT5_count <- read.table("Transrate_SAME_CT5_idxstats.tabular")
SAME_IT1_count <- read.table("Transrate_SAME_IT1_idxstats.tabular")
SAME_IT2_count <- read.table("Transrate_SAME_IT2_idxstats.tabular")
SAME_IT3_count <- read.table("Transrate_SAME_IT4_idxstats.tabular")
SAME_IT4_count <- read.table("Transrate_SAME_IT5_idxstats.tabular")
SAME_IT5_count <- read.table("Transrate_SAME_IT6_idxstats.tabular")
SCUB_CT1_count <- read.table("Transrate_SCUB_CT1_idxstats.tabular")
SCUB_CT2_count <- read.table("Transrate_SCUB_CT2_idxstats.tabular")
SCUB_CT3_count <- read.table("Transrate_SCUB_CT3_idxstats.tabular")
SCUB_CT4_count <- read.table("Transrate_SCUB_CT4_idxstats.tabular")
SCUB_IT1_count <- read.table("Transrate_SCUB_IT1_idxstats.tabular")
SCUB_IT2_count <- read.table("Transrate_SCUB_IT2_idxstats.tabular")
SCUB_IT3_count <- read.table("Transrate_SCUB_IT3_idxstats.tabular")
SCUB_IT5_count <- read.table("Transrate_SCUB_IT5_idxstats.tabular")
SNIT_CT1_count <- read.table("Transrate_SNIT_CT1_idxstats.tabular")
SNIT_CT3_count <- read.table("Transrate_SNIT_CT3_idxstats.tabular")
SNIT_CT5_count <- read.table("Transrate_SNIT_CT5_idxstats.tabular")
SNIT_IT1_count <- read.table("Transrate_SNIT_IT1_idxstats.tabular")
SNIT_IT2_count <- read.table("Transrate_SNIT_IT2_idxstats.tabular")
SNIT_IT3_count <- read.table("Transrate_SNIT_IT3_idxstats.tabular")
SNIT_IT4_count <- read.table("Transrate_SNIT_IT4_idxstats.tabular")
SNIT_IT5_count <- read.table("Transrate_SNIT_IT5_idxstats.tabular")
mylist = do.call("list", mget(grep("count", ls(), value=T)))
mylist2 <- mylist[sapply(mylist, function(x) dim(x)[1]) > 0]
mylist2 <- lapply(mylist, function(x) { x <- x[c(1,3)] })
Complete <- mylist2[[1]]
colnames(Complete)[2] <- print(names(mylist2)[[1]])
for(i in 2:length(mylist2)){
Complete <- merge(Complete,mylist2[[i]], by = 'V1')
colnames(Complete)[i+1] <- print(names(mylist2)[[i]])
}
Now we remove any genes with an average readcount under 5
Complete_low <- Complete
row.names(Complete_low) <- Complete_low$V1
Complete_low <- Complete_low[,-c(1)]
Complete_low <- subset(transform(Complete_low, Mean=round(rowMeans(Complete_low),1)), Mean >=5)
Complete_low <- Complete_low[,-c(37)]
Now we convert our read counts to the TPM format for use in WGCNA
mylist_TPM<-mylist
for(i in 1:length(mylist_TPM)){
TPM_1 <- mylist_TPM[[i]]
TPM_1$x <- TPM_1$V3/TPM_1$V2
TPM <- TPM_1[c(5)]
row.names(TPM) <- TPM_1[,1]
TPM <- t(t(TPM)*1e6/colSums(TPM))
TPM <- as.data.frame(as.table(TPM))
mylist_TPM[[i]] <- TPM[c(1,3)]
}
TPM <- mylist_TPM[[1]]
colnames(TPM)[2] <- print(names(mylist_TPM)[[1]])
for(i in 2:length(mylist_TPM)){
TPM <- merge(TPM,mylist_TPM[[i]], by = 'Var1')
colnames(TPM)[i+1] <- print(names(mylist_TPM)[[i]])
}
Complete_low$Var1 <- row.names(Complete_low)
Complete_TPM <- subset(TPM, Var1 %in% Complete_low$Var1)
row.names(Complete_TPM) <- Complete_TPM$Var1
Complete_TPM <- Complete_TPM[-c(1)]
Finally, we select the top 60 % of the most varying genes in the whole dataset and convert the dataframe for use in WGCNA
# Select most varying genes over the whole dataset
DE_genes <- apply(Complete_TPM, 1, var)
DE_genes <- names(sort(DE_genes, decreasing=TRUE))[1:(nrow(Complete_TPM)*0.6)]
Complete_DE <- Complete_TPM[DE_genes,]
datExpr <- as.data.frame(t(Complete_DE));
datExpr[length(mylist),] <- as.numeric(datExpr[length(mylist),])
We first set the correct soft-thresholding power
powers = c(c(1:10), seq(from = 12, to=20, by=2))
sft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5)
sizeGrWindow(9, 5)
par(mfrow = c(1,2));
cex1 = 0.9;
plot(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
xlab="Soft Threshold (power)",ylab="Scale Free Topology Model Fit,signed R^2",type="n",
main = paste("Scale independence"));
text(sft$fitIndices[,1], -sign(sft$fitIndices[,3])*sft$fitIndices[,2],
labels=powers,cex=cex1,col="red");
abline(h=0.80,col="red")
plot(sft$fitIndices[,1], sft$fitIndices[,5],
xlab="Soft Threshold (power)",ylab="Mean Connectivity", type="n",
main = paste("Mean connectivity"))
text(sft$fitIndices[,1], sft$fitIndices[,5], labels=powers, cex=cex1,col="red")
Based on these graphs, we select the power.We can now run the rest of WGCNA.
Power <- 8
CutHeight <- 0.2
net = blockwiseModules(datExpr, power = Power, maxBlockSize = 36000,
TOMType = "unsigned", minModuleSize = 30,
reassignThreshold = 0, mergeCutHeight = CutHeight,
numericLabels = TRUE, pamRespectsDendro = FALSE,
verbose = 3)
mergedColors = labels2colors(net$colors)
#PlotName <- paste0("Modules_", Var, "_", CutHeight , "_",ProjectName, "_",Sys.Date(),".pdf")
#pdf(PlotName)
plotDendroAndColors(net$dendrograms[[1]], mergedColors[net$blockGenes[[1]]],
"Module colors",
dendroLabels = FALSE, hang = 0.03,
addGuide = TRUE, guideHang = 0.05)
#dev.off()
moduleLabels = net$colors
moduleColors = labels2colors(net$colors)
MEs = net$MEs;
geneTree = net$dendrograms[[1]];
We now import the trait data and run some tests.
# Import trait data
traitData = read.csv("C:/Users/Bert/Documents/Work/Papers/Transcriptomics-behavior/Revamped paper/WGCNA/datTraits_50samples_20_xi_2020_thorax.csv");
femaleSamples = rownames(datExpr);
traitRows = match(femaleSamples, traitData$Grasshopper);
datTraits = traitData[traitRows, -1];
rownames(datTraits) = traitData[traitRows, 1];
# PLOT SAMPLE DENDOGRAM AND TRAIT HEAT MAP
# Re-cluster samples
sampleTree2 = hclust(dist(datExpr), method = "average")
# Convert traits to a color representation: white means low, red means high, grey means missing entry
traitColors = numbers2colors(datTraits, signed = FALSE);
# Plot the sample dendrogram and the colors underneath.
plotDendroAndColors(sampleTree2, traitColors,
groupLabels = names(datTraits),
main = "Sample dendrogram and trait heatmap")
We now calculate the correlations between the phenotypic traits and the modules of co-expressed genes
nGenes = ncol(datExpr);
nSamples = nrow(datExpr);
MEs0 = moduleEigengenes(datExpr, moduleColors)$eigengenes
MEs = orderMEs(MEs0)
moduleTraitCor = cor(MEs, datTraits, use = "p");
moduleTraitPvalue = corPvalueStudent(moduleTraitCor, nSamples)
textMatrix = paste(signif(moduleTraitCor, 2), "\n(",
signif(moduleTraitPvalue, 1), ")", sep = "");
dim(textMatrix) = dim(moduleTraitCor)
par(mar = c(6, 8.5, 3, 3));
#PlotName <- paste0("Correlations3_", Var, "_", CutHeight , "_",ProjectName, "_",Sys.Date(),".pdf")
#pdf(PlotName)
labeledHeatmap(Matrix = moduleTraitCor,
xLabels = names(datTraits),
yLabels = names(MEs),
ySymbols = names(MEs),
colorLabels = TRUE,
colors = blueWhiteRed(50),
textMatrix = textMatrix,
setStdMargins = FALSE,
cex.text = 0.14,
zlim = c(-1,1),
xLabelsAngle = 90,
yLabelsAngle = 45,
font.lab.x = 0.5,
font.lab.y = 0.5,
cex.lab.x = 0.5,
cex.lab.y = 0.4,
main = paste("Module-trait relationships")
)
#dev.off()
We can now show the relationship between the different modules.
MEs = moduleEigengenes(datExpr, moduleColors)$eigengenes
Distance = as.data.frame(datTraits$Moved.distance);
names(Distance) = "moved.distance"
MET = orderMEs(cbind(MEs, Distance))
sizeGrWindow(5,7.5);
par(cex = 0.9)
plotEigengeneNetworks(MET, "", marDendro = c(0,4,1,2), marHeatmap = c(3,4,1,2), cex.lab = 0.8, xLabelsAngle
= 90)
sizeGrWindow(6,6);
par(cex = 1.0)
plotEigengeneNetworks(MET, "Eigengene dendrogram", marDendro = c(0,4,2,0),
plotHeatmaps = FALSE)
par(cex = 1.0)
plotEigengeneNetworks(MET, "Eigengene adjacency heatmap", marHeatmap = c(3,4,2,2),
plotDendrograms = FALSE, xLabelsAngle = 90)
Now we export the different modules.
Trait1 = as.data.frame(datTraits$Stimulus.zone.time);
names(Trait1) = "Stimulus zone time"
Trait2 = as.data.frame(datTraits$Non.stimulus.zone.time);
names(Trait2) = "Non stimulus zone time"
Trait3 = as.data.frame(datTraits$Stimulus.wall.time);
names(Trait3) = "Time on stimulus wall"
Trait4 = as.data.frame(datTraits$Moved.distance);
names(Trait4) = "Moved distance"
Trait5 = as.data.frame(datTraits$Female.pronotum.length);
names(Trait5) = "Pronotum length"
Trait6 = as.data.frame(datTraits$Female.F.C);
names(Trait6) = "F/C"
Trait7 = as.data.frame(datTraits$Black.patterning.PCA1);
names(Trait7) = "PC1 Black patterns"
geneTraitSignificance1 = as.data.frame(cor(datExpr, Trait1, use = "p"));
geneTraitSignificance2 = as.data.frame(cor(datExpr, Trait2, use = "p"));
geneTraitSignificance3 = as.data.frame(cor(datExpr, Trait3, use = "p"));
geneTraitSignificance4 = as.data.frame(cor(datExpr, Trait4, use = "p"));
geneTraitSignificance5 = as.data.frame(cor(datExpr, Trait5, use = "p"));
geneTraitSignificance6 = as.data.frame(cor(datExpr, Trait6, use = "p"));
geneTraitSignificance7 = as.data.frame(cor(datExpr, Trait7, use = "p"));
GSPvalue1 = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance1), nSamples));
GSPvalue2 = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance2), nSamples));
GSPvalue3 = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance3), nSamples));
GSPvalue4 = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance4), nSamples));
GSPvalue5 = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance5), nSamples));
GSPvalue6 = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance6), nSamples));
GSPvalue7 = as.data.frame(corPvalueStudent(as.matrix(geneTraitSignificance7), nSamples));
names(geneTraitSignificance1) = paste("GS.", names(Trait1), sep="");
names(GSPvalue1) = paste("p.GS.", names(Trait1), sep="");
names(geneTraitSignificance2) = paste("GS.", names(Trait2), sep="");
names(GSPvalue2) = paste("p.GS.", names(Trait2), sep="");
names(geneTraitSignificance3) = paste("GS.", names(Trait3), sep="");
names(GSPvalue3) = paste("p.GS.", names(Trait3), sep="");
names(geneTraitSignificance4) = paste("GS.", names(Trait4), sep="");
names(GSPvalue4) = paste("p.GS.", names(Trait4), sep="");
names(geneTraitSignificance5) = paste("GS.", names(Trait5), sep="");
names(GSPvalue5) = paste("p.GS.", names(Trait5), sep="");
names(geneTraitSignificance6) = paste("GS.", names(Trait6), sep="");
names(GSPvalue6) = paste("p.GS.", names(Trait6), sep="");
names(geneTraitSignificance7) = paste("GS.", names(Trait7), sep="");
names(GSPvalue7) = paste("p.GS.", names(Trait7), sep="");
modNames = substring(names(MEs), 3)
geneModuleMembership = as.data.frame(cor(datExpr, MEs, use = "p"));
MMPvalue = as.data.frame(corPvalueStudent(as.matrix(geneModuleMembership), nSamples));
names(geneModuleMembership) = paste("MM", modNames, sep="");
names(MMPvalue) = paste("p.MM", modNames, sep="");
geneInfo0 = data.frame(moduleColor = moduleColors,
geneTraitSignificance1, GSPvalue1,
geneTraitSignificance2, GSPvalue2,
geneTraitSignificance3, GSPvalue3,
geneTraitSignificance4, GSPvalue4,
geneTraitSignificance5, GSPvalue5,
geneTraitSignificance6, GSPvalue6,
geneTraitSignificance7, GSPvalue7)
modOrder = order(-abs(cor(MEs, Trait1, use = "p")));
for (mod in 1:ncol(geneModuleMembership)){
oldNames = names(geneInfo0)
geneInfo0 = data.frame(geneInfo0, geneModuleMembership[, modOrder[mod]],
MMPvalue[, modOrder[mod]]);
names(geneInfo0) = c(oldNames, paste("MM.", modNames[modOrder[mod]], sep=""),
paste("p.MM.", modNames[modOrder[mod]], sep=""))
}
geneOrder = order(geneInfo0$moduleColor, -abs(geneInfo0[2]));
geneInfo = geneInfo0[geneOrder, ]
#TableName <- paste0("geneInfo2_", CutHeight , "_", ".txt")
#write.table(geneInfo,TableName,row.names = TRUE, col.names = TRUE, quote = FALSE,sep = '\t')
#for(i in 1:length(modNames)){
# TableName <- paste0(modNames[i], "_", length(which(moduleColors==modNames[i])), "genes_", CutHeight , "_",ProjectName, ".txt")
# write.table(names(datExpr)[moduleColors==modNames[i]],TableName, row.names=FALSE, col.names=FALSE, quote = FALSE)
#}
Finally, we export data for input into VisANT. We are only showing it for the module cyan.
TOM = TOMsimilarityFromExpr(datExpr, power = 6);
module = "cyan";
probes = names(datExpr)
inModule = (moduleColors==module);
modProbes = probes[inModule];
modTOM = TOM[inModule, inModule];
dimnames(modTOM) = list(modProbes, modProbes)
vis = exportNetworkToVisANT(modTOM,
file = paste("VisANTInput-", module, ".txt", sep=""),
weighted = TRUE,
threshold = 0)
sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.4.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Chicago
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] workflowr_1.7.1
loaded via a namespace (and not attached):
[1] vctrs_0.6.5 httr_1.4.7 cli_3.6.2 knitr_1.45
[5] rlang_1.1.3 xfun_0.44 stringi_1.8.4 processx_3.8.4
[9] promises_1.3.0 jsonlite_1.8.8 glue_1.7.0 rprojroot_2.0.4
[13] git2r_0.33.0 htmltools_0.5.8.1 httpuv_1.6.15 ps_1.7.6
[17] sass_0.4.9 fansi_1.0.6 rmarkdown_2.27 jquerylib_0.1.4
[21] tibble_3.2.1 evaluate_0.23 fastmap_1.2.0 yaml_2.3.8
[25] lifecycle_1.0.4 whisker_0.4.1 stringr_1.5.1 compiler_4.3.1
[29] fs_1.6.4 pkgconfig_2.0.3 Rcpp_1.0.12 rstudioapi_0.16.0
[33] later_1.3.2 digest_0.6.35 R6_2.5.1 utf8_1.2.4
[37] pillar_1.9.0 callr_3.7.6 magrittr_2.0.3 bslib_0.7.0
[41] tools_4.3.1 cachem_1.1.0 getPass_0.2-4