m = number of training samples x = “input” variable / feature y = “output” variable / “target” variable (x,y) = one training example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for each template: | |
# from PDB entry: | |
# print SS bonds within template span | |
import os | |
import gzip | |
import ensembler | |
from ensembler.uniprot import get_uniprot_xml | |
from ensembler.initproject import extract_template_pdbchains_from_uniprot_xml, parse_sifts_xml | |
from ensembler.utils import set_loglevel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ast | |
import re | |
import operator as op | |
import simtk.unit | |
unit_membernames = [name for name in simtk.unit.__dict__] | |
quantity_as_number_space_unit_regex = re.compile( | |
'([0-9.]+) ?({0})'.format('|'.join(unit_membernames)) | |
) # e.g. "2 picoseconds" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def retrieve_uniprot(search_string, maxreadlength=100000000): | |
''' | |
Searches the UniProt database given a search string, and retrieves an XML | |
file, which is returned as a string. | |
maxreadlength is the maximum size in bytes which will be read from the website | |
(default 100MB) | |
Example search string: 'domain:"Protein kinase" AND reviewed:yes' | |
The function also removes the xmlns attribute from <uniprot> tag, as this | |
makes xpath searching annoying |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Construct a configfile for MPICH2 mpirun from Torque/Moab $PBS_GPUFILE contents. | |
Usage: | |
python build-mpirun-configfile.py executable [args...] | |
mpirun -configfile configfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import mpi4py.MPI | |
import gzip | |
import simtk.openmm as openmm | |
import simtk.openmm.app as app | |
import simtk.unit as unit | |
comm = mpi4py.MPI.COMM_WORLD | |
rank = comm.rank | |
size = comm.size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokenized_string = "2 + 3 * 4".split() | |
# parsing arithmetic expressions with + and * | |
# A parser returns (parsed_thing, new_index) on success. | |
def fail(): raise Exception("failed to parse") | |
def is_num(x): | |
try: int(x) | |
except ValueError: return False |