Skip to content

Instantly share code, notes, and snippets.

View dosorio's full-sized avatar

Daniel Osorio dosorio

View GitHub Profile
@dosorio
dosorio / makeDocking.R
Last active April 15, 2021 15:12
makeDocking.R
args = commandArgs(trailingOnly=TRUE)
proteins <- list.files(args[1], full.names = "TRUE")
ligands <- list.files(args[2], full.names = "TRUE")
nRun <- 10
seedValues <- c(6, 12, 18)
# proteins <- list.files("proteins/", full.names = TRUE)
# ligands <- list.files("ligands/", full.names = TRUE)
@dosorio
dosorio / SC-3-05.R
Last active December 2, 2022 09:03
SC-3-05.R
# Install Packages
install.packages('scTenifoldNet')
BiocManager::install('monocle')
install.packages('reticulate')
library(reticulate)
reticulate::install_miniconda()
reticulate::conda_install(packages = 'scipy', envname = 'scipy')
reticulate::use_condaenv('scipy')
@dosorio
dosorio / SC-02-27.R
Last active February 27, 2020 16:59
SC-02-27
# Review
# https://genomebiology.biomedcentral.com/articles/10.1186/s13059-019-1850-9
# Install Harmony
library(devtools)
install_github("immunogenomics/harmony")
# Install SVA
BiocManager::install('sva')
@dosorio
dosorio / SC-02-20.R
Last active February 20, 2020 15:58
SC-02-20
# Install Packages
install.packages(c('devtools','ggplot2'))
BiocManager::install(c('fgsea', 'MAST', 'ensembldb', 'GenomeInfoDb'))
devtools::install_github('cailab-tamu/scTypeGSEA')
# Loading libraries
library(Seurat)
library(MAST)
library(ggplot2)
library(scTypeGSEA)
@dosorio
dosorio / SC-2-13.R
Last active February 13, 2020 16:43
SC-2-13
# Loading Seurat
library(Seurat)
# Moving to downloads
setwd("../Downloads/")
# Getting the input files from 10X Genomics
inputFile <- "http://cf.10xgenomics.com/samples/cell-exp/3.0.0/pbmc_1k_protein_v3/pbmc_1k_protein_v3_filtered_feature_bc_matrix.tar.gz"
download.file(inputFile, "PBMC.tar.gz")
untar("PBMC.tar.gz")
@dosorio
dosorio / installManiNetCluster.R
Created August 26, 2019 22:02
Commands to install ManiNetCluster in Windows 64bit
devtools::install_github("namtk/ManiNetCluster" ,INSTALL_opts=c("--no-multiarch"))
setwd("../Downloads/")
# BiocManager::install(c('TFBSTools', 'ggbio', 'motifmatchr',
# 'BSgenome','BSgenome.Hsapiens.UCSC.hg19',
# 'EnsDb.Hsapiens.v75','hdf5r'))
# devtools::install_github("timoast/signac")
library(Signac)
library(Seurat)
library(GenomeInfoDb)
library(EnsDb.Hsapiens.v75)
library(ggplot2)
source("https://raw.githubusercontent.com/dosorio/utilities/master/idConvert/hsa_SYMBOL2ENTREZ.R")
source("https://raw.githubusercontent.com/dosorio/utilities/master/enrichments/hsa_KEGG_ENTREZ.R")
setwd("../Downloads/")
# 1K Cells
download.file("http://cf.10xgenomics.com/samples/cell-exp/3.0.0/pbmc_1k_v3/pbmc_1k_v3_filtered_feature_bc_matrix.tar.gz", destfile = "PBMC1K.tar.gz")
# 10K Cells
download.file("http://cf.10xgenomics.com/samples/cell-exp/3.0.0/pbmc_10k_v3/pbmc_10k_v3_filtered_feature_bc_matrix.tar.gz", destfile = "PBMC10K.tar.gz")
setwd("../Downloads/")
# Getting the input files from 10X Genomics
inputFile <- "http://cf.10xgenomics.com/samples/cell-exp/3.0.0/pbmc_1k_protein_v3/pbmc_1k_protein_v3_filtered_feature_bc_matrix.tar.gz"
download.file(inputFile, "PBMC.tar.gz")
untar("PBMC.tar.gz")
#Input Folder
inputFolder <- "filtered_feature_bc_matrix/"
@dosorio
dosorio / readSalmonAlevin.R
Created February 20, 2019 21:27
Function to read the binary output of salmon alevin in R (single-cell RNA-seq)
readSalmonAlevin <- function(alevinFolder){
matrixFile <- paste0(alevinFolder, "/quants_mat.gz")
matrixFile <- gzfile(description = matrixFile, open = 'rb')
genes <- readLines(paste0(alevinFolder,"/quants_mat_cols.txt"))
cells <- readLines(paste0(alevinFolder,"/quants_mat_rows.txt"))
n <- length(genes)*length(cells)
counts <- readBin(matrixFile,what = 'numeric', n = n)
close.connection(matrixFile)
countMatrix <- matrix(data = counts,
nrow = length(cells),