Skip to content

Instantly share code, notes, and snippets.

View ivirshup's full-sized avatar
💭
🫠

Isaac Virshup ivirshup

💭
🫠
View GitHub Profile
@ivirshup
ivirshup / featureCount_stats.txt
Created October 12, 2016 02:31
featureCount$stats from running Rsubread multiple times with R v3.3.1 and Rsubread v1.22.3. R was compiled with gcc v4.4.7.
Status SRR950078 SRR950079 SRR950080 SRR950081 SRR950082 SRR950083 SRR950084 SRR950085 SRR950086 SRR950087
1 Assigned 771600 758170 771620 782006 709176 769418 762469 775637 817422 811414
2 Unassigned_Ambiguity 0 0 0 0 0 0 0 0 0 0
3 Unassigned_MultiMapping 0 0 0 0 0 0 0 0 0 0
4 Unassigned_NoFeatures 143539 140245 137103 142209 129824 146504 131665 144008 107762 122946
5 Unassigned_Unmapped 81716 98620 88046 72146 157535 80385 102452 76928 71142 62661
6 Unassigned_MappingQuality 3145 2965 3231 3639 3465 3693 3414 3427 3674 2979
7 Unassigned_FragmentLength 0 0 0 0 0 0 0 0 0 0
8 Unassigned_Chimera 0 0 0 0 0 0 0 0 0 0
9 Unassigned_Secondary 0 0 0 0 0 0 0 0 0 0
from subprocess import run, PIPE
import requests
import pandas as pd
from pathlib import Path
BASE_URL = "http://imlspenticton.uzh.ch/robinson_lab/conquer/"
def curl(inpth, outpth=None):
command = ["curl", str(inpth)]
if outpth:
@ivirshup
ivirshup / gen_h5ad.py
Created May 4, 2018 21:43
scanpy scaling issue
import matplotlib
matplotlib.use('Agg') # plotting backend compatible with screen
import scanpy.api as sc
from argparse import ArgumentParser
sc.settings.verbosity = 4 # show logging output
def main():
parser = ArgumentParser(
description="Reads in 10x hdf5 file and write a h5ad file.")
@ivirshup
ivirshup / mean_var_test.py
Created May 28, 2018 05:09
Profiling memory usage of `scanpy`'s `_get_mean_var`.
import scanpy
import scanpy.api as sc
import numpy as np
from scipy import random, sparse
from time import sleep
import sklearn.utils.sparsefuncs as sparsefuncs
@profile
def current_dense(X):
return scanpy.preprocessing.simple._get_mean_var(X)
@ivirshup
ivirshup / hv_coloring.py
Created September 4, 2018 07:40
Switching between categorical and continuous Dynamic Map coloring (not working)
import holoviews as hv
import numpy as np
import pandas as pd
hv.extension("bokeh")
# Generate data
base_df = pd.DataFrame({
"x": np.random.randn(100), "y": np.random.randn(100),
"cat1": np.random.randint(0, 5, 100), "cat2": np.random.randint(0, 5, 100),
"con1": np.random.randn(100), "con2": np.random.randn(100)})
@ivirshup
ivirshup / centos6_environment.yml
Created October 12, 2018 08:10
Scanpy scatter plotting circles
name: scanpy_scatter_ring
channels:
- defaults
- r
- bioconda
- conda-forge
dependencies:
- anndata=0.6.10=py_0
- igraph=0.7.1=hcc8e21d_5
- louvain=0.6.1=py36hfc679d8_1
@ivirshup
ivirshup / Pipfile.lock
Created October 24, 2018 01:42
scanpy_pipfile 12:42:35 PM Oct 24, 2018
{
"_meta": {
"hash": {
"sha256": "aa4e26d643aa1ae7337e67cf9da430773141ac3e9930891ae0862d948e73b6d5"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.6"
},
"sources": [
@ivirshup
ivirshup / ids_as_index.py
Created February 14, 2019 06:28
Set `adata.var_names` to be ids not names. Based on default reading of 10x h5 files
def fix_names(adata):
adata.var_names_make_unique()
adata.var["gene_symbols"] = adata.var.index
adata.var.index = adata.var["gene_ids"]
@ivirshup
ivirshup / download_expression_atlas.py
Created February 17, 2019 13:18
Get AnnData from expression atlas
import anndata
from scipy import sparse
import pandas as pd
import numpy as np
from pathlib import Path
from tqdm import tqdm
from urllib.request import urlretrieve
from zipfile import ZipFile
@ivirshup
ivirshup / download_expression_atlas.py
Last active February 17, 2019 13:27
Get AnnData from expression atlas
import anndata
from scipy import sparse
import pandas as pd
import numpy as np
from pathlib import Path
from tqdm import tqdm
from urllib.request import urlretrieve
from zipfile import ZipFile