Skip to content

Instantly share code, notes, and snippets.

View KHerb's full-sized avatar

Karl Herbine KHerb

  • Thomas Jefferson University
View GitHub Profile
@KHerb
KHerb / aa.py
Last active July 20, 2016 20:41
Compares AA sequences of homologous proteins (ie mutant & wild-type)
__AUTHOR__ = 'KARL HERBINE'
AA = {'LYS':'K', 'ALA':'A', 'ARG':'R', 'ASN':'N', 'ASP':'D','CYS':'C','GLU':'E', 'GLY':'G','HIS':'H', 'ILE':'I','LEU':'L','MET':'M', 'PHE':'F', 'PRO':'P', 'SER':'S', 'THR':'T', 'TRP':'W', 'TYR':'Y','VAL':'V','GLN':'Q'}
CHAINS = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
print 'Amino Acid Sequence differences'.center(100,' ')
print 'This Python script is useful for comparing AA sequences between two polypeptides (eg. Mutant vs Wild-Type)'
print 'NOTE: SOME HOMOLOGOUS STRUCTURES MAY NOT CONTAIN SAME NUMBER OF RESIDUES'.center(100,' ')
pdb1 = str(raw_input("Enter the name of the first pdb file (name.pdb): "))
pdb2 = str(raw_input("Enter the name of the second pdb file (name.pdb): "))
@KHerb
KHerb / guess3.py
Created July 18, 2016 02:22
guess3.py
import random
from random import randint
print "Welcome to guess a number 2.0 - This time I will try to guess a number that YOU pick in a range (0 - number)"
number = int(raw_input("What range would you like? (0 - ?) "))
def guess_game(number):
guess = randint(0,number)
new_list = [i for i in range(0,number+1)]
validate = raw_input("Is your number %d? (y/n) " % guess)
turn = 1
while validate == 'n':
@KHerb
KHerb / mo3.py
Last active July 14, 2016 14:32
Prints mac of three entered numbers
print "Enter '3' numbers to return the maximum of all three!"
one = int(raw_input("Enter your 'first' number: "))
two = int(raw_input("Enter your 'second' number: "))
three = int(raw_input("Enter your 'third' number: "))
max_of_3 = []
max_of_3.append(one), max_of_3.append(two), max_of_3.append(three)
max_of_3.sort()
print "The max number is:" ,max_of_3[2]
@KHerb
KHerb / guess2.py
Last active November 10, 2016 05:31
Guessing Game 2.0
import random
from random import randint
print "Welcome to guess a number 2.0 - This time I will try to guess a number that YOU pick in a range (0-100)"
def guess_game():
guess = randint(0,100)
new_list = [i for i in range(0,101)]
validate = raw_input("Is your number %d? (y/n)" % guess)
turn = 1
while validate == 'n':
@KHerb
KHerb / gameboard.py
Created July 12, 2016 17:23
Gameboard Generator
"""Gameboard Generator"""
columns = int(raw_input("How many columns do you want on your gameboard? "))
rows = int(raw_input("How many rows do you want on your gameboard? "))
def gameboard(columns,rows):
column = []
height = []
for i in range(columns):
column.append("| |")
for i in range(columns):
prime = "prime.txt"
happy = "happy.txt"
pin = open(prime,'r')
pnumber = [p.strip() for p in pin.readlines()]
pin.close()
hin = open(happy, 'r')
hnumber = [h.strip() for h in hin.readlines()]
hin.close()
overlap = []
for p in pnumber:
@KHerb
KHerb / search.py
Created June 17, 2016 14:16
Element Search
import random
lst = [i for i in range(random.randrange(0,1000))]
n = int(raw_input("Enter a number to see if it's in the list range: "))
def elementsearch(lst,n):
if n in lst:
return True
else:
return False
if elementsearch(lst,n) == True:
print "%d is in the list range" % n
import random
from sys import exit
x = str(random.randint(1000,9999))
def cows_and_bulls():
user = raw_input("What is your guess? ")
Bulls,Cows,guess = 0,0,1
while user != x:
guess += 1
for i in range(len(user)):
@KHerb
KHerb / pwg.py
Last active November 20, 2016 01:58
Password generator, password checker and more!
import random
def pwgenerator():
lower = 'abcdefghijklmnopqrstuvwxyz'
up = lower.upper()
special = "~!@#$%^&*()_-+=}{|[]\?/:;'<>,."
password = ""
for i in range(3):
password += random.choice(lower)
password += random.choice(up)
password += random.choice(special)
@KHerb
KHerb / reverse.py
Created May 27, 2016 22:27
Returns reverse order of string input
x = str(raw_input("Type a sentence and I will reverse the order of it! "))
def reverse(x):
x = x.split(" ")
for i in x:
f = x[::-1]
f = " ".join(f)
return f
print reverse(x)