Created
January 6, 2022 19:11
-
-
Save timedreamer/c5823027a7b00bd431b1f245f6b81701 to your computer and use it in GitHub Desktop.
Test using different Regulator or Targets in GENIE3, do I get the same output. It depends. Regulator-No; Target-Yes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test on GENIE3 whether | |
# (Q1) if using more genes as regulator, for the same regulator-target edge | |
# do I get the same order? No. The edge order will be different. | |
# (Q2) if using more genes as targets, for the same regulator-target edges, | |
# do I get the same order? Yes. The same edge will have the exact same weight. | |
# Author: Ji Huang | |
# Date: 2021-01-06 | |
# 0. Prep ----------------------------------------------------------------- | |
library(GENIE3) | |
library(tidyverse) | |
exprMatr <- matrix(sample(1:10, 1000, replace=TRUE), | |
ncol=20) | |
rownames(exprMatr) <- paste("Gene", 1:nrow(exprMatr), sep="") | |
colnames(exprMatr) <- paste("Sample", 1:ncol(exprMatr), sep="") | |
head(exprMatr) | |
# 1. Answer Q1 ------------------------------------------------------------ | |
regulators <- c(1:10) | |
set.seed(123) | |
weightMat <- GENIE3(exprMatr, regulators=regulators) | |
linkList1 <- getLinkList(weightMat) | |
#head(linkList1) | |
head(linkList1 %>% filter(regulatoryGene == "Gene4")) | |
regulators <- c(1:20) | |
set.seed(123) | |
weightMat <- GENIE3(exprMatr, regulators=regulators) | |
linkList2 <- getLinkList(weightMat) | |
linkList2_filter <- linkList2 %>% | |
filter(regulatoryGene %in% linkList1$regulatoryGene ) | |
head(linkList2_filter %>% filter(regulatoryGene == "Gene4")) | |
# 2. Answer Q2 ------------------------------------------------------------ | |
regulators <- c(1:10) | |
targets <- c(1:20) | |
set.seed(123) | |
weightMat <- GENIE3(exprMatr, regulators=regulators, | |
targets = targets) | |
linkList1 <- getLinkList(weightMat) | |
head(linkList1) | |
regulators <- c(1:10) | |
targets <- c(1:30) | |
set.seed(123) | |
weightMat <- GENIE3(exprMatr, regulators=regulators, | |
targets = targets) | |
linkList2 <- getLinkList(weightMat) | |
linkList2_filter <- linkList2 %>% | |
filter(targetGene %in% linkList1$targetGene) | |
head(linkList2_filter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment