Skip to content

Instantly share code, notes, and snippets.

View dosorio's full-sized avatar

Daniel Osorio dosorio

View GitHub Profile
@dosorio
dosorio / install_sybilSBML.sh
Last active August 1, 2023 19:34
Commands to install sybilSBML R package on MacOS/Linux
wget https://downloads.sourceforge.net/project/sbml/libsbml/5.17.0/stable/libSBML-5.17.0-core-plus-packages-src.tar.gz
tar -xxvf libSBML-5.17.0-core-plus-packages-src.*
cd libSBML-5.17.0-Source
./configure --prefix=/usr/local/ \
--enable-cpp-namespace \
--enable-fbc \
--enable-shared \
--with-gnu-ld \
--enable-layout \
--enable-comp \
@dosorio
dosorio / epub2kindle
Created March 10, 2018 01:11
Convert EPUB to KINDLE
for f in *.epub
do
anytomobi --dest-profile=Kindle "$files"
done
@dosorio
dosorio / kernelPCA.m
Created April 26, 2018 16:36
VIBS613 Presentation - Kernel PCA
clear all; clc;
%% How PCA works - Data
rng(0);
data(:,1) = randn(30,1);
data(:,2) = 3.4 + 1.2 * data(:,1);
data(:,2) = data(:,2) + 0.2*randn(size(data(:,1)));
data = sortrows(data,1);
figure
axes('LineWidth',0.6,...
@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),
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/"
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/")
# 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)
@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"))
@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 / 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)