This file contains hidden or 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 typing | |
| import asyncio | |
| import uvicorn | |
| import random | |
| import weakref | |
| from pydantic import BaseModel | |
| #from starlette.applications import Starlette | |
| #from starlette.routing import Route | |
| from fastapi import FastAPI, Query | |
| from sse_starlette.sse import EventSourceResponse |
This file contains hidden or 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
| class Renderer: | |
| def __init__(self, root): | |
| self.root = root | |
| def svg(self): | |
| leftmost = self.root.leftmost(0) | |
| s = min(300 / self.root.w, 300 / self.root.h) | |
| svg = f""" | |
| <!DOCTYPE html> | |
| <html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 typing | |
| import numpy as np | |
| import scipy.optimize | |
| def _pcca_plus_score(partial_coarse_graining_matrix_flat: np.ndarray, eigenvectors: np.ndarray, n: int) -> float: | |
| """Implementation of the PCCA+ score. | |
| Parameters | |
| ---------- |
This file contains hidden or 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
| dtype = np.dtype([("row", np.int32, ), ("col", np.int32, ), ("cov", np.float32, )]) | |
| a = np.zeros((3,), dtype=dtype) | |
| for i in range(3): | |
| a[i]["row"] = np.random.randint(2*15) | |
| a[i]["col"] = np.random.randint(2*15) | |
| a[i]["cov"] = np.random.randn() | |
| with NpyStream("test.npy") as s: | |
| s.append(a[0]) | |
| s.append(a[1]) | |
| s.append(a[2]) |
This file contains hidden or 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
| #include <math.h> | |
| #include <stddef.h> | |
| #include <signal.h> | |
| #include <assert.h> | |
| static volatile sig_atomic_t interrupted; | |
| static void (*old_handler)(int); | |
| static void signal_handler(int signo) { | |
| interrupted = 1; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 numpy as np | |
| import rdkit.Chem | |
| def reorder_atoms(mol_pdb_fname, template_pdb_fname, output_pdb_fname): | |
| from rdkit.Chem import rdmolfiles | |
| mol_to_transform = rdkit.Chem.rdmolfiles.MolFromPDBFile(mol_pdb_fname, removeHs=False) | |
| transform_order = list(rdmolfiles.CanonicalRankAtoms(mol_to_transform)) | |
| mol_template = rdkit.Chem.rdmolfiles.MolFromPDBFile(template_pdb_fname, removeHs=False) |
This file contains hidden or 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 numpy as np | |
| import mdtraj | |
| import os | |
| import os.path | |
| import argparse | |
| def prepare_maps(mut_pdb='mutant.pdb', wt_pdb=None): | |
| if wt_pdb is None: | |
| wt_pdb = os.path.expanduser('~/system/crystal.pdb') |
This file contains hidden or 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 pyparsing as pp | |
| from pyparsing import pyparsing_common as ppc | |
| __all__ = ['load_colvars', 'handle_colvars'] | |
| pp.ParserElement.setDefaultWhitespaceChars(' \t') | |
| vector = pp.Group(pp.Literal('(').suppress() + | |
| pp.delimitedList(ppc.number, delim=',') + | |
| pp.Literal(')').suppress()) |
NewerOlder