Skip to content

Instantly share code, notes, and snippets.

View k3yavi's full-sized avatar
:octocat:
Single Cell Biology

Avi Srivastava k3yavi

:octocat:
Single Cell Biology
View GitHub Profile
suppressPackageStartupMessages({
library(Seurat)
library(Matrix)
library(ggplot2)
library(patchwork)
library(stringr)
library(pbapply)
})
{
library(Seurat)
library(Signac)
library(jsonlite)
tissue_map <- c("2305121", "2305122", "2305123", "2305124",
"V4-A", "V4-B", "V4-C", "V4-D")
names(tissue_map) <- c(2305121, 2305122, 2305123, 2305124, seq(456, 459))
cells <- read.table("/brahms/srivastavaa/chao/visium/visium-v1.txt")$V1
coordinates <- read.table("/brahms/srivastavaa/chao/visium/visium-v1_coordinates.txt")
from __future__ import print_function
import sys
# from https://github.com/lh3/readfq/blob/master/readfq.py
def readfq(fp): # this is a generator function
last = None # this is a buffer keeping the last unprocessed line
while True: # mimic closure; is it a bad idea?
if not last: # the first record or a record following a fastq
for l in fp: # search for the start of the next record
if l[0] in '>@': # fasta/q header line
#include <Rcpp.h>
using namespace Rcpp;
// This is a simple example of exporting a C++ function to R. You can
// source this function into an R session using the Rcpp::sourceCpp
// function (or via the Source button on the editor toolbar). Learn
// more about Rcpp at:
//
// http://www.rcpp.org/
// http://adv-r.had.co.nz/Rcpp.html
# get the data as per https://www.cedricscherer.com/2019/05/17/the-evolution-of-a-ggplot-ep.-1/#code
library(tidyverse)
devtools::source_gist("https://gist.github.com/Z3tt/301bb0c7e3565111770121af2bd60c11")
# convert to data.frame, attach and sort region
df <- as.data.frame(df_ratios)
attach(df)
# get rid of NAs
df <- df[ ! is.na(student_ratio),]
@k3yavi
k3yavi / hmm_test.R
Last active February 11, 2021 15:29
suppressPackageStartupMessages({
library(devtools)
library(Signac)
library(Seurat)
library(Matrix)
library(ggplot2)
library(patchwork)
library(future)
library(dplyr)
library(pbapply)
@k3yavi
k3yavi / plot.R
Last active March 18, 2021 17:14
suppressPackageStartupMessages({
library(Signac)
library(Seurat)
library(Matrix)
library(ggplot2)
library(patchwork)
library(dplyr)
library(RcppRoll)
library(fastmatch)
library(EnsDb.Hsapiens.v86)
@k3yavi
k3yavi / Keybase.md
Created July 4, 2020 13:36
Keybase GitHub identity

Keybase proof

I hereby claim:

  • I am k3yavi on github.
  • I am k3yavi (https://keybase.io/k3yavi) on keybase.
  • I have a public key ASBa3ubEhE7OFhiRP-ivU-tpBGLXhbTUDAkZsbJPfu4eFQo

To claim this, I am signing this object:

@k3yavi
k3yavi / GenerateRefs.R
Last active April 30, 2020 19:09
generate intronic reference using eisaR
library(Biostrings)
library(BSgenome)
library(eisaR)
library(GenomicFeatures)
library(SummarizedExperiment)
library(tximeta)
library(rjson)
library(reticulate)
library(SingleCellExperiment)
library(scater)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.