Skip to content

Instantly share code, notes, and snippets.

@biomadeira
biomadeira / best_coding_practices.ipynb
Last active January 11, 2023 11:21
Example code snippets
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
import random
from datetime import datetime

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o

@biomadeira
biomadeira / auto-deploy.md
Created October 6, 2016 15:22 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@biomadeira
biomadeira / string_matching_naive
Created May 2, 2016 21:20
[Algorithms] Pattern matching in string (from /laurentluce/python-algorithms)
def string_matching_naive(text='', pattern=''):
"""Returns positions where pattern is found in text.
We slide the string to match 'pattern' over the text
O((n-m)m)
Example: text = 'ababbababa', pattern = 'aba'
string_matching_naive(t, s) returns [0, 5, 7]
@param text text to search inside
@param pattern string to search for
@return list containing offsets (shifts) where pattern is found inside text
"""
<script type="text/javascript">
"use strict";
$(function(){
var getTextNodesIn = function(el) {
return $(el).find(":not(iframe)").addBack().contents().filter(function() {
return this.nodeType == 3;
});
\chapter{ProIntVar}\label{Chapter2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Summary}\label{Chapter-Summary}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
In this chapter I will describe in depth the main computational framework developed in this project to allow the study of protein structures, protein sequences and genetic variation. Thus this chapter focuses on the methods developed to process and combine structure and sequence data to enable the study of genetics variant on protein interaction interfaces.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}\label{Chapter-Introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@biomadeira
biomadeira / ensembl_ids_from_chrom_pos
Created December 1, 2015 13:28
Gets Ensembl gene ids from chromosome positions.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import urllib
__author__ = 'Fábio Madeira'
__date__ = '28.05.2015'
@biomadeira
biomadeira / download_all_sets.pl
Last active September 8, 2015 15:28
Modified perl script for updating BIOLIP
#!/usr/bin/perl -w
use strict;
# BIOLIP from Zhang Lab
# http://zhanglab.ccmb.med.umich.edu/BioLiP/
# Folder Structure
# ================
# NOBACK/
@biomadeira
biomadeira / example.py
Created July 17, 2012 14:34
Example code for PyCMA
import pycma
# load alignments
p = pycma.Alignment('example1.fasta','example2.fasta','fasta')
p.number_sequences()
p.length_sequences()
# converting between alignment formats
p.write_alignment(p.alignment1, 'test1.aln', form='clustal')
p.write_alignment(p.alignment2, 'test2.aln', form='clustal')