Skip to content

Instantly share code, notes, and snippets.

View fransua's full-sized avatar
🐜
epigenomiking

Francois Serra fransua

🐜
epigenomiking
  • Computational Biology - BSC
  • Barcelona, Spain
  • 19:55 (UTC +02:00)
  • X @fransua_serra
View GitHub Profile
@fransua
fransua / search_palindromes.py
Created November 8, 2012 18:47
searchs for potential loops in single strand sequences
"""
08 Nov 2012
"""
from string import maketrans
REV = maketrans('ATGC', 'TACG')
@fransua
fransua / ascii_plot.py
Last active March 5, 2020 23:13
simple ascii plot in python
from math import log, exp
def ascii_plot (ydata, xdata=None, logscale=False, pch='o', title='plot',
xlabel='X', ylabel='Y', width=72, height=50):
"""
Curve (ASCII format).
:param ydata: list of values to be plotted
:param None xdata: x coordinate corresponding to ydata. If None will range
from matplotlib import pyplot as plt
import numpy as np
def dist_sort(dists, ext=None, done=None, verbose=False):
"""
sort keys of an input dictionary of dictionaries (half matrix of distances)
put closest together
:param None ext: used by the recursion, first and last value of ordered list
:param None done: used by the recursion, ordered list of keys
@fransua
fransua / figure_1.png
Created March 9, 2016 21:29 — forked from daler/LICENSE
Plot chromosome ideograms along with other genomic data
figure_1.png
@fransua
fransua / seq_logo.py
Last active July 6, 2017 13:45
Sequence logo drawer
from matplotlib import pyplot as plt
import numpy as np
from itertools import izip_longest
def seq_logo(seqs, title='', axe=None, quality=1, plot=True, ylim=(0, 2), lwmodif=1.25,
errorbar=True, savefig=None):
"""
Draw a sequence motif according to an input list of sequences,
https://en.wikipedia.org/wiki/Sequence_logo
@fransua
fransua / plot_eteTree.py
Last active April 25, 2024 03:43
use matplotlib to draw phylogenetic trees from ETE3
from itertools import chain
from matplotlib.collections import LineCollection
from matplotlib import markers
from matplotlib.path import Path
import numpy as np
from ete3 import Tree, NodeStyle
@fransua
fransua / DNA-helix.py
Last active May 20, 2019 14:26
Simple Gene track plot from Ensembl mart export
from matplotlib.collections import LineCollection
from matplotlib.colors import to_rgb
from matplotlib import pyplot as plt
import numpy as np
def draw_DNA_helix(bp=50, major_groove=22, minor_groove=12, bp_per_turn=10.5,
fig_height=1.5, colors=('red', 'black'), savefig=None, fig_format='png'):
"""
@fransua
fransua / Gene_track.ipynb
Last active April 26, 2021 16:31
Simple Gene track plot from Ensembl mart export
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fransua
fransua / Explain Genome.ipynb
Created June 26, 2019 14:40
Tutorials/Courses/Generic/Explain Genome.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fransua
fransua / notebook_mem_usage.py
Created June 27, 2019 12:57 — forked from aiguofer/README.md
Find out how much memory each of the jupyter notebooks running on a server is using. Helpful for knowing which ones to shut down. Original code from http://stackoverflow.com/questions/34685825/jupyter-notebook-memory-usage-for-each-notebook
import argparse
import re
import subprocess
import pandas as pd
import psutil
import requests
import tabulate
kernel_regex = re.compile(r".+kernel-(.+)\.json")