Skip to content

Instantly share code, notes, and snippets.

import random
import argparse
parser = argparse.ArgumentParser( description="https://www.youtube.com/watch?v=7S94ohyErSw&t=90")
parser.add_argument("-t", "--tests", default=50, type=int, help='The number of tests to average')
parser.add_argument("-tp", "--true_positives", required=True, type=int, help='The actual number of True Positives')
parser.add_argument("-tn", "--true_negatives", required=True, type=int, help='The actual number of True Negatives (Total things - True Positives)')
parser.add_argument("-tpa", "--true_positives_A", required=True, type=int, help='True Positives tool A detects')
parser.add_argument("-fpa", "--false_positives_A", required=True, type=int, help='False Positives tool A detects')
parser.add_argument("-tpb", "--true_positives_B", required=True, type=int, help='True Positives tool B detects')
if [ "`tail -c 28 /path/to/your.bam`" != "`echo -n -e '\x1f\x8b\x08\x04\x00\x00\x00\x00\x00\xff\x06\x00\x42\x43\x02\x00\x1b\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00'`" ]; then echo 'File Truncated'; else echo 'File Good!'; fi
#!/usr/bin/env python3
import os
import csv
import argparse
parser = argparse.ArgumentParser(description='Process output from Mash')
parser.add_argument('-i', '--input', help='input file', metavar='FILE', required=True)
parser.add_argument('-o', '--output', help='output file', metavar='FILE' )
parser.add_argument('-a', '--alias', help='alias file', metavar='FILE' )
parser.add_argument('-n', '--nearness', help='invert distance',action="store_true" )
class stat:
def __init__(self,INFO):
self.DESCRIPTION = ['Demo for harmbrugge', 'ENSMUSG00000051951']
self.LINKABLE = True
self.SQL = 'TEXT'
self.dependencies = ['CHR','POS','SEQ']
self.before = '''
import intervaltree
GTF_chromosomes = {}
with open('/Users/John/Downloads/Mus_musculus.GRCm38.86.gtf','rb') as f:
import sys
reads = sys.argv[1]
index = sys.argv[2]
all_readIDs = set()
# Re-written the code below to only ever read the first row:
with open(reads, "r") as read_file:
while True:
try:
line1 = next(read_file)
import sys
reads = sys.argv[1]
index = sys.argv[2]
# Get all read ids:
all_readIDs = set() # Using a set because it will be quicker to find things in later.
# A list would require python to check every item in the list.
# A set can be thought of as an always-sorted list (elements are added in their sorted order) with no duplication of elements.
# The sorted order is based on the hash() value of the items however, which is essentially a random number.
# Stuff you might have to change depending on your package manager the IP of your client:
# (these settings will work well for EC2 though)
Listen 10.8.0.1
User tinyproxy
Group tinyproxy
# More is better/faster:
MinSpareServers 10
MaxSpareServers 50
StartServers 25
# Non-Windows only:
user nobody
group nogroup
# Common for everything else:
client
dev tun
proto tcp-client
remote 54.152.94.74 443
resolv-retry infinite
# STUFF YOU COULD CHANGE TO REFLECT YOUR SYSTEM BETTER:
export KEY_COUNTRY="UK"
export KEY_PROVINCE="London"
export KEY_CITY="London"
export KEY_ORG="MyVPN"
export KEY_EMAIL="my@email.com"
export KEY_OU="MyVPN"
# STUFF YOU SHOULDNT CHANGE
export EASY_RSA="/etc/openvpn/easy-rsa"
management localhost 6666 # Allows you to telnet into localhost 6666 to see the status. Although openvpn has logs, you can find out a lot more (like who is currently using on the VPN) through the management service
port 443 # By using port 443 for all of our VPN communications, our network traffic will look very similar to standard HTTPS traffic.
client-to-client # Allows two clients of the VPN to talk to one another (home computer to work computer for example)
keepalive 10 120 # Defaults
mssfix # Kept due to Cargo Cult reasons...
proto tcp # udp is faster, but so much less reliable its not worth it. Use TCP.
dev tun # We're making a tunnel so we want to make the tun kind of VPN.
ca ca.crt # we'll make this next
cert server.crt # we'll make this next
key server.key # we'll make this next