Skip to content

Instantly share code, notes, and snippets.

View phantomas1234's full-sized avatar
🤙

Nikolaus Sonnenschein phantomas1234

🤙
View GitHub Profile
@phantomas1234
phantomas1234 / decompartmentalize.py
Created September 2, 2016 07:46
Decompartmentalize models
from cameo import Model, Reaction
from re import sub
def decompartmentalize(model, rules=None):
if rules is None:
rules = {}
compartmentless_model = Model()
for reaction in model.reactions:
new_reaction = reaction.copy()
new_reaction.clear_metabolites()
new_metabolites = {}
@phantomas1234
phantomas1234 / AnimatedMarkerProgress.py
Created March 30, 2016 11:59
AnimatedMarkerProgress.py
import time
from IProgress import ProgressBar, RotatingMarker, UnknownLength, AnimatedMarker
from IProgress.widgets import FormatLabel
FormatLabel
pbar = ProgressBar(widgets=[AnimatedMarker(markers="◐◓◑◒")])
pbar.start()
for i in range(30):
time.sleep(.1)
pbar.update(i)
syntax enable
#PBS -S /bin/bash
#PBS -l nodes={n/2}:ppn=2
#PBS -l walltime=3:00:00,pvmem=10GB
#PBS -N ipc
#PBS -q usplanck
#PBS -j oe
#PBS -o ipc.out
#PBS -A usplanck
#PBS -V
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!
@phantomas1234
phantomas1234 / workspace.m
Created February 17, 2014 12:52
Save notebook specific workspaces in Mathematica
saveWorkspace[path_String:"/Users/niko/tmp"]:=Module[{fileName},
fileName=StringJoin[Sequence@@Riffle[{"Workspace",ToString@Hash[Flatten[List@@("FileName"/.NotebookInformation[])[[1;;2]]],"MD5"],ToString[Round[AbsoluteTime[]]],".mx"},"_"]];
DumpSave[FileNameJoin[{path,fileName}],"Global`"];
];
loadWorkspace[path_String:"/Users/niko/tmp"]:=Module[{currentNotebookHash,paths},
currentNotebookHash=ToString@Hash[Flatten[List@@("FileName"/.NotebookInformation[])[[1;;2]]],"MD5"];
paths=SortBy[ToExpression[StringSplit[#,"_"][[-2]]]->#&/@FileNames["Workspace*"<>currentNotebookHash<>"*.mx",{path}],First];
Get[paths[[-1,2]]];
];
Process: Python [62083]
Path: /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 2.7.5 (2.7.5)
Code Type: X86-64 (Native)
Parent Process: Python [62077]
Responsible: Python [62077]
User ID: 502
Date/Time: 2014-01-16 13:42:13.065 +0100
@phantomas1234
phantomas1234 / .pdbrc
Created January 11, 2014 17:16 — forked from reebalazs/.pdbrc
from PdbSublimeTextSupport import preloop, precmd
pdb.Pdb.preloop = preloop
pdb.Pdb.precmd = precmd
try:
from ipdb.__main__ import Pdb as ipdb_Pdb
except ImportError:
pass
else:
@phantomas1234
phantomas1234 / .gitignore
Last active December 25, 2015 06:18
D3 strain lineage + timeline
.DS_Store
strains.csv
strain_lineage.nb
@phantomas1234
phantomas1234 / _.md
Created September 10, 2013 17:58
Testvar svg = d3.select("svg") .append("svg:g") var line = svg.selectAll("g.line") .data(lines) .enter().append("svg:g") .attr("class", "line") .each(lineenter);