Coder Social home page Coder Social logo

sctpn's Introduction

Introduction

scPCN infers gene regulation network from scRNAseq data using partical correlation network and TFs binding. In the first step a consensus GRN is built as the average of PCNs based on sampled data; next TFs bindings are searched on the promoter sequences by position weight matrix (PWM) mutually, in the final step edges in consensus PCN without bindings in neither of promoter seqs are removed.

Install

Install from github.

remotes::install_github("ccshao/scTPN")

Examples

Install and load necessary packages.

library(ggplot2)
library(patchwork)
library(magrittr)
library(data.table)
library(tidygraph)
library(ggraph)
library(future)
library(doFuture)
library(org.Mm.eg.db)
library(TxDb.Mmusculus.UCSC.mm10.knownGene)
library(BSgenome.Mmusculus.UCSC.mm10)
library(scTPN)

#- Parallel computing
registerDoFuture()
plan(multicore, workers = 4)

Load the example TFs expression matrix. Data are sampled from Zeisel A, et al., 2015, followed by normalization and log2 transformation. pcn is used to get the consensus network.

data(example_mtx)
set.seed(42)
pcn_net <- pcn(example_mtx)

We prepare the genome info to identify TFs bindings.

gene_db  <- org.Mm.eg.db::org.Mm.egSYMBOL2EG
txdb     <- TxDb.Mmusculus.UCSC.mm10.knownGene::TxDb.Mmusculus.UCSC.mm10.knownGene
bsgenome <- BSgenome.Mmusculus.UCSC.mm10::BSgenome.Mmusculus.UCSC.mm10

#- The symmetric TFs bindings matrix, values indicate number of bound TF PWMs (one TF might have multiple PWMs.)
tf_mtx    <- pwm_pred(pcn_net, "Mmusculus", gene_db, bsgenome, txdb)
#- Binarize the matrix, converting the item with binding to 1.
tf_mtx_bi <- tf_mtx
tf_mtx_bi[tf_mtx_bi > 0] <- 1

#- Constrainted network by TF bindings.
pcn_reg <- pcn_net * tf_mtx_bi

tg_1 <- as_tbl_graph(pcn_net, directed = FALSE) %>%
  activate(edges) %>%
  mutate(sign_corr = ifelse(sign(weight) == 1, "Posi", "Nega"))

#- partial correlatio network regulized by TFs info.
tg_2 <- as_tbl_graph(pcn_reg, directed = FALSE) %>%
  activate(edges) %>%
  mutate(sign_corr = ifelse(sign(weight) == 1, "Posi", "Nega"))

mycol <- as.character(palette.colors(10, "Tableau"))

p01 <- ggraph(tg_1) +
  geom_edge_link0(aes(color = sign_corr, width = abs(weight))) +
  geom_node_point(size = 3) +
  geom_node_text(aes(label = name), repel = TRUE, size = 2) +
  theme_graph() +
  ggtitle("Filtered by pdaj") +
  scale_edge_colour_manual(values = mycol) +
  scale_edge_width(range = c(0.5, 2))

p02 <- ggraph(tg_2) +
  geom_edge_link0(aes(color = sign_corr, width = abs(weight))) +
  geom_node_point(size = 3) +
  geom_node_text(aes(label = name), repel = TRUE, size = 2) +
  theme_graph() +
  ggtitle("Filtered by pdaj and TFs bindings") +
  scale_edge_colour_manual(values = mycol) +
  scale_edge_width(range = c(0.5, 2))

q01 <- p01 / p02

image

sctpn's People

Contributors

ccshao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.