Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukauskas
lukauskas / lux-api-Series-unique-bug.ipynb
Created March 15, 2022 12:36
A gist illustrating the lux bug for pd.Series unique function
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukauskas
lukauskas / snippets.md
Last active November 24, 2021 17:10
Code-snippets that I google every day.

Initialisation of notebook (suitable for print)

%config InlineBackend.figure_format = 'retina'
%matplotlib inline
import os
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
@lukauskas
lukauskas / parse_sbml_stoichiometry.py
Last active June 7, 2021 04:12
Parse SBML stoichiometry matrix
from __future__ import print_function
import libsbml
import argparse
def _parser():
parser = argparse.ArgumentParser(description="Parse stoichiometry matrix of SBML file")
parser.add_argument('file', metavar="filename", type=argparse.FileType('r'),
help="Filename of SBML file to parse")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Cavadas et al., Scientific Reports, 2016 Supplements

This gist pre-processes supplementary data from Cavadas et al. paper in Scientific Reports, citation below:

Cavadas, M.A.S., Mesnieres, M., Crifo, B., Manresa, M.C., Selfridge, A.C., Keogh, C.E., Fabian, Z., Scholz, C.C., Nolan, K.A., Rocha, L.M.A., et al. (2016). REST is a hypoxia-responsive transcriptional repressor. Sci Rep-Uk 6, 31355

Each of the notebooks downloads the data directly from the journal, converts it into an easier-to-work tsv format, and augments it with uniprot, ensembl and entrez identifiers.

The notebooks make extensive use of MyGene.info which can be cited as:

@lukauskas
lukauskas / a-scipy-1.6.1-slow-spermanr-with-nans.ipynb
Last active March 13, 2021 09:09
Gist for degraded performance of spearmanr in scipy 1.6.1, issue https://github.com/scipy/scipy/issues/6654
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukauskas
lukauskas / deeeptools-matrix-to-dataframe.md
Last active November 12, 2020 19:15
Converting deeptools matrix to a pandas dataframe

Converting deeptools matrix to pd.DataFrame

import matplotlib

# Deeptools will mess with matplotlib settings, fix that
_mpl_backend = matplotlib.rcParams['backend']
from deeptools.heatmapper import heatmapper as deeptools_heatmapper
matplotlib.use(_mpl_backend)
del _mpl_backend
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.