Skip to content

Instantly share code, notes, and snippets.

View edraizen's full-sized avatar

Eli Draizen edraizen

View GitHub Profile
@edraizen
edraizen / masif.py
Created July 3, 2020 15:28
MaSIF pymol plugin, merged to avoid finding correct paths
# Pablo Gainza Cirauqui 2016 LPDI IBI STI EPFL
# This pymol plugin for Masif just enables the load ply functions.
import os, sys
import math, re
from pymol import cmd, stored
import sys
from pymol import cmd, stored
import torch
import numpy as np
import sparseconvnet as scn
from more_itertools import pairwise
from torch.nn.parallel._functions import Scatter
class Batch(object):
def __init__(self, indices, data, truth, chunk_sizes=None, dim=3):
assert isinstance(indices, torch.Tensor), "indices must be tensor"
assert isinstance(data, torch.Tensor), "data must be tensor"
DEBUG:toil.batchSystems.mesos.batchSystem:Preparing to launch Mesos task 0 with 1.00 cores, 2048.00 MiB memory, and 2048.00 MiB disk using offer 5b6aaf7d-99c1-410a-85f3-dc9602313361-O20 ...
DEBUG:toil.batchSystems.mesos.batchSystem:Launched Mesos task 0.
WARNING:toil.batchSystems.mesos.batchSystem:Executor 'toil-28072' reported lost with status '32512'.
WARNING:toil.batchSystems.mesos.batchSystem:Handling failure of executor 'toil-28072' on agent '5b6aaf7d-99c1-410a-85f3-dc9602313361-S2'.
DEBUG:toil.batchSystems.mesos.batchSystem:Available files: dict_keys(['/slave/log', '/var/lib/mesos/slaves/5b6aaf7d-99c1-410a-85f3-dc9602313361-S2/frameworks/5b6aaf7d-99c1-410a-85f3-dc9602313361-0032/executors/toil-27424/runs/f56c948d-a6b4-4ea5-9639-7518518f6ace', '/var/lib/mesos/slaves/5b6aaf7d-99c1-410a-85f3-dc9602313361-S2/frameworks/5b6aaf7d-99c1-410a-85f3-dc9602313361-0033/executors/toil-28072/runs/807e0102-ecc0-406c-b9b8-f60a845ec65f'])
WARNING:toil.batchSystems.mesos.batchSystem:Attempting to retrieve executor error l
import os
import pandas as pd
import dask.dataframe as dd
from dask.multiprocessing import get
num_workers = 20 #or use int(os.environ["SLURM_JOB_CPUS_PER_NODE"])
def apply_row(row):
return pd.Series({
"newColA": row["A"]+row["B"]),
SELECT
i.mol_sdi_id,
i.nbr_sdi_id,
i.nbr_score,
i.nbr_taxid,
i.nbr_superfam_id,
i.int_superfam_id,
i.nbr_obs_int_id,
i.face_seq as resn,
f.seqloc as resi
import torch.nn as nn
import sparseconvnet as scn
import torch.nn.functional as F
class Dropout(nn.Module):
def __init__(self, p=0.5, inplace=False):
super(Dropout, self).__init__()
if p < 0 or p > 1:
raise ValueError("dropout probability has to be between 0 and 1, "
"but got {}".format(p))
import torch
import torch.nn as nn
import sparseconvnet as scn
class UNet3D(nn.Module):
"""Sparse 3D Unet for voxel level prediction.
Modified from shiba24/3d-unet and ellisdg/3DUnetCNN
Parameters
from itertools import groupby
from torch.nn.modules.loss import _Loss
class DiceLoss(_Loss):
def __init__(self, size_average=True, smooth=1.):
super(DiceLoss, self).__init__(size_average)
self.smooth = smooth
def forward(self, input, target, locations, weights=None):
if self.size_average:
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
#Standard libraries
import os, sys
import logging
#Requried Libraries
from joblib import Parallel, delayed
try:
#Import libraries to use use cluster
from cluster_helper.cluster import cluster_view