Skip to content

Instantly share code, notes, and snippets.

View MurphyMarkW's full-sized avatar
🔨
probably breaking DNS

mark MurphyMarkW

🔨
probably breaking DNS
  • Precision Neuroscience
  • Chicago, IL
View GitHub Profile
@MurphyMarkW
MurphyMarkW / reverse_complement.py
Created February 11, 2016 04:05
Quick little demo of reverse complementing a DNA sequence.
#!/usr/bin/env python
import string
import argparse
TRANSLATION = string.maketrans('actgACTG', 'tgacTGAC')
def reverse_complement(s):
return s.translate(TRANSLATION)[::-1]
@MurphyMarkW
MurphyMarkW / upload.py
Created January 4, 2016 18:30
Example simply boto upload.
#!/usr/bin/env python
import os
import sys
import json
import logging
import argparse
import boto
import boto.s3.connection
@MurphyMarkW
MurphyMarkW / set_public_read.py
Created November 6, 2015 19:53
Example setting key public read.
#!/usr/bin/env python
import json
import logging
import argparse
import boto
import boto.s3.connection
if __name__ == '__main__':
@MurphyMarkW
MurphyMarkW / multipart_upload.py
Last active November 5, 2015 22:51
Example multipart uploader from stdin.
#!/usr/bin/env python
import sys
import json
import mmap
import logging
import argparse
import boto
import boto.s3.connection
@MurphyMarkW
MurphyMarkW / has-qc-failed.py
Created October 29, 2015 22:15
Simply pysam script to check for the presence of qc-failed reads.
#!/usr/bin/env python
import pysam
def is_qc_failed_record(r):
'''
For a given pysam.AlignedSegment return True if it is QC failed.
Otherwise, return False.
'''
@MurphyMarkW
MurphyMarkW / ds3auth.py
Last active October 27, 2015 14:40
Amazon S3 authorization for DS3 API.
import hmac
import time
import base64
import hashlib
import requests
try: # Python 2.x
import urlparse as parser
except ImportError: # Python 3.x
@MurphyMarkW
MurphyMarkW / bam_record_filter.py
Created September 23, 2015 23:34
Example filtering of bam records using pysam.
#!/usr/bin/env python
import argparse
import pysam
# For standalone execution, add filters here.
# Must take one positional argument.
# Must return True if record is to be rejected.
@MurphyMarkW
MurphyMarkW / last.hs
Created August 26, 2015 22:36
Trying to understand Haskell...
-- This will eat memory and eventually crash / get killed...
last [1..]
-- While this will spin, but not allocate memory as it goes.
last' [] = error "empty list"
last' [a] = a
last' (a:as) = last' as
@MurphyMarkW
MurphyMarkW / gist:78d2518e4ad81718db96
Created May 18, 2015 22:13
Sample boto-based multipart upload.
#!/usr/bin/env python
import json
import logging
import boto
import boto.s3.connection
if __name__ == '__main__':
import argparse
#!/usr/bin/env python
import logging
def test(conn, bucket):
keys = conn.get_bucket(bucket).list()
for key in keys:
logging.info('{} {}'.format(bucket, key.name))