Created
December 17, 2012 12:33
-
-
Save jwaageSnippets/4317970 to your computer and use it in GitHub Desktop.
Convert between human and mouse gene IDs
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
read.delim("/Volumes/BP_NextGen/jwg/Projects/Porse/TET1/homologene.data", stringsAsFactors=F) -> homologene | |
split(homologene, f=homologene[,1]) -> hSplit | |
#Tax ID: Homo 9606 | |
#Mus: 10090 | |
getHumanAndMouseHomologues <- function(x) | |
{ | |
if (c(9606)%in%x[,2]&&c(10090)%in%x[,2]) | |
{ | |
x[x[,2]==9606 | x[,2]==10090,4] -> result | |
result | |
} | |
} | |
lapply(hSplit, FUN=getHumanAndMouseHomologues) -> results | |
results[lapply(results, FUN=length)==2] -> results | |
do.call("rbind", results) -> results | |
results -> mouseHuman | |
colnames(mouseHuman) <- c("homoID", "musID") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment