Skip to content

Instantly share code, notes, and snippets.

Avatar

André F. Rendeiro afrendeiro

View GitHub Profile
@afrendeiro
afrendeiro / upload_zipfiles_to_box.py
Created Feb 1, 2021
Upload content of zipfiles to box.com programmatically
View upload_zipfiles_to_box.py
#!/usr/bin/env python
"""
Upload images inside zip files to box.com.
"""
import sys, time, webbrowser, json, zipfile, tempfile, urllib3
from argparse import ArgumentParser
from pathlib import Path
from typing import Dict, List, Generator
@afrendeiro
afrendeiro / dog_ex.py
Created Dec 29, 2020 — forked from leonidk/dog_ex.py
difference of gaussians example in python
View dog_ex.py
from skimage import data, feature, color, filters, img_as_float
from matplotlib import pyplot as plt
original_image = img_as_float(data.chelsea())
img = color.rgb2gray(original_image)
k = 1.6
plt.subplot(2,3,1)
@afrendeiro
afrendeiro / nih_grant_link_eracommons.md
Last active Dec 28, 2020
Linking NIH grant number to publications in NCBI/eRA Commons
View nih_grant_link_eracommons.md
@afrendeiro
afrendeiro / series_matrix2csv.py
Created Dec 10, 2020
Get a GEO series matrix file describing an experiment and parse it into project level and sample level data.
View series_matrix2csv.py
#!/usr/bin/env python
"""
Get a GEO series matrix file describing an experiment and
parse it into project level and sample level data.
"""
import os
from typing import Tuple, Union
import tempfile
@afrendeiro
afrendeiro / get_gene_set_libraries.py
Last active Nov 30, 2020
Download gene set libraries from Enrichr in GMT format for ssGSEA - done in parallel with async
View get_gene_set_libraries.py
from pathlib import Path
import parmap
import requests
def update(gsll):
return [g for g in gsll if not (output_dir / (g + ".gmt")).exists()]
@afrendeiro
afrendeiro / stitching_demo.py
Created Sep 14, 2020
Reduce and stitch Operetta microscope images
View stitching_demo.py
#!/usr/bin/env python
"""
Max-reduce and stitch microscopy images into one stitched one.
Requirements:
`pip install numpy matplotlib tifffile`
"""
from pathlib import Path
@afrendeiro
afrendeiro / seaborn_clustermap_with_effortless_colorbars_decorator.ipynb
Last active May 14, 2020
Seaborn clustermap with effortless row and column colorbars
View seaborn_clustermap_with_effortless_colorbars_decorator.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@afrendeiro
afrendeiro / easier_pandas_multiindex_getitem.py
Last active May 11, 2020
Easier access to pandas.MultiIndex values circumventing get_level_values
View easier_pandas_multiindex_getitem.py
import pandas as pd
import seaborn as sns
class Loc:
def __init__(self, pandas_obj):
self._obj = pandas_obj
def __getitem__(self, x):
return pd.Index(self._obj.index.to_frame().loc[x])
@afrendeiro
afrendeiro / guides_to_ref.py
Created Jan 14, 2020
Build a transcriptome reference with additional chromosomes for CRISPR gRNA constructs
View guides_to_ref.py
#!/usr/bin/env python
"""
This script generates a transcriptome reference with additional
scaffolds/chromosomes for CRISPR gRNA constructs.
"""
import sys
import os
from argparse import ArgumentParser
@afrendeiro
afrendeiro / create_reference_genome_mixtures.py
Last active Oct 30, 2019
This script creates reference genome indexes with mixtures of organisms/assemblies
View create_reference_genome_mixtures.py
#!/usr/bin/env python
"""
This script creates reference genomes with mixtures of organisms/assemblies.
"""
import sys
import os
import argparse