Skip to content

Instantly share code, notes, and snippets.

Avatar

André F. Rendeiro afrendeiro

View GitHub Profile
@afrendeiro
afrendeiro / series_matrix2csv.py
Created May 26, 2017
GEO Series matrix to project and sample annotations
View series_matrix2csv.py
def series_matrix2csv(matrix_url, prefix=None):
"""
matrix_url: gziped URL with GEO series matrix.
"""
import gzip
import pandas as pd
os.system("wget {}".format(matrix_url))
filename = matrix_url.split("/")[-1]
@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 / flac+cue2mp3.sh
Created Sep 15, 2013
Command-line conversion of flac+cue files to mp3 split tracks
View flac+cue2mp3.sh
#!/bin/sh
# Flacon-style convert to mp3 and split tracks from flac+cue files
# Made by André Rendeiro (afrendeiro@gmail.com)
# Rename
{
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
@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 / process_figures_for_paper.sh
Last active Aug 11, 2020
Convert SVG figures to high quality raster and aggregated pdfs - labeled and unlabeled figures will be produced
View process_figures_for_paper.sh
#!/usr/bin/env bash
# Dependencies:
# 1. inkscape
# 2. pdfunite
# 3. (optinal) minify (https://github.com/tdewolff/minify/tree/master/cmd/minify)
# `sudo apt install minify`
# Assumptions:
# 1. figures are made in SVG format