Code Monkey home page Code Monkey logo

Comments (3)

vertesy avatar vertesy commented on July 20, 2024

Installation

Install proper packages

# 1. Install function libraries ------------------------
if (FALSE) {
  "Run these only once"
  install.packages(tidyverse)
  install.packages(cowplot)
  install.packages(Seurat)
  install.packages(tictoc)
  
  install.packages("devtools"); # If you don't have it
  require("devtools")
  devtools::install_github(repo = "vertesy/MarkdownReportsDev")
}

Installation for custom function libraries is not needed.

Installation is only needed for packages. You only need to load these libraries with the source() command.

There are two ways to load them

  1. source() directly from the web (recommended)
  2. Download locally and source() it from the folder you downloaded to.

You will need these custom function libraries

If the installation of MarkdownReportsDev failed, you can also just source this file.

Load packages

# Load proper packages ---------------------------------------------
require(tidyverse); require(cowplot); require(Seurat); require(stringr); 
require(tictoc); 
library(schex)

# Load custom function libraries ---------------------------------------------
try (source ('https://raw.githubusercontent.com/vertesy/CodeAndRoll/master/CodeAndRoll.R'),silent= F)
try(source('https://raw.githubusercontent.com/vertesy/Seurat.utils/master/00.Load.Seurat.Utils.WEB.R'), silent =   T)
try(source("https://raw.githubusercontent.com/vertesy/ggExpressDev/main/ggExpress.functions.R"), silent = T)
# try(source ('https://raw.githubusercontent.com/vertesy/Seurat.multicore/master/00.Load.Seurat3.Multicore.WEB.R'), silent=T) # Not needed I think
# If it fails, see alternative at the end.

require('MarkdownReportsDev')
# If installation of MarkdownReportsDev did not work:
# try (source ('https://raw.githubusercontent.com/vertesy/MarkdownReportsDev/master/R/MarkdownReportsDev.R'),silent= F)

from seurat.pipeline.

vertesy avatar vertesy commented on July 20, 2024

Example script for visualization

You can also find it on Seurat.utils

######################################################################
# Visualize Single-cell RNA-seq data using a Seurat object
######################################################################
# source ('Visualize.Gene.expression.v2.R')
# rm(list=ls(all.names = TRUE)); try(dev.off(), silent = T)


# 1. Install function libraries ------------------------
if (FALSE) {
  "Run these only once"
  install.packages(tidyverse)
  install.packages(cowplot)
  install.packages(Seurat)
  install.packages(tictoc)
  
  install.packages("devtools"); # If you don't have it
  require("devtools")
  devtools::install_github(repo = "vertesy/MarkdownReportsDev")
}


# 2. Load function libraries ------------------------

# 2a Load proper packages ---------------------------------------------
require(tidyverse); require(cowplot); 
require(Seurat); 
require(tictoc); 
try(library(schex))

require('MarkdownReportsDev')
# If installation of MarkdownReportsDev did not work:
# try (source ('https://raw.githubusercontent.com/vertesy/MarkdownReportsDev/master/R/MarkdownReportsDev.R'),silent= F)

# 2b Load proper packages ---------------------------------------------
try (source ('https://raw.githubusercontent.com/vertesy/CodeAndRoll/master/CodeAndRoll.R'),silent= F)

try(source('https://raw.githubusercontent.com/vertesy/Seurat.utils/master/00.Load.Seurat.Utils.WEB.R'), silent =   T)

try(source("https://raw.githubusercontent.com/vertesy/ggExpressDev/main/ggExpress.functions.R"), silent = T)

# 2c Setup ------------------------
"Where do you want to save the output files?"
OutDir = "~/Downloads/scAnalysis"
setup_MarkdownReports(OutDir = OutDir, scriptname = "Visualize.Gene.expression.v2.R")
OutDirOrig = OutDir


# 3. load Seurat object (sc data) -----------------------------------------------------------------
"Where did you save combined.obj.RDS.gz ?"
combined.obj <- readRDS("path/to/combined.obj.RDS.gz")

# 4. create list of genes (all.genes -----------------------------------------------------------------
recall.all.genes()

# 5. search for genes -----------------------------------------------------------------
"Start typing after all.genes$... and hit TAB for autocomplete"
all.genes$SATB2

# 5b. plot genes -----------------------------------------------------------------
qUMAP(feature = "SATB2", obj = combined.obj)

# 6. find.clustering -----------------------------------------------------------------
"Find clustering result: Start typing after combined.ob$... and hit TAB for autocomplete"
combined.obj$integrated_snn_res.0.5

# 6b. plot clusters -----------------------------------------------------------------
clUMAP(ident = , obj = combined.obj)




# Custom gene sets  --------------------------------------------------------------------------------
SEGA.old = c("HES5", "ID3", "STMN1", "HMGN2", "SLC6A9", "VCAM1", "S1PR1",
             "NOTCH2", "S100A6", "BCAN", "NES", "ATP1A2", "PRDX6", "AGT",
             "ID2", "MYCN", "TMSB10", "DBI", "GAD1", "DLX1", "DLX2", "NEUROD1",
             "MAP2", "IGFBP5", "ACSL3", "PTMA", "SLC6A11", "SLC6A1", "RPL32",
             "RPSA", "SYNPR", "ALDH1L1", "MCM2", "HES1", "FGFR3", "PROM1",
             "HOPX", "SPARCL1", "BMPR1B", "H2AFZ", "CCNA2", "CPE", "SLC1A3",
             "THBS4", "LIX1", "NREP", "ACSL6", "SPARC", "NPM1", "HNRNPAB",
             "ID4", "TFEB", "NR2E1", "GJA1", "FABP7", "MOXD1", "DLL1", "LFNG",
             "SP8", "PPIA", "EGFR", "PTN", "RARRES2", "TMSB4X", "TSPAN7",
             "DCX", "BMP1", "CLU", "SFRP1", "PABPC1", "MYC", "NTRK2", "TNC",
             "RPL12", "CD81", "DKK3", "PAX6", "SLC1A2", "CCND1", "NCAM1",
             "PARD3", "CDK1", "HTRA1", "MKI67", "FOXM1", "CCND2", "CD9", "CDCA3",
             "ENO2", "SLCO1C1", "LDHB", "LIMA1", "CDK2", "RPL41", "HMGA2",
             "ASCL1", "RAN", "TPT1", "ITM2B", "CLDN10", "FOS", "CKB", "NUPR1",
             "TUBB3", "TP53", "AURKB", "ALDOC", "GFAP", "LUC7L3", "TOB1",
             "SOX9", "RBFOX3", "FASN", "MIB1", "AQP4", "PRNP", "PCNA", "JAG1",
             "CST3", "E2F1", "RPL18A", "FXYD1", "DLL3", "APOE", "SMARCB1",
             "MIAT", "OLIG2", "GSTM1", "GPR37L1", "BMP6", "CSPG4", "MT1A",
             "ETNPPL")

# Markers ----------------------------
ClassicMarkers = c(
  "Apical precursor" = 						"SOX2",
  "Stem cells" = 						  		"ID4",
  "Cycling cells" = 							"TOP2A",
  "IPC" = 												"EOMES",
  "IPC.late" = 		 		 		 		 	  "TAC3",
  
  "Astro-like" = 									"S100B",
  "Interneurons, (OPC, MSN)"   = 			"DLX6-AS1",
  "GABA-ergic inter neuron" = 		"GAD2",
  
  "General neuronal" = 						"NEUROD6",
  "CTIP2 " = 	  									"BCL11B",
  "Upper layer " =   										"SATB2",
  "Deep layer neurons" = 					"FEZF2",
  
  "Weird sc gene" = 										"MALAT1",
  "RPL34" = 										"RPL34",
  "Mito" =   										"MT-ATP6",
  "PDK" =   										"PDK1",
  "SLA" = 									    "SLA",
  "IGFBP5" = 										"IGFBP5"
)

from seurat.pipeline.

vertesy avatar vertesy commented on July 20, 2024

Alternative loading of Seurat.utils and Seurat.multicore

Use these, if the first 2 commands under "2. Load function libraries" above return an error

# Alternaitve for SEURAT.UTILS - You can try to load each script individually ------------------------
if (FALSE) {
  "Individual SEURAT.UTILS components"
  "You probably dont need all for your work"
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Seurat.update.gene.symbols.HGNC.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Metadata.manipulation.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Plotting.dim.reduction.2D.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Plotting.dim.reduction.3D.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Plotting.filtering.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Plotting.statistics.and.QC.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Read.Write.Save.Load.functions.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Seurat.object.manipulations.etc.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Cluster.Auto-naming.DE.R"))
  try(source('https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/MULTI-seq.functions.R'))
  try(source('https://raw.githubusercontent.com/vertesy/Seurat.utils/master/Functions/Jaccard.toolkit.R'))
  
}

# Alternaitve for SEURAT.MULTICORE - You can try to load each script individually ------------------------
if (FALSE) {
  " SEURAT.MULTICORE components"
  "You probably dont need these at all for your work"
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.multicore/master/Seurat3.Multicore.Read.Write.R"))
  try(source("https://raw.githubusercontent.com/vertesy/Seurat.multicore/master/Seurat3.Multicore.Generic.Functions.R"))
  
}

from seurat.pipeline.

Related Issues (9)

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.