keyword
stringclasses
7 values
repo_name
stringlengths
8
98
file_path
stringlengths
4
244
file_extension
stringclasses
29 values
file_size
int64
0
84.1M
line_count
int64
0
1.6M
content
stringlengths
1
84.1M
language
stringclasses
14 values
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/nodeScaleBox.py
.py
10,077
231
import bpy import numpy as np from .nodesBoolmultiplex import axes_demultiplexer_node_group #initialize scalebox node group # Arguably should be refactored to a rescaled primitive cube -> subdivide modifier -> set pos to max -> merge by distance # Might be simpler than separate mesh grids, and have less redundancy de...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/nodesBoolmultiplex.py
.py
4,415
103
import bpy def axes_multiplexer_node_group(): node_group = bpy.data.node_groups.get("multiplex_axes") if node_group: return node_group node_group= bpy.data.node_groups.new(type = 'GeometryNodeTree', name = "multiplex_axes") links = node_group.links interface = node_group.interface ...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/shader_nodes/nodeRemapObjectID.py
.py
2,706
63
import bpy def remap_oid_node(): node_group = bpy.data.node_groups.get("Labelmask Remap Switch") if node_group: return node_group node_group= bpy.data.node_groups.new(type = 'ShaderNodeTree', name = "Labelmask Remap Switch") links = node_group.links interface = node_group.interface int...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/shader_nodes/cmap_menus.py
.py
3,149
76
import bpy import numpy as np import cmap CMAP_CATEGORIES = { "sequential": "IPO_LINEAR", "diverging": "LINCURVE", "cyclic" : "MESH_CIRCLE", "qualitative":"OUTLINER_DATA_POINTCLOUD", "miscellaneous":"ADD", } def cmap_submenu_class(op, opname, category, namespace=None): def draw(self...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/shader_nodes/__init__.py
.py
1,397
37
from . import cmap_menus from .nodeVolumeAlpha import volume_alpha_node from .handle_cmap import set_color_ramp_from_ch, get_lut from .nodeRemapObjectID import remap_oid_node from . import ops import bpy class MIN_MT_CMAP_ADD(bpy.types.Menu): bl_idname = "MIN_MT_CMAP_ADD" bl_label = "Add LUT" def draw(se...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/shader_nodes/ops.py
.py
4,179
113
import bpy from bpy.types import Context, Operator from .handle_cmap import get_lut, set_color_ramp from bpy.props import (StringProperty, FloatProperty, PointerProperty, IntProperty, BoolProperty, EnumProperty ) # from .nodeCmap import cmap_node c...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/shader_nodes/handle_cmap.py
.py
1,376
37
import bpy import cmap def set_color_ramp_from_ch(ch, ramp_node): lut, linear = get_lut(ch['cmap'], ch['single_color']) set_color_ramp(ramp_node, lut, linear, ch['cmap']) return def set_color_ramp(ramp_node, lut, linear, name): from ...ui.preferences import addon_preferences if addon_preferences(...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/shader_nodes/nodeVolumeAlpha.py
.py
3,266
71
import bpy from .nodeIgnoreExtremes import ignore_extremes_node_group import cmap def volume_alpha_node(): node_group = bpy.data.node_groups.get("Volume Transparency") if node_group: return node_group node_group= bpy.data.node_groups.new(type = 'ShaderNodeTree', name = "Volume Transparency") l...
Python
3D
aafkegros/MicroscopyNodes
microscopynodes/min_nodes/shader_nodes/nodeIgnoreExtremes.py
.py
2,504
69
import bpy def ignore_extremes_node_group(): node_group = bpy.data.node_groups.get("Ignore Extremes") if node_group: return node_group node_group= bpy.data.node_groups.new(type = 'ShaderNodeTree', name = "Ignore Extremes") links = node_group.links interface = node_group.interface ...
Python
3D
aafkegros/MicroscopyNodes
docs/faq.md
.md
440
8
# Help and Contact The main venue for **Usage questions** is the ![image.sc logo](figures/imagesc_logo.png){: style="height:15px"} [image.sc forum](https://forum.image.sc/tag/microscopy-nodes) and you can also search here for previous questions. If you've found a **bug** (or suspect something even a little bit of b...
Markdown
3D
aafkegros/MicroscopyNodes
docs/outdated.md
.md
1,045
24
# Installing and using Microscopy Nodes with Blender < 4.2 ## Install - Download an appropriate microscopynodes/tif2blender zip file from the [releases page](https://github.com/oanegros/microscopynodes/releases). Please note the Blender version number. Start blender. Install the `microscopynodes` Add-On: - In Blend...
Markdown
3D
aafkegros/MicroscopyNodes
docs/index.md
.md
165
4
<meta http-equiv="refresh" content="0; url=./tutorials/1_start/" /> If you are not redirected, [click here to start with the first tutorial](tutorials/1_start.md).
Markdown
3D
aafkegros/MicroscopyNodes
docs/overview.md
.md
2,021
39
# Microscopy in Blender `Microscopy Nodes` is a Blender add-on that incorporates bioimage support for the open-source software blender. {{ svg('microscopy_nodes') }} Microscopy Nodes simplifies loading bioimage (tif/zarr) files as volumetric objects in Blender. Please make some pretty figures with this add-on! For...
Markdown
3D
aafkegros/MicroscopyNodes
docs/clean_svg.py
.py
1,084
32
import xml.etree.ElementTree as ET import re from svgpathtools import parse_path, Path import sys def clean_and_scale_svg(input_path, output_path, scale=0.01): ET.register_namespace('', "http://www.w3.org/2000/svg") tree = ET.parse(input_path) root = tree.getroot() for elem in root.findall(".//*"): ...
Python
3D
aafkegros/MicroscopyNodes
docs/tutorials/preferences.md
.md
1,219
24
# Preferences / Customization The {{ svg("microscopy_nodes") }} Microscopy Nodes addon has {{ svg("preferences") }} **Preferences** to allow for a custom experience and defaults. You can find these under `Edit > Preferences > Add-ons > Microscopy Nodes`. ![alt text](../figures/microscopy_nodes_preferences.png) Her...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/large_data.md
.md
4,016
74
# Large data Microscopy data is often very large, {{ svg("microscopy_nodes") }} Microscopy Nodes has some strategies to deal with this. These depend on the size of the data, the shape of the data, and your computational resources (and skills). The key of this is working at a smaller scale, and then **reloading** to la...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/1_start.md
.md
6,347
111
# 1. First Use ## **Installing Microscopy Nodes** {{ youtube("BFMX0Dk5rIw", 360, 200) }} 1. Open Blender. 2. Navigate to `Edit > Preferences`. 3. In the Add-ons tab, search for `Microscopy Nodes`. 4. Click **Install** to download and enable the add-on. ## **Blender Interface Overview** The Blender interface is ver...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/rendering.md
.md
4,343
75
# Rendering There are a lot of extra parameters that can be adjusted to optimize rendering in Blender. All of these are explained in the {{ svg("blender") }} [Blender manual](https://docs.blender.org/manual/en/latest/render/cycles/render_settings/index.html). Some, however, are especially useful to know for microscopy...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/2_loading_data.md
.md
6,250
136
# Loading microscopy data ## Video tutorials The **Fluorescence** tutorial shows how to load *emissive* data, and the **EM** tutorial shows how to load *scattering data*, these settings can be good to interchange! {{ youtube("lroStEHiPV8", 280, 158) }} {{ youtube("Rwq7Tu8Avss", 280, 158) }} The **labelmask/surface...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/ome_zarr_troubleshooting.md
.md
1,750
26
# OME-Zarr troubleshooting [OME-Zarr](https://ngff.openmicroscopy.org/about/index.html) is a developing standard and is very flexible, which sometimes makes it hard to read and write, and no software supports all features. {{ svg("microscopy_nodes") }} Microscopy Nodes supports OME-Zarr **up to version 0.5**, to loa...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/5_creating_ouput.md
.md
3,948
68
# Creating output Creating output from a scene in Blender is done by adding a {{ svg("view_camera") }} camera and pressing `Render > Render Image` or `Render > Render Animation` for the full animation. This writes images or movies to your [output folder](./rendering.md#output-location-and-format). {{ youtube("jcERgoB...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/3_objects.md
.md
5,223
115
# 3. Objects Microscopy Nodes loads your microscopy data as different types of **objects**, depending on how you loaded each channel. ![mic nodes objects](../figures/outliner_objects.png) Each type of object is placed in a {{ svg("outliner_ob_empty") }} **holder** collection. The **Axes** and **Slice Cube** are alw...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/surface_smoothing.md
.md
1,060
26
# Surface modification After loading a {{ svg("outliner_data_pointcloud") }} labelmask or {{ svg("outliner_data_surface") }} surface, the geometry is often still quite jagged. This can be edited through two techniques: - changing the **mesh density** in the [preferences](./preferences.md) and reloading - adding smo...
Markdown
3D
aafkegros/MicroscopyNodes
docs/tutorials/4_shading.md
.md
9,255
150
# Shading **Shading** encompasses the visualization of Blender's objects. The shading options can be found in two places: - in the {{ svg("workspace") }} Shader Nodes workspace, find this in the {{ svg("topbar") }} topbar. - in the {{ svg("material") }} material tab of the {{ svg("properties") }} properties. These t...
Markdown
3D
aafkegros/MicroscopyNodes
tests/test_load_types.py
.py
648
24
from .utils import * import pytest loadable = [['volume'],['surface'],['labelmask'], [], ['volume', 'surface'], 'mixed'] @pytest.mark.parametrize('load_as', loadable) @pytest.mark.parametrize('arrtype', ['5D_5cube', '2D_5x10', '5D_nonrect']) def test_loading_types(arrtype, load_as): prep_load(arrtype) for ch...
Python
3D
aafkegros/MicroscopyNodes
tests/__init__.py
.py
0
0
null
Python
3D
aafkegros/MicroscopyNodes
tests/utils.py
.py
5,266
158
import os os.environ["MIN_TEST"] = "1" import bpy import yaml from microscopynodes.handle_blender_structs import * from microscopynodes.file_to_array import * from microscopynodes.load_components import * import microscopynodes import numpy as np import pytest import tifffile import platform import imageio.v3 as iio ...
Python
3D
aafkegros/MicroscopyNodes
tests/conftest.py
.py
1,168
42
import pytest import bpy import microscopynodes import shutil, os import gc, time microscopynodes._test_register() @pytest.hookimpl(trylast=True) def pytest_sessionfinish(session, exitstatus): import microscopynodes # regrettably necessary, pytest segfaults if properties # with callback functions stay ali...
Python
3D
aafkegros/MicroscopyNodes
tests/test_zarr_reload.py
.py
2,055
56
from .utils import * import pytest @pytest.mark.parametrize('level', [None, 0, 1, 2]) def test_zarr(level): prep_load() bpy.context.scene.MiN_input_file = str(Path(test_folder).parent / 'test_data' / '5D_5cube.zarr') if not level is None: bpy.context.scene.MiN_selected_array_option = str(bpy....
Python
3D
ZhangLingMing1/TSGCNet
train.py
.py
4,585
115
from dataloader import plydataset import torch from torch.utils.data import DataLoader from tqdm import tqdm import time import numpy as np import os from tensorboardX import SummaryWriter from torch.autograd import Variable from pathlib import Path import torch.nn.functional as F import datetime import logging from ut...
Python
3D
ZhangLingMing1/TSGCNet
TSGCNet.py
.py
10,340
293
import os import sys import copy import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import time from torch.autograd import Variable def knn(x, k): inner = -2 * torch.matmul(x.transpose(2, 1), x) xx = torch.sum(x ** 2, dim=1, keepdim=True) pairwise_distance = -...
Python
3D
ZhangLingMing1/TSGCNet
utils.py
.py
4,415
118
# *_*coding:utf-8 *_* import os import numpy as np import torch from torch.autograd import Variable from tqdm import tqdm from collections import defaultdict import pandas as pd from dataloader import generate_plyfile, plydataset def compute_cat_iou(pred,target,iou_tabel): # pred [B,N,C] target [B,N] iou_list...
Python
3D
ZhangLingMing1/TSGCNet
dataloader.py
.py
7,188
164
from plyfile import PlyData import numpy as np from torch.utils.data import DataLoader,Dataset,random_split import os import pandas as pd labels = ((255, 255, 255), (255, 0, 0), (255, 125, 0),(255, 255, 0), (0, 255, 0), (0, 255, 255), (0, 0, 255), (255, 0, 255)) def get_data(path=""): labels = ([255,...
Python
3D
llien30/point_cloud_anomaly_detection
train.py
.py
4,094
156
import argparse import os import random import numpy as np import torch import wandb import yaml from addict import Dict # from emd.emd_module import emdModule from libs.checkpoint import save_checkpoint from libs.dataset import ShapeNeth5pyDataset from libs.foldingnet import SkipValiationalFoldingNet from libs.helpe...
Python
3D
llien30/point_cloud_anomaly_detection
test.py
.py
10,046
321
import argparse import os import random from typing import List import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import yaml from addict import Dict from sklearn.metrics import auc, roc_curve from torch.utils.data import DataLoader from libs.checkpoint import resume from libs.datase...
Python
3D
llien30/point_cloud_anomaly_detection
libs/loss.py
.py
1,506
45
# from collections import Counter, defaultdict import torch import torch.nn as nn # from ortools.linear_solver import pywraplp class ChamferLoss(nn.Module): def __init__(self): super(ChamferLoss, self).__init__() self.use_cuda = torch.cuda.is_available() def batch_pairwise_dist(self, x, y):...
Python
3D
llien30/point_cloud_anomaly_detection
libs/dataset.py
.py
12,035
374
import copy import glob import json import os import random # from .visualize import vis_points_3d from typing import Tuple import h5py import numpy as np import pandas as pd import torch from torch.utils import data from .load_obj import loadOBJ from .sampling import fartherst_point_sampling class ShapeNetDataset...
Python
3D
llien30/point_cloud_anomaly_detection
libs/load_obj.py
.py
309
16
def loadOBJ(filepath: str) -> list: file = open(filepath, "r") vertices = [] for line in file: vals = line.split() if len(vals) == 0: continue if vals[0] == "v": v = list(map(float, vals[1:4])) vertices.append(v) return vertices
Python
3D
llien30/point_cloud_anomaly_detection
libs/vis_histogram.py
.py
839
29
import os import matplotlib.pyplot as plt import numpy as np import pandas as pd def vis_histgram(csv_file: str, save_dir: str) -> None: df = pd.read_csv(csv_file, index_col=0) label = df["1"] result = df["2"] normal_result = [] abnormal_result = [] for lbl, r in zip(label, result): ...
Python
3D
llien30/point_cloud_anomaly_detection
libs/visualize.py
.py
818
39
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def vis_points_3d(points, save_name): # print(pos_events.shape) points = points.to("cpu").detach().numpy() fig = plt.figure() ax = Axes3D(fig) # fig = fig.add_subplot(111, projection="3d") ax.plot( points[:, 2], ...
Python
3D
llien30/point_cloud_anomaly_detection
libs/meter.py
.py
597
24
class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self, name, fmt=":f"): self.name = name self.fmt = fmt self.reset() def reset(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def updat...
Python
3D
llien30/point_cloud_anomaly_detection
libs/__init__.py
.py
96
5
from .dataset import * from .foldingnet import * from .helper import * from .visualize import *
Python
3D
llien30/point_cloud_anomaly_detection
libs/checkpoint.py
.py
1,073
44
import os from typing import Tuple import torch import torch.nn as nn import torch.optim as optim def save_checkpoint( result_path: str, epoch: int, model: nn.Module, optimizer: optim.Optimizer, ) -> None: save_states = { "epoch": epoch, "model_state_dict": model.state_dict(), ...
Python
3D
llien30/point_cloud_anomaly_detection
libs/sampling.py
.py
1,372
44
import numpy as np def l2_norm(x, y): """Calculate l2 norm (distance) of `x` and `y`. Args: x (numpy.ndarray or cupy): (batch_size, num_point, coord_dim) y (numpy.ndarray): (batch_size, num_point, coord_dim) Returns (numpy.ndarray): (batch_size, num_point) """ return ((x - y) ** 2)...
Python
3D
llien30/point_cloud_anomaly_detection
libs/helper.py
.py
15,778
477
import os import time from typing import Any, List, Tuple import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import torch.nn as nn import wandb from torch import optim from torch.distributions import Categorical from torch.utils.data import DataLoader from .emd.emd_m...
Python
3D
llien30/point_cloud_anomaly_detection
libs/foldingnet.py
.py
13,746
418
import itertools import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from .visualize import vis_points_3d def knn(x: torch.tensor, k: int) -> int: batch_size = x.size(0) num_points = x.size(2) inner = -2 * torch.matmul(x.transpose(2, 1), x) xx = torch.sum(x ** 2, d...
Python
3D
llien30/point_cloud_anomaly_detection
utils/make_sphere.py
.py
494
27
import random from math import cos, pi, sin import numpy as np def make_sphere(N: int) -> None: points = [] for i in range(N): theta = 2 * pi * random.random() phi = 2 * pi * random.random() x = sin(phi) * cos(theta) y = sin(phi) * sin(theta) z = cos(phi) point...
Python
3D
kuangxh9/SuperWater
organize_pdb_dataset.py
.py
3,204
72
import os import shutil from collections import defaultdict from tqdm import tqdm from argparse import ArgumentParser parser = ArgumentParser(description="Process PDB files and organize dataset.") parser.add_argument("--raw_data", type=str, required=True, help="Name of the dataset folder containing PDB files.") parser...
Python
3D
kuangxh9/SuperWater
train.py
.py
6,739
157
import copy import math import os from functools import partial import numpy as np import random import wandb import torch torch.multiprocessing.set_sharing_strategy('file_system') import resource rlimit = resource.getrlimit(resource.RLIMIT_NOFILE) resource.setrlimit(resource.RLIMIT_NOFILE, (64000, rlimit[1])) import...
Python
3D
kuangxh9/SuperWater
inference_water_pos.py
.py
11,335
265
import gc import math import os import numpy as np import random import shutil import torch.nn as nn from argparse import Namespace, ArgumentParser, FileType import torch.nn.functional as F from functools import partial import wandb import torch import time from sklearn.metrics import roc_auc_score from torch_geometric...
Python
3D
kuangxh9/SuperWater
check_gpu.py
.py
532
17
import torch def check_cuda_devices(): if not torch.cuda.is_available(): print("CUDA is not available.") return num_gpus = torch.cuda.device_count() print(f"Number of CUDA devices available: {num_gpus}") for i in range(num_gpus): device_name = torch.cuda.get_device_name(i) ...
Python
3D
kuangxh9/SuperWater
utils/training.py
.py
6,382
156
import copy import numpy as np from torch_geometric.loader import DataLoader from tqdm import tqdm from confidence.dataset import ListDataset from utils import so3, torus from utils.sampling import sampling, randomize_position_multiple import torch from utils.diffusion_utils import get_t_schedule from utils.min_dist ...
Python
3D
kuangxh9/SuperWater
utils/so3.py
.py
3,660
97
import os import numpy as np import torch from scipy.spatial.transform import Rotation MIN_EPS, MAX_EPS, N_EPS = 0.01, 2, 1000 X_N = 2000 """ Preprocessing for the SO(3) sampling and score computations, truncated infinite series are computed and then cached to memory, therefore the precomputation is only run ...
Python
3D
kuangxh9/SuperWater
utils/visualise.py
.py
2,190
53
from rdkit.Chem.rdmolfiles import MolToPDBBlock, MolToPDBFile import rdkit.Chem from rdkit import Geometry from collections import defaultdict import copy import numpy as np import torch from rdkit import Chem from rdkit.Chem import rdmolfiles class PDBFile: def __init__(self, mol): self.parts = defau...
Python
3D
kuangxh9/SuperWater
utils/diffusion_utils.py
.py
2,797
74
import math import numpy as np import torch import torch.nn.functional as F from torch import nn from scipy.stats import beta from utils.geometry import axis_angle_to_matrix, rigid_transform_Kabsch_3D_torch from utils.torsion import modify_conformer_torsion_angles def t_to_sigma(t_tr, args): tr_sigma = args.tr_s...
Python
3D
kuangxh9/SuperWater
utils/geometry.py
.py
4,021
124
import math import torch def quaternion_to_matrix(quaternions): """ From https://pytorch3d.readthedocs.io/en/latest/_modules/pytorch3d/transforms/rotation_conversions.html Convert rotations given as quaternions to rotation matrices. Args: quaternions: quaternions with real part first, ...
Python
3D
kuangxh9/SuperWater
utils/find_water_pos.py
.py
1,267
37
import numpy as np import warnings from Bio.PDB import PDBParser from openbabel import openbabel as ob def find_real_water_pos(file_path, model_index=0): file_extension = file_path.split('.')[-1].lower() if file_extension == 'pdb': warnings.simplefilter('ignore') parser = PDBPars...
Python
3D
kuangxh9/SuperWater
utils/nearest_point_dist.py
.py
325
9
import torch def get_nearest_point_distances(set1, set2): points1 = torch.tensor(set1, dtype=torch.float) points2 = torch.tensor(set2, dtype=torch.float) dists = torch.cdist(points1, points2) min_dists, indices = torch.min(dists, dim=1) min_dists_np = min_dists.numpy() return min_dists_np, in...
Python
3D
kuangxh9/SuperWater
utils/inference_utils.py
.py
10,690
274
import os import torch from Bio.PDB import PDBParser from esm import FastaBatchedDataset, pretrained from rdkit.Chem import AddHs, MolFromSmiles from torch_geometric.data import Dataset, HeteroData import esm from datasets.process_mols import parse_pdb_from_path, generate_conformer, read_molecule, get_lig_graph_with_...
Python
3D
kuangxh9/SuperWater
utils/cluster_centroid.py
.py
2,794
81
import numpy as np from scipy.spatial import distance_matrix, cKDTree from scipy.spatial.distance import pdist def find_centroids(pred_coords, coords_prob, threshold=0.5, cluster_distance=1.52, use_weighted_avg=True, clash_distance=2.2, dedupe_decimals=6, tol=1e-8): """ R...
Python
3D
kuangxh9/SuperWater
utils/min_dist.py
.py
379
12
import torch from scipy.optimize import linear_sum_assignment from scipy.spatial.distance import cdist import numpy as np def match_points_and_get_distances(data1, data2): dist_matrix = cdist(data1, data2) row_ind, col_ind = linear_sum_assignment(dist_matrix) min_distances = np.array([dist_matrix[i, j] for...
Python
3D
kuangxh9/SuperWater
utils/seed.py
.py
5,511
132
import logging import os import random from random import getstate as python_get_rng_state from random import setstate as python_set_rng_state from typing import Any, Dict, Optional import numpy as np import torch from lightning_fabric.utilities.rank_zero import _get_rank, rank_prefixed_message, rank_zero_only, rank_...
Python
3D
kuangxh9/SuperWater
utils/torus.py
.py
2,609
84
import numpy as np import tqdm import os """ Preprocessing for the SO(2)/torus sampling and score computations, truncated infinite series are computed and then cached to memory, therefore the precomputation is only run the first time the repository is run on a machine """ def p(x, sigma, N=10): p_ = 0 ...
Python
3D
kuangxh9/SuperWater
utils/utils.py
.py
9,726
245
import os import subprocess import warnings from datetime import datetime import signal from contextlib import contextmanager import numpy as np import torch import yaml from rdkit import Chem from rdkit.Chem import RemoveHs, MolToPDBFile from torch_geometric.nn.data_parallel import DataParallel from torch.nn.parallel ...
Python
3D
kuangxh9/SuperWater
utils/sampling.py
.py
4,588
92
import numpy as np import torch from torch_geometric.loader import DataLoader from utils.diffusion_utils import modify_conformer, set_time from utils.torsion import modify_conformer_torsion_angles from scipy.spatial.transform import Rotation as R # from utils.visualise import save_water_to_pdb_file import os def rand...
Python
3D
kuangxh9/SuperWater
utils/torsion.py
.py
3,606
94
import networkx as nx import numpy as np import torch, copy from scipy.spatial.transform import Rotation as R from torch_geometric.utils import to_networkx from torch_geometric.data import Data """ Preprocessing and computation for torsional updates to conformers """ def get_transformation_mask(pyg_data): G ...
Python
3D
kuangxh9/SuperWater
utils/parsing.py
.py
23,272
267
from argparse import ArgumentParser,FileType def parse_train_args(): # General arguments parser = ArgumentParser() parser.add_argument('--config', type=FileType(mode='r'), default=None) parser.add_argument('--log_dir', type=str, default='workdir', help='Folder in which to save model and logs') par...
Python
3D
kuangxh9/SuperWater
confidence/dataset.py
.py
15,205
287
import itertools import math import os import pickle import random from argparse import Namespace from functools import partial import copy from scipy.spatial import cKDTree import time import numpy as np import pandas as pd import torch import yaml from torch_geometric.data import Dataset, Data from torch_geometric.l...
Python
3D
kuangxh9/SuperWater
confidence/confidence_train.py
.py
15,068
301
import gc import math import os import shutil from argparse import Namespace, ArgumentParser, FileType import torch.nn.functional as F from functools import partial import wandb import torch from sklearn.metrics import roc_auc_score from torch_geometric.loader import DataListLoader, DataLoader from tqdm import tqdm f...
Python
3D
kuangxh9/SuperWater
webapp/app.py
.py
11,818
402
import os import shutil import subprocess from flask import ( Flask, render_template, request, redirect, url_for, send_file, session, Response, ) import traceback app = Flask(__name__, static_folder="static", template_folder="templates") app.secret_key = "SESSION_DUMMY_KEY" @app.route(...
Python
3D
kuangxh9/SuperWater
models/all_atom_score_model.py
.py
23,325
401
from e3nn import o3 import torch from torch import nn from torch.nn import functional as F from torch_cluster import radius, radius_graph from torch_scatter import scatter_mean import numpy as np import matplotlib.pyplot as plt import warnings warnings.simplefilter('ignore') from models.score_model import AtomEncoder, ...
Python
3D
kuangxh9/SuperWater
models/score_model.py
.py
19,780
391
import math from e3nn import o3 import torch from torch import nn from torch.nn import functional as F from torch_cluster import radius, radius_graph from torch_scatter import scatter, scatter_mean import numpy as np from e3nn.nn import BatchNorm from utils import so3, torus from datasets.process_mols import lig_feat...
Python
3D
kuangxh9/SuperWater
datasets/esm_embeddings_to_pt.py
.py
558
17
import os from argparse import ArgumentParser import torch from tqdm import tqdm parser = ArgumentParser() parser.add_argument('--esm_embeddings_path', type=str, default='data/embeddings_output', help='') parser.add_argument('--output_path', type=str, default='data/esm2_3billion_embeddings.pt', help='') args = pars...
Python
3D
kuangxh9/SuperWater
datasets/conformer_matching.py
.py
7,071
197
import copy, time import numpy as np from collections import defaultdict from rdkit import Chem, RDLogger from rdkit.Chem import AllChem, rdMolTransforms from rdkit import Geometry import networkx as nx from scipy.optimize import differential_evolution RDLogger.DisableLog('rdApp.*') """ Conformer matching routine...
Python
3D
kuangxh9/SuperWater
datasets/process_mols.py
.py
26,058
581
import copy import os import warnings import numpy as np import scipy.spatial as spa import torch from Bio.PDB import PDBParser from Bio.PDB.PDBExceptions import PDBConstructionWarning from rdkit import Chem from rdkit.Chem.rdchem import BondType as BT from rdkit.Chem import AllChem, GetPeriodicTable, RemoveHs from rd...
Python
3D
kuangxh9/SuperWater
datasets/pdbbind.py
.py
13,359
262
import binascii import glob import hashlib import os import pickle from collections import defaultdict from multiprocessing import Pool import random import copy import re import numpy as np import torch from rdkit.Chem import MolToSmiles, MolFromSmiles, AddHs from torch_geometric.data import Dataset, HeteroData from t...
Python
3D
kuangxh9/SuperWater
datasets/esm_embedding_preparation_water.py
.py
2,850
98
import os from argparse import FileType, ArgumentParser import numpy as np import pandas as pd from Bio.PDB import PDBParser from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from tqdm import tqdm from Bio import SeqIO parser = ArgumentParser() parser.add_argument('--out_file', type=str, default="data/prep...
Python
3D
lvqiujie/Mol2Context-vec
tasks/__init__.py
.py
0
0
null
Python
3D
lvqiujie/Mol2Context-vec
tasks/BACE/get_bace_data.py
.py
4,785
161
import pandas as pd from sklearn.externals import joblib import numpy as np import os # step 1 filepath="bace/bace.csv" df = pd.read_csv(filepath, header=0, encoding="gbk") w_file = open("bace/bace.smi", mode='w', encoding="utf-8") all_label = [] all_smi = [] for line in df.values: # aa = np.array(line[:17], dtyp...
Python
3D
lvqiujie/Mol2Context-vec
tasks/BACE/bace_train.py
.py
12,821
282
# from rdkit import Chem # from rdkit.Chem import AllChem import random from tasks.utils.model import * from sklearn.externals import joblib import numpy as np from sklearn import metrics from sklearn.metrics import precision_recall_curve import matplotlib.pyplot as plt import seaborn as sns device = torch.device("cud...
Python
3D
lvqiujie/Mol2Context-vec
tasks/hiv/hiv_train.py
.py
16,832
408
import sys sys.path.append('./') import os import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals import joblib import numpy as np import math import random fro...
Python
3D
lvqiujie/Mol2Context-vec
tasks/hiv/get_hiv_data.py
.py
4,809
163
import sys sys.path.append('./') import pandas as pd from sklearn.externals import joblib import numpy as np import os # step 1 filepath="hiv/hiv.csv" df = pd.read_csv(filepath, header=0, encoding="gbk") w_file = open("hiv/hiv.smi", mode='w', encoding="utf-8") all_label = [] all_smi = [] for line in df.values: sm...
Python
3D
lvqiujie/Mol2Context-vec
tasks/utils/model.py
.py
4,092
111
import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import math device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class LSTM(nn.Module): """搭建rnn网络""" def __init__(self, ...
Python
3D
lvqiujie/Mol2Context-vec
tasks/utils/__init__.py
.py
0
0
null
Python
3D
lvqiujie/Mol2Context-vec
tasks/utils/util.py
.py
6,345
135
import sys sys.path.append('./') import numpy as np from sklearn.model_selection import KFold from sklearn.externals import joblib def split_data(x, y, all_smi, k_fold, name): y = np.array(y) all_smi = np.array(all_smi) # save_path = 'hiv/'+str(k_fold)+'-fold-index.pkl' # if os.path.isfile(save_path):...
Python
3D
lvqiujie/Mol2Context-vec
tasks/FreeSolv/train2.py
.py
35,119
793
from rdkit import Chem import torch import os import torch.nn as nn from sklearn import metrics from sklearn.metrics import precision_recall_curve from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.ext...
Python
3D
lvqiujie/Mol2Context-vec
tasks/FreeSolv/train.py
.py
14,327
386
from rdkit import Chem import torch import torch.nn as nn from sklearn import metrics from sklearn.metrics import precision_recall_curve from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals imp...
Python
3D
lvqiujie/Mol2Context-vec
tasks/FreeSolv/test.py
.py
1,531
40
import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from tasks.FreeSolv.train import LSTM, MyDataset import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals import joblib import numpy as np # 设置超参数 input_size = 5...
Python
3D
lvqiujie/Mol2Context-vec
tasks/clintox/clintox_train.py
.py
12,871
262
import os import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals import joblib import numpy as np import random from sklearn import metrics from sklearn.metrics...
Python
3D
lvqiujie/Mol2Context-vec
tasks/clintox/get_clintox_data.py
.py
5,581
181
import pandas as pd import numpy as np from rdkit import Chem import os from rdkit.Chem import Descriptors from sklearn.externals import joblib # step 1 filepath="clintox/clintox.csv" df = pd.read_csv(filepath, header=0, encoding="gbk") w_file = open("clintox/clintox.smi", mode='w', encoding="utf-8") all_label = [] a...
Python
3D
lvqiujie/Mol2Context-vec
tasks/toxcast/toxcast_train.py
.py
20,961
442
import sys, os sys.path.append('./') import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals import joblib from sklearn.metrics import precision_recall_curve imp...
Python
3D
lvqiujie/Mol2Context-vec
tasks/toxcast/get_toxcast_data.py
.py
4,829
161
import sys sys.path.append('./') import pandas as pd from sklearn.externals import joblib import numpy as np import os # step 1 filepath="toxcast/toxcast_data.csv" df = pd.read_csv(filepath, header=0, encoding="gbk") all_label = [] all_smi = [] w_file = open("toxcast/toxcast.smi", mode='w',encoding="utf-8") for line i...
Python
3D
lvqiujie/Mol2Context-vec
tasks/esol/esol_train.py
.py
13,443
360
from rdkit import Chem import torch import torch.nn as nn from sklearn import metrics from sklearn.metrics import precision_recall_curve from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals imp...
Python
3D
lvqiujie/Mol2Context-vec
tasks/esol/get_data.py
.py
5,780
185
import pandas as pd from sklearn.externals import joblib import numpy as np from rdkit import Chem from rdkit.Chem import Descriptors import os # step 1 filepath="esol/delaney-processed3.csv" df = pd.read_csv(filepath, header=0, encoding="gbk") w_file = open("esol/esol.smi", mode='w',encoding="utf-8") all_label = [] ...
Python
3D
lvqiujie/Mol2Context-vec
tasks/esol/esol_train2.py
.py
33,347
778
from rdkit import Chem import torch import os import torch.nn as nn from sklearn import metrics from sklearn.metrics import precision_recall_curve from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.ext...
Python
3D
lvqiujie/Mol2Context-vec
tasks/tox21/tox_train.py
.py
21,491
462
import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals import joblib from sklearn.metrics import precision_recall_curve import numpy as np import math import ra...
Python
3D
lvqiujie/Mol2Context-vec
tasks/tox21/get_tox_data.py
.py
5,169
179
import sys sys.path.append('./') import pandas as pd from sklearn.externals import joblib import numpy as np import os # NR-AR NR-AR-LBD NR-AhR NR-Aromatase # NR-ER NR-ER-LBD NR-PPAR-gamma SR-ARE # SR-ATAD5 SR-HSE SR-MMP SR-p53 dict_label = {"NR-AR":0, "NR-AR-LBD":1, "NR-AhR":2, ...
Python
3D
lvqiujie/Mol2Context-vec
tasks/lipop/train2.py
.py
33,437
779
from rdkit import Chem import torch import os import torch.nn as nn from sklearn import metrics from sklearn.metrics import precision_recall_curve from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.ext...
Python
3D
lvqiujie/Mol2Context-vec
tasks/lipop/train.py
.py
14,921
386
from rdkit import Chem import torch import torch.nn as nn from sklearn import metrics from sklearn.metrics import precision_recall_curve from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import torch.nn.functional as F import torch.utils.data as data import pandas as pd from sklearn.externals imp...
Python
3D
lvqiujie/Mol2Context-vec
tasks/lipop/get_data.py
.py
5,704
184
import pandas as pd from sklearn.externals import joblib import numpy as np from rdkit import Chem from rdkit.Chem import Descriptors import os # step 1 filepath="lipop/Lipophilicity.csv" df = pd.read_csv(filepath, header=0, encoding="gbk") w_file = open("lipop/lipop.smi", mode='w',encoding="utf-8") all_label = [] al...
Python