Skip to content

Instantly share code, notes, and snippets.

View rahulbhadani's full-sized avatar
🎯
Panda boy! 🍫

Rahul Bhadani rahulbhadani

🎯
Panda boy! 🍫
View GitHub Profile
@rahulbhadani
rahulbhadani / UMAP_viz.py
Last active June 24, 2020 09:22
UMAP Visualization
import umap
import zipfile
import urllib.request
import pandas as pd
import umap
urllib.request.urlretrieve("https://ftp.ncbi.nlm.nih.gov/geo/samples/GSM2230nnn/GSM2230760/suppl/GSM2230760_human4_umifm_counts.csv.gz", 'GSM2230760_human4_umifm_counts.csv.gz')
data = pd.read_csv('GSM2230760_human4_umifm_counts.csv.gz')
data.drop(columns='Unnamed: 0', inplace=True)
data.set_index("barcode", inplace=True)
@rahulbhadani
rahulbhadani / read_csv.r
Created August 2, 2020 08:24
Reading CSV file with header and rownames in R.
folder = "/home/ivory/VersionControl/scRNASeq/python-notebook/"
file = "FilteredCount.csv"
filepath = paste(folder, file, sep="")
csv = read.csv(filepath, sep=",", row.names = 1, header= TRUE)
mat = as.matrix(csv)
@rahulbhadani
rahulbhadani / scDOC.R
Last active August 3, 2020 06:00
Using scDoc Imputation
# Installing scDoc from source
install.packages("https://github.com/anlingUA/scDoc/blob/master/scDoc_0.0.0.9.tar.gz?raw=true", repo=NULL, type="source")
library(scDoc)
data(zebrafish)
# Used when estimating dropout
offsets <- as.numeric(log(colSums(zebrafish)))
# Filtering step
count <- zebrafish[rowSums(zebrafish > 5) > 4, ]
@rahulbhadani
rahulbhadani / read_cellranger.R
Created August 4, 2020 07:12 — forked from slowkow/read_cellranger.R
Read Cell Ranger HDF5 .h5 files in R
# install.packages(c("Matrix", "rhdf5", "tidyverse"))
library(Matrix)
library(rhdf5)
library(tidyverse)
library(glue)
my_h5_files <- Sys.glob(
"path/to/cellranger-per-channel/output/*/filtered_feature_bc_matrix.h5"
)

Migrating from SVN to GitHub

This gist explains the detail of migrating from SVN to Git. I have had a significant portion of my research work, paper, and source code in Subversion (SVN) since 2015. Recently we decided to migrate everything to GitHub private repository. I am detailing the steps below in case that will be helpful.

Checkout your code from SVN

svn co https://svn.engr.arizona.edu/svn/jms/jmsgroup/trunk/wildcat wildcat_SVN

This will save the subversion code in wildcat_SVN. Run following inside wildcat_SVN directory to get the list of author information who have committed so far.

@rahulbhadani
rahulbhadani / read_bag.md
Last active October 8, 2020 23:04
Requisite for reading rosbag files in Python

Requisite for reading rosbag files in Python

If you are interested in reading bag files in python, you will need to install bagpy package. I recommend using virtual environment for installation.

Prerequisite

  1. Ubuntu
  2. Python 3.6 or higher preferred, might work with other versions of python but not tested on them.

Creating virtual environment

@rahulbhadani
rahulbhadani / read_bag_MATLAB.md
Last active January 27, 2024 07:31
Reading bag files in MATLAB

Reading bag files in MATLAB

MATLAB provides toolbox for reading bag files in a number of ways. For MATLAB Version 2019a and beyond, ROS Toolbox is required for reading bag files. For earlier version upto 2016a, Robotic System Toolbox is required.

I have also written a high-level wrapper for reading and visualizing some widely known topics by a few API calls only. Details are described below:

Using MATLAB Toolbox to read bag files

Start MATLAB by typing matlab in the terminal if you use Linux or double click MATLAB icon if you are using windows.

@rahulbhadani
rahulbhadani / GitCommitEmoji.md
Created October 12, 2020 20:30 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@rahulbhadani
rahulbhadani / graham_hull.py
Created October 15, 2020 06:13 — forked from arthur-e/graham_hull.py
Graham's scan convex hull algorithm, updated for Python 3.x
def convex_hull_graham(points):
'''
Returns points on convex hull in CCW order according to Graham's scan algorithm.
By Tom Switzer <[email protected]>.
'''
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0)
def cmp(a, b):
return (a > b) - (a < b)
@rahulbhadani
rahulbhadani / gps.csv
Last active November 12, 2020 02:32
GPS Sample
Time Status Long Lat Alt
1593297862 A -82.4233398 36.372966 485.2
1593297862 A -82.4233182 36.3729487 485.3
1593297863 A -82.4232962 36.3729313 485.3
1593297863 A -82.4232743 36.3729142 485.3
1593297863 A -82.4232523 36.3728975 485.4
1593297863 A -82.4232302 36.3728802 485.4
1593297863 A -82.423208 36.3728633 485.5