-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
NathanSkene
committed
Jan 17, 2018
0 parents
commit b8bb71f
Showing
68 changed files
with
2,122 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"allow_restart":true,"alt_buffer":false,"autoclose":0,"buffered_output":"","caption":"Terminal 1","channel_id":"4424","channel_mode":1,"child_procs":false,"cols":233,"cwd":"~/Box Sync/One2One","exit_code":null,"handle":"C707850D","interaction_mode":2,"max_output_lines":1000,"restarted":false,"rows":23,"shell_type":7,"show_on_output":false,"terminal_sequence":1,"title":"~/Box Sync/One2One","track_env":true,"zombie":false}] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[ | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"path" : "~/Box Sync/One2One", | ||
"sortOrder" : [ | ||
{ | ||
"ascending" : true, | ||
"columnIndex" : 2 | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"activeTab" : 1 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"left" : { | ||
"panelheight" : 1302, | ||
"splitterpos" : 442, | ||
"topwindowstate" : "NORMAL", | ||
"windowheight" : 1340 | ||
}, | ||
"right" : { | ||
"panelheight" : 1302, | ||
"splitterpos" : 804, | ||
"topwindowstate" : "NORMAL", | ||
"windowheight" : 1340 | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"TabSet1" : 3, | ||
"TabSet2" : 0, | ||
"TabZoom" : { | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build-last-errors="[]" | ||
build-last-errors-base-dir="~/Box Sync/One2One/" | ||
build-last-outputs="[{\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source One2One\\n\\n\",\"type\":0},{\"output\":\"\\n\",\"type\":1},{\"output\":\"Attaching package: ‘dplyr’\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"The following objects are masked from ‘package:base’:\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\" intersect, setdiff, setequal, union\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"Attaching package: ‘reshape’\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"The following object is masked from ‘package:dplyr’:\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\" rename\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* installing to library ‘/Users/ns9/Library/R/3.4/library’\\n\",\"type\":1},{\"output\":\"* installing *source* package ‘One2One’ ...\\n\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"** data\\n\",\"type\":1},{\"output\":\"*** moving datasets to lazyload DB\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** preparing package for lazy loading\\n\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"** installing vignettes\\n\",\"type\":1},{\"output\":\"** testing if installed package can be loaded\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"Attaching package: ‘dplyr’\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"The following objects are masked from ‘package:base’:\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\" intersect, setdiff, setequal, union\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"Attaching package: ‘reshape’\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"The following object is masked from ‘package:dplyr’:\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\" rename\\n\",\"type\":1},{\"output\":\"\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"* DONE (One2One)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]" | ||
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}" | ||
files.monitored-path="" | ||
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":false,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}" | ||
imageDirtyState="1" | ||
saveActionState="-1" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/var/folders/qk/f3p79d9523j3kjt3qkrcn0k0000csj/T//RtmpDvBPYI/preview-ac89254985f9.html | ||
/var/folders/qk/f3p79d9523j3kjt3qkrcn0k0000csj/T//RtmpDvBPYI/preview-aca3478a6aa3.html | ||
/private/var/folders/qk/f3p79d9523j3kjt3qkrcn0k0000csj/T/RtmpDvBPYI/preview-aaaecd300f1.dir/introduction.html | ||
/private/var/folders/qk/f3p79d9523j3kjt3qkrcn0k0000csj/T/RtmpDvBPYI/preview-aaae70e2d4ca.dir/introduction.html | ||
/private/var/folders/qk/f3p79d9523j3kjt3qkrcn0k0000csj/T/RtmpDvBPYI/preview-aaae3c0053ac.dir/introduction.html |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"active_set":"","sets":[]} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cursorPosition" : "0,0", | ||
"scrollLine" : "0", | ||
"tempName" : "Untitled1" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cursorPosition" : "17,0", | ||
"scrollLine" : "0" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cursorPosition" : "7,32", | ||
"scrollLine" : "0", | ||
"tempName" : "Untitled1" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cursorPosition" : "9,84", | ||
"scrollLine" : "0" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cursorPosition" : "19,0", | ||
"scrollLine" : "0" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cursorPosition" : "11,0", | ||
"scrollLine" : "0" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cursorPosition" : "16,90", | ||
"scrollLine" : "0", | ||
"tempName" : "Untitled1" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cursorPosition" : "0,0", | ||
"scrollLine" : "0", | ||
"tempName" : "Untitled1" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cursorPosition" : "3,22", | ||
"scrollLine" : "0" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cursorPosition" : "15,0", | ||
"scrollLine" : "0" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"cursorPosition" : "201,13", | ||
"scrollLine" : "169" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
~%2FBox%20Sync%2FOne2One%2FR%2Fanalyse.orthology.r="D0B6B8F6" | ||
~%2FBox%20Sync%2FOne2One%2FR%2Fcheck.species.r="2CDB7A0E" | ||
~%2FBox%20Sync%2FOne2One%2FR%2Fdata.r="65C16CFC" | ||
~%2FBox%20Sync%2FOne2One%2FR%2Fget.symbol.from.homologID.r="96B2425D" | ||
~%2FBox%20Sync%2FOne2One%2FR%2Fhello.R="111BEC64" | ||
~%2FBox%20Sync%2FOne2One%2FR%2Fload.homologs.r="4B5F1197" | ||
~%2FBox%20Sync%2FOne2One%2FReadme.Rmd="758A0F0B" | ||
~%2FBox%20Sync%2FOne2One%2Fvignettes%2Fintroduction.Rmd="DF9713E5" | ||
~%2FDatasets%20that%20are%20too%20large%20to%20store%20elsewhere%2FDisease%20Transcriptomes%2FALS%2FRegenerate_Human_Bootstrap_Plots.r="E5A941A8" | ||
~%2FDatasets%20that%20are%20too%20large%20to%20store%20elsewhere%2FSOD1%20Spinal%20Cord%20(GSE18597)%2FRegenerating_Bootstrap_Plots.r="6677BA5D" | ||
~%2FDatasets%20that%20are%20too%20large%20to%20store%20elsewhere%2FSOD1%20Spinal%20Cord%20(GSE18597)%2Fgenerate.bootstrap.plots.for.transcriptome_SOD1.r="F05B7023" | ||
~%2FGoogle%20Drive%2FDiseaseEnrichment%2Fget.vertebrate.homologs.r="369E48E6" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"collab_server" : "", | ||
"contents" : "", | ||
"created" : 1516132633447.000, | ||
"dirty" : false, | ||
"encoding" : "UTF-8", | ||
"folds" : "", | ||
"hash" : "0", | ||
"id" : "25C317CE", | ||
"lastKnownWriteTime" : 1516202508, | ||
"last_content_update" : 1516202508625, | ||
"path" : "~/Box Sync/One2One/R/analyse.orthology.r", | ||
"project_path" : "R/analyse.orthology.r", | ||
"properties" : { | ||
"cursorPosition" : "0,0", | ||
"scrollLine" : "0", | ||
"tempName" : "Untitled1" | ||
}, | ||
"relative_order" : 6, | ||
"source_on_save" : false, | ||
"source_window" : "", | ||
"type" : "r_source" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#' Analyse orthology between two species | ||
#' | ||
#' Returns a table of 1:1 orthologs along with gene sets (in Homologene ID format) detailing how genes differ between the two species | ||
#' | ||
#' @param species1 String with the name of the first species, i.e. "mouse" | ||
#' @param species2 String with the name of the second species, i.e. "human" | ||
#' @param allHomologs Output of load.homologs() function | ||
#' | ||
#' @return List. The most important thing is orthologs_one2one. | ||
#' | ||
#' @examples | ||
#' ortholog_data = analyse.orthology("human","mouse") | ||
#' | ||
#' @export | ||
analyse.orthology <- function(species1="mouse",species2="human",allHomologs=allHomologs){ | ||
library(dplyr) | ||
library(magrittr) | ||
#species1 = "mouse" | ||
#species2 = "human" | ||
|
||
species1 = check.species(requestedSpecies=species1,allSpecies=allHomologs$`Common Organism Name`) | ||
species2 = check.species(requestedSpecies=species2,allSpecies=allHomologs$`Common Organism Name`) | ||
|
||
species1_srt = gsub(",.*","",species1) | ||
species2_srt = gsub(",.*","",species2) | ||
|
||
hom_vert = allHomologs[allHomologs$`Common Organism Name` %in% c(species1,species2),c("HomoloGene ID","Common Organism Name","Symbol")] %>% unique | ||
species1_hom = hom_vert[hom_vert$`Common Organism Name`==species1,] %>% dplyr::rename(species1.symbol=Symbol) | ||
species2_hom = hom_vert[hom_vert$`Common Organism Name`==species2,] %>% dplyr::rename(species2.symbol=Symbol) | ||
colnames(species1_hom)[3]=sprintf("%s.symbol",species1_srt) | ||
colnames(species2_hom)[3]=sprintf("%s.symbol",species2_srt) | ||
allHomologsInSpecies = merge(species1_hom[,c(1,3)],species2_hom[,c(1,3)],by="HomoloGene ID",all=TRUE) | ||
|
||
species1_allGenes = unique(species1_hom$`HomoloGene ID`) | ||
species2_allGenes = unique(species2_hom$`HomoloGene ID`) | ||
total_numS1genes = length(species1_allGenes) | ||
total_numS2genes = length(species2_allGenes) | ||
print(sprintf("Full dataset contains %s genes from %s",total_numS1genes,species1_srt)) | ||
print(sprintf("Full dataset contains %s genes from %s",total_numS2genes,species2_srt)) | ||
|
||
# Keep only genes which are expressed in both species | ||
shared_genes = intersect(species1_hom$`HomoloGene ID`,species2_hom$`HomoloGene ID`) | ||
species1_sharedHom = species1_hom[species1_hom$`HomoloGene ID` %in% shared_genes,] | ||
species2_sharedHom = species2_hom[species2_hom$`HomoloGene ID` %in% shared_genes,] | ||
|
||
# Find genes which were deleted in one species | ||
species1_present_species2_deleted = setdiff(species1_allGenes,shared_genes) | ||
species2_present_species1_deleted = setdiff(species2_allGenes,shared_genes) | ||
print(sprintf("%s genes which are present in %s are deleted in %s",length(species1_present_species2_deleted),species1_srt,species2_srt)) | ||
print(sprintf("%s genes which are present in %s are deleted in %s",length(species2_present_species1_deleted),species2_srt,species1_srt)) | ||
|
||
# Get frequency of genes being duplicated | ||
species1_freq = data.frame(table(species1_hom$`HomoloGene ID`)) %>% dplyr::rename(HomoloGene.ID=Var1) | ||
species2_freq = data.frame(table(species2_hom$`HomoloGene ID`)) %>% dplyr::rename(HomoloGene.ID=Var1) | ||
species1_freq = species1_freq[order(species1_freq$Freq,decreasing = TRUE),] | ||
species2_freq = species2_freq[order(species2_freq$Freq,decreasing = TRUE),] | ||
species1_duplicated_homoloID = as.character(species1_freq[species1_freq$Freq>1,]$HomoloGene.ID) | ||
species2_duplicated_homoloID = as.character(species2_freq[species2_freq$Freq>1,]$HomoloGene.ID) | ||
print(sprintf("%s genes are duplicated in %s",length(species1_duplicated_homoloID),species1_srt)) | ||
print(sprintf("%s genes are duplicated in %s",length(species2_duplicated_homoloID),species2_srt)) | ||
|
||
# Drop genes that have more than one entry per species | ||
species1_onceOnly = species1_freq %>% dplyr::filter(Freq==1) %>% .[,"HomoloGene.ID"] %>% as.character() | ||
species2_onceOnly = species2_freq %>% dplyr::filter(Freq==1) %>% .[,"HomoloGene.ID"] %>% as.character() | ||
oncePerSpecies = intersect(species1_onceOnly,species2_onceOnly) | ||
species1_121 = species1_sharedHom[species1_sharedHom$`HomoloGene ID` %in% oncePerSpecies,] | ||
species2_121 = species2_sharedHom[species2_sharedHom$`HomoloGene ID` %in% oncePerSpecies,] | ||
colnames(species1_121)[3]=sprintf("%s.symbol",species1_srt) | ||
colnames(species2_121)[3]=sprintf("%s.symbol",species2_srt) | ||
|
||
# Which genes are duplicated in one species, but not the other | ||
species1_onceOnly_species2_dup = intersect(species1_onceOnly,species2_duplicated_homoloID) | ||
species2_onceOnly_species1_dup = intersect(species2_onceOnly,species1_duplicated_homoloID) | ||
species2_dup_species1_dup = intersect(species2_duplicated_homoloID,species1_duplicated_homoloID) | ||
|
||
# Get merged listing of 1:1 homologs | ||
merged_homologs = merge(species1_121[,c(1,3)],species2_121[,c(1,3)],by="HomoloGene ID") | ||
print(sprintf("%s are shared 1:1 between the two species",dim(merged_homologs)[1])) | ||
|
||
# Prepare results | ||
allRes = list() | ||
allRes$orthologs_all = allHomologsInSpecies | ||
allRes$orthologs_one2one = merged_homologs | ||
allRes$species1_allGenes = species1_allGenes | ||
allRes$species2_allGenes = species2_allGenes | ||
allRes$shared_genes = shared_genes | ||
allRes$species1_present_species2_deleted = species1_present_species2_deleted | ||
allRes$species2_present_species1_deleted = species2_present_species1_deleted | ||
allRes$species1_onceOnly_species2_dup = species1_onceOnly_species2_dup | ||
allRes$species2_onceOnly_species1_dup = species2_onceOnly_species1_dup | ||
allRes$species2_dup_species1_dup = species2_dup_species1_dup | ||
return(allRes) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"collab_server" : "", | ||
"contents" : "", | ||
"created" : 1516203298776.000, | ||
"dirty" : false, | ||
"encoding" : "UTF-8", | ||
"folds" : "", | ||
"hash" : "0", | ||
"id" : "39BAB851", | ||
"lastKnownWriteTime" : 1516203522, | ||
"last_content_update" : 1516203522633, | ||
"path" : "~/Box Sync/One2One/R/get.symbol.from.homologID.r", | ||
"project_path" : "R/get.symbol.from.homologID.r", | ||
"properties" : { | ||
"cursorPosition" : "16,90", | ||
"scrollLine" : "0", | ||
"tempName" : "Untitled1" | ||
}, | ||
"relative_order" : 8, | ||
"source_on_save" : false, | ||
"source_window" : "", | ||
"type" : "r_source" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#' Get gene symbol from homologID | ||
#' | ||
#' Most outputs of this package are in the format of homolog IDs. To be useful they need to be converted to gene symbols. This functon does that. | ||
#' | ||
#' @param homoIDs The list of homolog IDs to be converted to gene symbols | ||
#' @param species1 String with the name of the first species, i.e. "mouse" | ||
#' @param species2 String with the name of the second species, i.e. "human" | ||
#' @param ortholog_data Output of analyse.orthology() function | ||
#' @param symbol_species The name of the species for which gene symbols should be returned. I.e. "mouse" | ||
#' | ||
#' @return List. The gene symbols equivilenet to homolog IDs in homoIDs | ||
#' | ||
#' @examples | ||
#' allHomologs = load.homologs() | ||
#' ortholog_data = analyse.orthology("human","mouse",allHomologs) | ||
#' homoIDs_bg = ortholog_data$species2_allGenes | ||
#' symbols_bg = get.symbol.from.homologID(homoIDs_bg,"human","mouse",ortholog_data,"mouse") | ||
#' | ||
#' @export | ||
get.symbol.from.homologID <- function(homoIDs,species1,species2,ortholog_data,symbol_species){ | ||
# Which species do the symbols need to be returned from? I.e. MGI or HGNC symbols? | ||
whichSpecies = which(c(species1,species2)==symbol_species)+1 | ||
if(length(whichSpecies)==0){stop("ERROR: symbol_species must be the same as either species1 or species2")} | ||
# These are the gene symbols: | ||
symbols = ortholog_data$orthologs_all[ortholog_data$orthologs_all$`HomoloGene ID` %in% homoIDs,whichSpecies] | ||
return(unique(symbols)) | ||
} |
Oops, something went wrong.