Skip to content

Instantly share code, notes, and snippets.

View dacarlin's full-sized avatar

Alex Carlin dacarlin

View GitHub Profile
@dacarlin
dacarlin / parse.md
Last active August 29, 2015 14:01
The story of parse.py

I'm a fan of simplifying code. Yesterday, I wrote a parser that would take a submitted list of single amino acid switch mutations and output a Python object listing each one. It accepted input like

A123F, F343G, H7A

or

A123F+F343G+H7A

with handling for whitespace and different seperators and printed the output. It ran like this:

@dacarlin
dacarlin / gist:aa2090f1cf0c3e624961
Created June 20, 2014 23:42
Magic for running array jobs on Epiphany
#For running a list of jobs in parallel
i=`awk 'NR==n' n=$SGE_TASK_ID list.txt`
[job] $i
@dacarlin
dacarlin / pythag.bash
Created July 5, 2014 23:36
Awk script that lists alpha carbons within a specified distance of an atom
awk -v x=21.810 -v y=40.733 -v z=38.672 '/CA/ { if (((x-$7)^2+(y-$8)^2+(z-$9)^2)^.5<12) {print $6} }' > [save-to-file]
@dacarlin
dacarlin / gist:6afb127d97bf8cc90fe3
Last active August 29, 2015 14:04
soulful-setlist
"That's the way I feel about you" http://www.youtube.com/watch?v=BPMJFqwsi6E
"Worried over you" http://www.youtube.com/watch?v=KufCztMow80
"Waiting in vain" http://www.youtube.com/watch?v=8WQVb_nuKvs
@dacarlin
dacarlin / gist:f9c18e9068aa8ca6e73c
Created July 16, 2014 08:16
To paste last yanked line in vim, regardless of what you've deleted since
"0p
@dacarlin
dacarlin / rc.bash
Created July 27, 2014 00:36
Reverse complement of a nucleotide sequence in Bash
grep '^[atcg]' $1 | rev | tr atcg tagc
@dacarlin
dacarlin / count-terry.bash
Last active August 29, 2015 14:04
Gets the number of jobs Terry's running on Epiphany
# part of the "You can bash that" series ...
qstat -u \* | awk '{print $4}' | tail -n +3 | uniq --count | awk '/teo/ {print $1}'
# and a (slightly) shorter way using only AWK (probably faster)
qstat -u \* | awk 'BEGIN {i = 0}; $NR > 3 && $4 ~ /teo/ {i++}; END {print i}'
@dacarlin
dacarlin / results.bash
Last active August 29, 2015 14:10
Quick results of Rosetta runs
#usage: bash results.bash '<dir> <cst-cutoff>'
sort -r -k1 $1/out/score.sc |awk '$4=="all_cst"||$4<'$2'{print $1, $4, $NF}'| column -t