Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
bkamapantula / chart-images.md
Last active April 24, 2020 03:15
images for charts

repository for images

@bkamapantula
bkamapantula / sit-ins-map.py
Created February 10, 2020 12:51
Draw India sit-ins map
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import geopandas
import matplotlib.pyplot as plt
import matplotlib.image as image
@bkamapantula
bkamapantula / india-legislative-assembly-seats.json
Last active February 6, 2020 16:27
Legislative assembly seats by state, central government party.
[
{
"Region": "South",
"Name": "Andhra Pradesh",
"Seats": 175,
"Central-Govt-Party": 0,
"Each": 1
},
{
"Region": "NE",
@bkamapantula
bkamapantula / machine.js
Created November 1, 2019 16:00
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bkamapantula
bkamapantula / README.md
Last active April 23, 2017 17:00
OLPC map redesign
@bkamapantula
bkamapantula / about_data.md
Last active March 6, 2017 07:13
Aadhaar enrollment data

About data

Aadhaar enrollments on a given date and pincode combination are grouped together and represented in the dataset.

Here, the enrollment data is divided into X no. of buckets by the aadhaar data operator. Each row represents information about a single enrollment (of a person) except the last four columns. The value in mobile_number_provided and email_provided for a row will always be less than or equal to the value in aadhaar_generated or rejected column. Consider the following example row from the dataset:

20150420,Allahabad Bank,A-Onerealtors Pvt Ltd,Uttar Pradesh,Ambedkar Nagar,Akbarpur,224155,F,22,5,0,0,5

Here, the last four columns represent: aadhaar_generated, rejected, mobile_number_provided, email_provided. 5 for aadhaar_generated field represents 5 aadhaar generations, 0 rejections, 0 enrollments with mobile number and 5 enrollments with email information.

@bkamapantula
bkamapantula / r_geo_metadata.R
Last active April 28, 2016 14:43
Use GEOquery to get cell type data via GSM accession ID
# requires GEOquery package to be installed
# writes output to stdout
# for more metadata, check the respective classes at http://rileylab.bio.umb.edu/sites/g/files/g1314676/f/201403/GEOquery.pdf
library(GEOquery)
gsm_ids <- c("GSM409307", "GSM1220601", "GSM1120314", "GSM1120315", "GSM1112815", "GSM1112816", "GSM1112817", "GSM1112818", "GSM410808")
for(iter in seq_along(gsm_ids)) {
gds <- getGEO(gsm_ids[iter])
cat(gsm_ids[iter], Meta(gds)$title)
@bkamapantula
bkamapantula / geo_metadata.ipynb
Created April 28, 2016 00:38
Gets metadata of GSM accession using GEOmetadb.sqlite
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bkamapantula
bkamapantula / heatmap.py
Last active April 1, 2016 23:19
Heatmap of pandas dataframe in using matplotlib - notebook
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
# %matplotlib inline
mpl.style.use('ggplot')
df = pd.read_csv("chr_19_H2BK12ac_result.txt", sep="\t")
plt.pcolor(df[['run_1', 'run_2', 'run_3', 'run_4', 'run_5']], cmap='RdBu', norm=mpl.colors.LogNorm())
@bkamapantula
bkamapantula / commands.sh
Last active August 8, 2016 11:03
Useful bash commands
# gets fileName.ext from /path/to/fileName.ext. if it's /path/to, it gets 'to'
file_name_w_ext=$(basename "$1")
# gets fileName from the given file
file_name="${file_name_w_ext%.*}"
# gets directory path
file-path=$(dirname "$1")
# collapse multiple columns into a single column (leaving the first column)
awk '{for(i=2;i<=NF;i++) {print $i}}' infile.txt > infile_col_collapse.txt