Last active
January 10, 2020 12:01
-
-
Save pcantalupo/0591eddd817bb626608f5505c3c4ced1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| library(lsa) | |
| list1 = c("g1","g2","g3","g4") | |
| list2 = c("g3","g4","g5","g6","g1") | |
| u = union(list1,list2) | |
| u | |
| a = as.numeric(u %in% list1) | |
| a | |
| b = as.numeric(u %in% list2) | |
| b | |
| lsa::cosine(a,b) | |
| # with up or downregulation | |
| list1 = c("g1-u","g2-d","g3-d","g4-u","g5-u") | |
| list2 = c("g3-d","g4-u","g5-d","g6-u","g1-d") | |
| u = union(list1,list2) | |
| u | |
| a = as.numeric(u %in% list1) | |
| a | |
| b = as.numeric(u %in% list2) | |
| b | |
| lsa::cosine(a,b) | |
| # standardizing values like Harmonizome | |
| genes = c("MKI67", "CCNE1", "TP53", "KPNA6") | |
| log2foldchange = c(2.5, 3, -2, 0.1) | |
| pvalue = c(0.0001, 0.003, 0.0000057, 0.2) # the pvalues associated with each log2 fold change | |
| logged = -log10(pvalue) | |
| stdvals = logged * sign(log2foldchange) # change sign of each pvalue to indicate if gene is up or down regulated | |
| stdvals | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment