Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View afrendeiro's full-sized avatar

André F. Rendeiro afrendeiro

View GitHub Profile
@afrendeiro
afrendeiro / stitching_demo.py
Created September 14, 2020 21:42
Reduce and stitch Operetta microscope images
#!/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 23:56
Seaborn clustermap with effortless row and column colorbars
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 15:57
Easier access to pandas.MultiIndex values circumventing get_level_values
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 January 14, 2020 10:59
Build a transcriptome reference with additional chromosomes for CRISPR gRNA constructs
#!/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 October 30, 2019 09:29
This script creates reference genome indexes with mixtures of organisms/assemblies
#!/usr/bin/env python
"""
This script creates reference genomes with mixtures of organisms/assemblies.
"""
import sys
import os
import argparse
@afrendeiro
afrendeiro / make_validate_pdfa_muw.sh
Created September 27, 2019 00:42
An example of how to create an validate a PDF/A compatible file for submission as a thesis at the Medical University of Vienna
#!/usr/bin/bash
# This script details an example of how to create an validate a PDF/A
# compatible PDF file for submission as a thesi at the Medical University
# of Vienna
# It assumes in the working directory there are ${PAPER}.initial.pdf files
# that will make up your cumulative thesis
# The first cause of failure for PDF/A compatibility is the PDFs from your
@afrendeiro
afrendeiro / chipseq_pipeline.py
Created September 26, 2019 09:26
An old pipeline for ChIP-seq/ChIPmentation data processing used back in 2014. Uploading for preservation
#!/usr/bin/env python
"""
ChIP-seq pipeline
"""
from argparse import ArgumentParser
import os
import sys
import logging
@afrendeiro
afrendeiro / distributions_gini_lorenz_curves.py
Created September 19, 2019 07:22
Visualizing the relationship between distributions and gini coefficient with Lorenz curves
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def gini(x):
# Mean absolute difference
mad = np.abs(np.subtract.outer(x, x)).mean()
# Relative mean absolute difference
rmad = mad / np.mean(x)
@afrendeiro
afrendeiro / 10Xfastq_to_bam.py
Last active May 21, 2019 14:31
Convert 10X FASTQ files to single end BAM file with barcodes annotated as tags. Useful for pipelines using BAM format as input (e.g. STAR mapping, featureCounts quantification)
#! /usr/bin/env python
"""
Convert 10X FASTQ files to single end BAM file with barcodes annotated as tags
"""
from argparse import ArgumentParser
from glob import glob
@afrendeiro
afrendeiro / keybase.md
Created March 12, 2019 08:27
keybase confirmation

Keybase proof

I hereby claim:

  • I am afrendeiro on github.
  • I am afrendeiro (https://keybase.io/afrendeiro) on keybase.
  • I have a public key ASCLj9Mi9QyGyaS_Ez-M1L2daTExlulKnwG2ltgD_v_mNwo

To claim this, I am signing this object: