Skip to content

Instantly share code, notes, and snippets.

View necrolyte2's full-sized avatar

Tyghe Vallard necrolyte2

View GitHub Profile
prefix=$HOME
PYTHON_VERSION=2.7.8
tmpdir=$HOME/tmp-python
rm -rf $tmpdir; mkdir -p $tmpdir
pushd $tmpdir && wget --no-check-certificate https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz -O- | tar xzf - && pushd Python-${PYTHON_VERSION} && ./configure --prefix $prefix && make && make install && popd && popd
@necrolyte2
necrolyte2 / numpy_break.sh
Last active November 15, 2017 15:53
numpy_issue_2434
# Install our own python
prefix=$(mktemp -d)
cd $prefix
version=2.7.8
wget --no-check-certificate https://www.python.org/ftp/python/${version}/Python-${version}.tgz -O- | tar xzf -
cd Python-${version}
./configure --prefix $prefix
make
make install
cd ..
@necrolyte2
necrolyte2 / ncbi_gisaid_parse_merge.py
Created September 25, 2014 20:29
Merge ncbi and gisaid csv files
import re
import os
from os.path import *
import sys
import csv
from datetime import datetime
from collections import defaultdict
import itertools
gisaid_file = 'H3N2_GISAID.csv'
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Hello, world!">
<Require feature="opensocial-0.8"/>
</ModulePrefs>
<Content type="html"><![CDATA[
<script type="text/javascript">
function init() {
document.getElementById("handler").innerHTML = "Hello, world.";
}
@necrolyte2
necrolyte2 / removedup.py
Created October 14, 2014 23:10
Removes duplicate sequence names from fasta file
#!/usr/bin/env python
import sys
from Bio import SeqIO
f = sys.argv[1]
seqs = SeqIO.parse(f,'fasta')
import os
import tempdir
class BaseTester(object):
def setUp(self):
''' Auto enter temporary directory '''
self.tdir = tempdir.TempDir()
os.chdir(self.tdir.name)
@necrolyte2
necrolyte2 / dnaplotter.py
Created November 28, 2014 21:45
Outputs dnaplotter format from a given bam and reference file
#!/usr/bin/env python
import subprocess
import argparse
# Can test with
# python -m doctest dnaplotter.py
def count_ref_bases(reference):
'''
@necrolyte2
necrolyte2 / samba-idle-sleeper
Created February 1, 2015 15:36
pm-suspend system if no samba files are open after some time
#!/bin/bash
# Max amount of idle time in seconds before pm-suspend is invoked
# Default is 1 hour
idlemax=$((60*60))
# Run forever
while [ 1 ]
do
# Keep checking to see if samba has locked files
@necrolyte2
necrolyte2 / fastaqual_too_fastq.py
Last active June 20, 2024 06:14
Convert fasta+qual to fastq. Writes to standard out so you can pipe or use >
#!/usr/bin/env python
import sys
from Bio import SeqIO
from Bio.SeqIO.QualityIO import PairedFastaQualIterator
import argparse
parser = argparse.ArgumentParser()
#! /bin/sh
### BEGIN INIT INFO
# Provides: xbmc
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of XBMC
# Description: starts instance of XBMC using start-stop-daemon and xinit