Skip to content

Instantly share code, notes, and snippets.

View carlosp420's full-sized avatar

Carlos Peña carlosp420

  • Lima
View GitHub Profile
@carlosp420
carlosp420 / recipes.py
Created September 11, 2016 20:06
generate grocery shopping list for a bunch of recipes #food
import json
import yaml
def parse_recipe(recipe, all_ingredients):
for recipe_name, ingredients in recipe.items():
for ingredient in ingredients:
ingredient_name, amount, unit = ingredient
try:
all_ingredients[ingredient_name]['amount'] += amount
@carlosp420
carlosp420 / test_biopython.sh
Last active August 29, 2015 14:09
test BioPython
nosetests --verbosity 2 --with-doctest --with-coverage --cover-html -w Tests --cover-package Bio
@carlosp420
carlosp420 / TNT_treefile_to_NEXUS
Created September 18, 2013 20:18
convert a TNT treefile to NEXUS
#!/usr/bin/perl -w
#this script converts a tree ouput from TNT to NEXUS (1 tree per file)
# Carlos Peña 2011-03-16
use strict;
use Bio::TreeIO;
my $usage = "script.pl INFILE OUTFILE\n";
my $infile = shift or die $usage;
my $outfile = shift or die $usage;
:%s/^/\=line('.')/
@carlosp420
carlosp420 / convert edited file to sed command
Last active December 19, 2015 08:39
for processing Mariannas files. Input should be a csv file
# convert marianna's files into bash commmand
sed 's/\(^[0-9]\+\),\(.\+\),.\+\*\(.\+\)/\3\*\1-\2/g' < Genus.csv > Genus.sh
# first part
sed "s/^/sed -i 's\//g" < Genus.sh
# half
sed "s/*/\//g" < Genu.sh
# last
@carlosp420
carlosp420 / extract from bad ids
Last active December 18, 2015 23:09
extract seq ids from bad_ids.csv file for Marianna
cat bad_ids.csv | grep Agrilus | awk -F ' ' '{print $3 " " $4 "*" $0}' | sort > Agrilus.csv
@carlosp420
carlosp420 / couchdb and lucene
Created April 15, 2013 11:03
commonly used URLs
view:
http://localhost:5984/euptychiina/_design/references/_view/by_time
lucene:
http://localhost:5984/euptychiina/_fti/_design/lucene/by_author?q=Pe*

##GTR lset applyto=() nst=6 # GTR lset applyto=() nst=6 rates=propinv # GTR + I lset applyto=() nst=6 rates=gamma # GTR + gamma lset applyto=() nst=6 rates=invgamma # GTR + I + gamma

##SYM

lset applyto=() nst=6                           # SYM

prset applyto=() statefreqpr=fixed(equal)

@carlosp420
carlosp420 / gist:4332027
Created December 18, 2012 21:08
highlight R code using pygments
pygmentize -O noclasses,style=emacs -o a.html a.R
@carlosp420
carlosp420 / partitioning models Beauti
Last active October 12, 2015 13:28
partitioning models for Beauti
taken from: http://www.robertlanfear.com/partitionfinder/news/
Models in PartitionFinder and how to set them up in BEAST/BEAUti
JC: in Beauti use the GTR with base frequences set to All equal and turn off all operators for parameters.
F81: in BEAUti use the GTR and turn off all operators for parameters
K80: in BEAUti this is “HKY” with “base frequencies” set to “All Equal”
TrNef: in BEAUti this is “TN93” with “base frequencies” set to “All Equal”
SYM: in BEAUti this is “GTR” with “base frequencies” set to “All Equal”
HKY: in BEAUti this is “HKY” with “base frequencies” set to “estimated”