Snippets

Dénes Türei Translate OmniPath interactions from human to turqoise killifish

Updated by Dénes Türei

File killi_omnipath.R Modified

  • Ignore whitespace
  • Hide word diff
 
 human_killi_gs <-
     human_killi %>%
-    select(human_genesymbol, killi_genesymbol) %>%
-    filter(!is.na(human_genesymbol) & !is.na(killi_genesymbol)) %>%
+    select(
+        human_genesymbol,
+        killi_genesymbol
+    ) %>%
+    filter(
+        !is.na(human_genesymbol) &
+        !is.na(killi_genesymbol)
+    ) %>%
     distinct
 
 killi_uniprot <-
Created by Dénes Türei

File killi_omnipath.R Added

  • Ignore whitespace
  • Hide word diff
+#!/usr/bin/env Rscript
+
+# Denes Turei (turei.denes@gmail.com) 2022
+
+library(OmnipathR)
+library(dplyr)
+library(rlang)
+
+killi <- 105023L
+
+human_killi <-
+    ensembl_orthology(
+        organism_b = killi,
+        attrs_a = 'external_gene_name',
+        attrs_b = 'associated_gene_name'
+    ) %>%
+    select(
+        human_ensg = ensembl_gene_id,
+        human_genesymbol = external_gene_name,
+        killi_ensg = b_ensembl_gene,
+        confidence = b_orthology_confidence,
+        type = b_orthology_type,
+        killi_genesymbol = b_associated_gene_name
+    ) %>%
+    distinct %>%
+    mutate(record_id = 1L:n()) %>%
+    translate_ids(
+        human_genesymbol = genesymbol,
+        human_uniprot = uniprot
+    ) %>%
+    translate_ids(
+        killi_ensg = ensg,
+        killi_uniprot = trembl,
+        organism = !!killi,
+        ensembl = TRUE
+    ) %>%
+    translate_ids(
+        killi_ensg = ensg,
+        killi_genesymbol_2 = genesymbol,
+        organism = !!killi,
+        ensembl = TRUE
+    )
+
+human_killi_gs <-
+    human_killi %>%
+    select(human_genesymbol, killi_genesymbol) %>%
+    filter(!is.na(human_genesymbol) & !is.na(killi_genesymbol)) %>%
+    distinct
+
+killi_uniprot <-
+     human_killi %>%
+     select(killi_genesymbol, killi_uniprot) %>%
+     filter(!is.na(killi_uniprot)) %>%
+     distinct
+
+killi_omnipath <-
+    import_omnipath_interactions() %>%
+    mutate(interaction_record = 1L:n()) %>%
+    inner_join(
+        human_killi_gs,
+        by = c('source_genesymbol' = 'human_genesymbol')
+    ) %>%
+    select(-source_genesymbol, -source) %>%
+    left_join(killi_uniprot, by = 'killi_genesymbol') %>%
+    rename(
+        source = killi_uniprot,
+        source_genesymbol = killi_genesymbol
+    ) %>%
+    inner_join(
+        human_killi_gs,
+        by = c('target_genesymbol' = 'human_genesymbol')
+    ) %>%
+    select(-target_genesymbol, -target) %>%
+    left_join(killi_uniprot, by = 'killi_genesymbol') %>%
+    rename(
+        target = killi_uniprot,
+        target_genesymbol = killi_genesymbol
+    ) %>%
+    relocate(
+        source,
+        target,
+        source_genesymbol,
+        target_genesymbol
+    )
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.