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 | theaidenlab/AGWG-merge | edit/apply-edits-prep-for-next-round.sh | .sh | 5,016 | 118 | #!/bin/bash
#### Description: Wrapper script that applies a list of edits to the original set of scaffolds/contigs to create a new input set, described by new cprops, new mnd and, if requested, new fasta.
#### Usage: apply-edits-prep-for-next-round.sh [ -f path_to_fasta_file ] [ -r revision_label ] [ -p true/false ] <... | Shell |
3D | theaidenlab/AGWG-merge | edit/run-mismatch-detector.sh | .sh | 14,327 | 211 | #!/bin/bash
#### Description: Wrapper script to annotate mismatches. Consists of 3 parts:
#### 1. Analysis of local mismatch signatures [done]
#### 2?. Filtering local mismatch calls by checking for off-diagonal contact enrichments signatures [not done]
#### 3. Mismatch boundary thinning to reduce mimassembly debris [... | Shell |
3D | theaidenlab/AGWG-merge | supp/generate-table-s5.sh | .sh | 448 | 10 | #!/bin/bash
extract () {
awk '{str[NR]=$0}END{print str[1]; print str[2]; print str[3]; print str[7]; print str[8]}' $1 | awk '{$1=$1}1'
}
in_chrom=`extract chr-length.fasta.stats | awk 'NR==1{print $NF}'`
awk -v in_chrom=${in_chrom} '{tmp=$NF; $NF=""; print $0"\t"tmp}NR==1{tot_len=tmp}NR==5||NR==10||NR==15{pct... | Shell |
3D | theaidenlab/AGWG-merge | supp/generate-table-s1.sh | .sh | 748 | 8 | #!/bin/bash
extract () {
awk '{str[NR]=$0}END{print str[1]; print str[7]; print str[8]; print str[9]}' $1 | awk '{$1=$1}1'
}
awk '{tmp=$NF; $NF=""; print $0"\t"tmp}NR==1{tot_seq=tmp}NR==5{print "% of Total Sequenced Base Pairs\t"tmp/tot_seq}NR==9{tot_attempt=tmp; print "% of Total Sequenced Base Pairs\t"tmp/tot_... | Shell |
3D | theaidenlab/AGWG-merge | supp/match-map-data.sh | .sh | 3,061 | 87 | #!/bin/bash
USAGE="
*****************************
./generate-linkage-map.sh -d <Juneja/...> -c <chrom_number> <path_to_orig_cprops> <path_to_final_tiled_cprops> <path_to_final_tiled_asm>
*****************************
"
## HANDLE OPTIONS
while getopts "hd:c:" opt; do
case $opt in
h) echo "$USAGE" >&1
exi... | Shell |
3D | theaidenlab/AGWG-merge | supp/make-rainbow-tracks.sh | .sh | 2,001 | 47 | #!/bin/bash
## Helper script to generate rainbow tracks illustrating liftover
## Written by: OD olga.dudchenko@bcm.edu
pipeline=`cd "$( dirname $0)" && cd .. && pwd`
bin=500000;
USAGE="
*****************************
./make-rainbow-tracks.sh -b <bin> -c <ref_chrom_number> ref.cprops ref.asm target.cprops target.asm... | Shell |
3D | theaidenlab/AGWG-merge | supp/generate-table-s2.sh | .sh | 532 | 8 | #!/bin/bash
extract () {
awk '{str[NR]=$0}END{print str[1]; print str[7]; print str[8]; print str[9]}' $1 | awk '{$1=$1}1'
}
awk '{tmp=$NF; $NF=""; print $0"\t"tmp}NR==1{tot_seq=tmp}NR==5{print "% of Total Sequenced Base Pairs\t"tmp/tot_seq}NR==9{tot_attempt=tmp; print "% of Total Sequenced Base Pairs\t"tmp/tot_... | Shell |
3D | theaidenlab/AGWG-merge | supp/generate-table-1.sh | .sh | 348 | 8 | #!/bin/bash
extract () {
awk '{str[NR]=$0}END{print str[1]; print str[2]; print str[3]; print str[7]; print str[8]}' $1 | awk '{$1=$1}1'
}
awk '{tmp=$NF; $NF=""; print $0"\t"tmp}NR==5||NR==10||NR==15{print ""}' <(extract draft.fasta.stats && extract chr-length.fasta.stats && extract small.fasta.stats && extract ... | Shell |
3D | theaidenlab/AGWG-merge | supp/fasta-count-sequenced-bases.sh | .sh | 1,380 | 41 | #!/bin/bash
USAGE="./fasta-count-sequenced-bases.sh {-c <chrom_number>} <path_to_fasta>"
# handle options
while getopts "c:h" opt; do
case $opt in
h) echo "$USAGE"
exit 0
;;
c) re='^[-0-9]+$'
if ! [[ $OPTARG =~ $re && $OPTARG -gt 0 ]] ; then
echo ":( Error: Wrong syntax for number of chromosomes: counting a... | Shell |
3D | theaidenlab/AGWG-merge | supp/get-AaegL2.sh | .sh | 1,226 | 25 | #!/bin/bash
## This is a script to set up initial conditions for replicating the AaegL4 assembly
## Input: None (link to NCBI assembly hardcoded)
## Output: AaegL2.fasta file
## Written by: OD
## USAGE: ./get-AaegL2.sh
[ -f temp.cprops ] || [ -f temp.asm ] && echo >&2 "Please remove or rename temp.cprops and/or temp.a... | Shell |
3D | theaidenlab/AGWG-merge | supp/generate-table-s3.sh | .sh | 550 | 8 | #!/bin/bash
extract () {
awk '{str[NR]=$0}END{print str[1]; print str[7]; print str[8]; print str[9]}' $1 | awk '{$1=$1}1'
}
awk '{tmp=$NF; $NF=""; print $0"\t"tmp}NR==1{tot_seq=tmp}NR==5{print "% of Total Sequenced Base Pairs\t"tmp/tot_seq}NR==9{tot_attempt=tmp; print "% of Total Sequenced Base Pairs\t"tmp/tot_... | Shell |
3D | theaidenlab/AGWG-merge | supp/generate-table-s4.sh | .sh | 439 | 10 | #!/bin/bash
extract () {
awk '{str[NR]=$0}END{print str[1]; print str[2]; print str[3]; print str[7]; print str[8]}' $1 | awk '{$1=$1}1'
}
in_chrom=`extract chr-length.fasta.stats | awk 'NR==1{print $NF}'`
awk -v in_chrom=${in_chrom} '{tmp=$NF; $NF=""; print $0"\t"tmp}NR==1{tot_len=tmp}NR==5||NR==10||NR==15{pct... | Shell |
3D | theaidenlab/AGWG-merge | supp/print-tables.sh | .sh | 334 | 16 | #!/bin/bash
pipeline=`cd "$( dirname $0)" && cd .. && pwd`
bash ${pipeline}/supp/generate-table-1.sh
bash ${pipeline}/supp/generate-table-s1.sh
bash ${pipeline}/supp/generate-table-s2.sh
bash ${pipeline}/supp/generate-table-s3.sh
bash ${pipeline}/supp/generate-table-s4.sh
bash ${pipeline}/supp/generat... | Shell |
3D | theaidenlab/AGWG-merge | split/run-asm-splitter.sh | .sh | 11,980 | 226 | #!/bin/bash
#### Description: Wrapper script to split any given assembly. Note that this split is ignorant of the chromosome number and is simply a version of a mismatch detector at a pretty large scale. To control what is going on one might want to check if the number of mismatches pre to post-polish has decreased (c... | Shell |
3D | AxDante/SAAMI | 2D_Image_exampe.py | .py | 278 | 11 | # Import sammi module
from saami.SAAMI import SAAMI
Data2D = SAAMI('data/Chest_X-ray_example_processed', roi=None, dataset_type='Image')
print('dataset loaded')
mask = Data2D.calculate_mask(0, threshold= 0.003)
Data2D.save_mask(0, save_path='outputs/saved_2D_sam_mask.png')
| Python |
3D | AxDante/SAAMI | 3D_volume_example.py | .py | 577 | 22 | # Import sammi module
from saami.SAAMI import SAAMI
# roi = ((70, 150), (700, 600))
SAAMIdata = SAAMI('data/MRI_example', roi=None)
# Calculates 3D mask for the first volume (idx = 0)
mask = SAAMIdata.calculate_mask(0, threshold= 0.003)
SAAMIdata.save_mask(0, save_path='outputs/saved_sam_mask.nii')
# Fine-tune 3D ... | Python |
3D | AxDante/SAAMI | CODE_OF_CONDUCT.md | .md | 5,226 | 129 | # Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of... | Markdown |
3D | AxDante/SAAMI | saami/Dataset.py | .py | 5,013 | 152 | from torch.utils.data import Dataset
import os
import nibabel as nib
import numpy as np
import re
import cv2
class VolumeDataset(Dataset):
"""
VolumeDataset
"""
def __init__(self, input_dir, roi=None):
self.input_dir = input_dir
self.data = {}
self.folder_names = os.li... | Python |
3D | AxDante/SAAMI | saami/__init__.py | .py | 0 | 0 | null | Python |
3D | AxDante/SAAMI | saami/functions.py | .py | 10,672 | 288 | import os.path
import urllib.request
import numpy as np
import cv2
from tqdm import tqdm
from segment_anything import SamAutomaticMaskGenerator, sam_model_registry, SamPredictor
def get_sam_mask_generator(sam_checkpoint=None, sam_model_type="vit_b", device="cuda"):
if sam_checkpoint == None:
if sam_model... | Python |
3D | AxDante/SAAMI | saami/SAAMI.py | .py | 3,842 | 84 | import cv2
import os
import nibabel as nib
from typing import NamedTuple
from saami.Dataset import VolumeDataset, ImageDataset
from saami.utils import save_SAM_data, convert_to_nifti
from saami.functions import get_SAM_data, fine_tune_3d_masks, get_sam_mask_generator
from saami.visualizer import visualize_volume_SAM
c... | Python |
3D | AxDante/SAAMI | saami/utils.py | .py | 2,533 | 74 | "Utility file for saami package"
import os
import numpy as np
import nibabel as nib
import pickle
def download_progress_hook(block_num, block_size, total_size):
downloaded = block_num * block_size
progress = min(100, (downloaded / total_size) * 100)
print(f"\rDownload progress: {progress:.2f}%", end='')
d... | Python |
3D | AxDante/SAAMI | saami/visualizer.py | .py | 4,523 | 138 | import numpy as np
import matplotlib.pyplot as plt
import ipywidgets as widgets
import os
import tkinter as tk
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.colors import Normalize
def visualize_volume_SAM(data_dict, show_widget=False, show_tkinter=False, save_path="", axis='z'):
... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | AutoEncoder/utils.py | .py | 4,810 | 178 |
import warnings
import torch
# import imageio
import math
import numpy as np
# import skvideo.io
import sys
import pdb as pdb_original
import logging
# import imageio.core.util
logging.getLogger("imageio_ffmpeg").setLevel(logging.ERROR)
class ForkedPdb(pdb_original.Pdb):
"""A Pdb subclass that may be used
... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | AutoEncoder/model/PatchVolume.py | .py | 31,335 | 706 |
import math
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch.nn.functional as F#
from einops import rearrange
from torch.optim.optimizer import Optimizer
from AutoEncoder.utils import shift_dim, adopt_weight
from AutoEncoder.model.lpips import LPIPS
from AutoEncoder.mo... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | AutoEncoder/model/lpips.py | .py | 6,483 | 182 | """Adapted from https://github.com/SongweiGe/TATS"""
"""Stripped version of https://github.com/richzhang/PerceptualSimilarity/tree/master/models"""
from collections import namedtuple
from torchvision import models
import torch.nn as nn
import torch
from tqdm import tqdm
import requests
import os
import hashlib
URL_M... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | AutoEncoder/model/__init__.py | .py | 165 | 7 | from AutoEncoder.model.codebook import Codebook
from AutoEncoder.model.lpips import LPIPS
from AutoEncoder.model.MedicalNetPerceptual import MedicalNetPerceptual
| Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | AutoEncoder/model/codebook.py | .py | 3,982 | 108 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed as dist
from AutoEncoder.utils import shift_dim
class Codebook(nn.Module):
def __init__(self, n_codes, embedding_dim, no_random_restart=False, restart_thres=1.0):
super().__init__()
s... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | AutoEncoder/model/MedicalNetPerceptual.py | .py | 2,710 | 67 | import torch
import torch.nn as nn
import os
def mednet_norm(input):
mean = input.mean()
std = input.std()
return (input - mean) / std
def mednet_norm_feature(x , eps = 1e-7):
norm_factor = torch.sqrt(torch.sum(x**2, dim=1, keepdim=True))
return x / (norm_factor + eps)
def spatial_average(x, keep... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | warvito_MedicalNet-models_main/hubconf.py | .py | 338 | 13 | # Optional list of dependencies required by the package
dependencies = ["torch", "gdown"]
from medicalnet_models.models.resnet import (
medicalnet_resnet10,
medicalnet_resnet10_23datasets,
medicalnet_resnet50,
medicalnet_resnet50_23datasets,
medicalnet_resnet101,
medicalnet_resnet152,
medic... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | warvito_MedicalNet-models_main/medicalnet_models/models/resnet.py | .py | 11,374 | 368 | from torch import Tensor
from typing import List, Type, Union
import errno
import os
from typing import Optional
import gdown
import torch
import torch.nn as nn
def conv3x3x3(in_planes: int, out_planes: int, stride: int = 1, dilation: int = 1) -> nn.Conv3d:
"""3x3x3 convolution with padding"""
return nn.Conv... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | ddpm/__init__.py | .py | 37 | 2 |
from ddpm.BiFlowNet import BiFlowNet | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | ddpm/utils.py | .py | 4,796 | 168 | """
Various utilities for neural networks.
"""
import math
import torch as th
import torch.nn as nn
class SiLU(nn.Module):
def forward(self, x):
return x * th.sigmoid(x)
class GroupNorm32(nn.GroupNorm):
def forward(self, x):
return super().forward(x.float()).type(x.dtype)
def conv_nd(di... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | ddpm/BiFlowNet.py | .py | 40,364 | 1,090 |
import math
import copy
import torch
from torch import nn, einsum
import torch.nn.functional as F
from functools import partial
import torchio as tio
from torch.utils import data
from pathlib import Path
from torch.optim import Adam
from torchvision import transforms as T, utils
from torch.cuda.amp import autocast, Gr... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | dataset/vqgan.py | .py | 3,077 | 77 |
import torch
from torch.utils.data.dataset import Dataset
import os
import random
import glob
import torchio as tio
import json
import random
class VQGANDataset(Dataset):
def __init__(self, root_dir=None, augmentation=False,split='train',stage = 1,patch_size = 64):
randnum = 216
self.file_names = ... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | dataset/tr_generate.py | .py | 873 | 31 |
import torch
from torch.utils.data.dataset import Dataset
import os
import glob
import torchio as tio
import json
class GenerateTrData_dataset(Dataset):
def __init__(self, root_dir=None,no_norm=False):
self.no_norm = no_norm
self.root_dir = root_dir
self.all_files = glob.glob(os.path.joi... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | dataset/__init__.py | .py | 97 | 6 |
from dataset.vqgan import VQGANDataset
from dataset.tr_generate import GenerateTrData_dataset
| Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | dataset/vqgan_4x.py | .py | 2,973 | 76 |
import torch
from torch.utils.data.dataset import Dataset
import os
import random
import glob
import torchio as tio
import json
import random
class VQGANDataset_4x(Dataset):
def __init__(self, root_dir=None, augmentation=False,split='train',stage = 1,patch_size = 64):
randnum = 216
self.file_names... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | dataset/Singleres_dataset.py | .py | 1,832 | 49 |
import numpy as np
import torch
from torch.utils.data.dataset import Dataset
import os
import glob
import numpy as np
import json
import torchio as tio
class Singleres_dataset(Dataset):
def __init__(self, root_dir=None, resolution= [32,32,32], generate_latents= False):
self.all_files = []
self.re... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | evaluation/class_conditional_generation.py | .py | 5,060 | 116 | import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.abspath(os.path.join(current_dir, ".."))
sys.path.append(project_root)
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import argparse
import os
from ddpm.BiFlowNet impor... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | evaluation/class_conditional_generation_4x.py | .py | 5,068 | 115 | import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.abspath(os.path.join(current_dir, ".."))
sys.path.append(project_root)
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import argparse
import os
from ddpm.BiFlowNet impor... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | train/generate_training_latent.py | .py | 2,022 | 60 |
import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.abspath(os.path.join(current_dir, ".."))
sys.path.append(project_root)
from torch.utils.data import DataLoader
from AutoEncoder.model.PatchVolume import patchvolumeAE
from dataset.Singleres_dataset import Singleres_d... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | train/train_PatchVolume.py | .py | 3,501 | 94 |
import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.abspath(os.path.join(current_dir, ".."))
sys.path.append(project_root)
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TensorBoardLogger
from... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | train/callbacks.py | .py | 3,178 | 91 |
import os
import numpy as np
from PIL import Image
import torch
import torchvision
from pytorch_lightning.callbacks import Callback
from pytorch_lightning.utilities.rank_zero import rank_zero_only
import torchio as tio
class VolumeLogger(Callback):
def __init__(self, batch_frequency, max_volumes, clamp=True... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | train/train_BiFlowNet_SingleRes.py | .py | 13,901 | 362 |
import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.abspath(os.path.join(current_dir, ".."))
sys.path.append(project_root)
import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True
import torch.distributed as dist
from torch.nn.par... | Python |
3D | ShanghaiTech-IMPACT/3D-MedDiffusion | train/train_PatchVolume_stage2.py | .py | 3,385 | 91 |
import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.abspath(os.path.join(current_dir, ".."))
sys.path.append(project_root)
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TensorBoardLogger
from... | Python |
3D | Demon-Kervin/3D-reconstruction | main_boundaryrecon.m | .m | 345 | 10 | % Example:
I = imread('E:\1PHD\Paper\1\proe network\94.bmp');
phi = ac_SDF_2D('rectangle', size(I), 10) ;
smooth_weight = 3; image_weight = 1e-3;
delta_t = 2; n_iters = 100; show_result = 1;
phi = ac_ChanVese_model(double(I), phi, smooth_weight, image_weight, ...
delta_t, n_iters, show_result);
% axis on
% grid... | MATLAB |
3D | brainglobe/brainreg-napari | brainreg_napari/sample_data.py | .py | 1,155 | 43 | import zipfile
from typing import List
import numpy as np
import pooch
from napari.types import LayerData
from skimage.io import imread
# git SHA for version of sample data to download
data_commit_sha = "72b73c52f19cee2173467ecdca60747a60e5fb95"
POOCH_REGISTRY = pooch.create(
path=pooch.os_cache("brainreg_napari... | Python |
3D | brainglobe/brainreg-napari | brainreg_napari/__init__.py | .py | 131 | 7 | import warnings
warnings.warn(
"brainreg-napari is deprecated, please switch to brainreg[napari].",
DeprecationWarning,
)
| Python |
3D | brainglobe/brainreg-napari | brainreg_napari/util.py | .py | 2,569 | 89 | import logging
from dataclasses import dataclass
import bg_space as bg
import numpy as np
import skimage.transform
from bg_atlasapi import BrainGlobeAtlas
from brainglobe_utils.general.system import get_num_processes
from tqdm import tqdm
def initialise_brainreg(atlas_key, data_orientation_key, voxel_sizes):
sca... | Python |
3D | brainglobe/brainreg-napari | brainreg_napari/register.py | .py | 21,784 | 584 | import json
import logging
import pathlib
from collections import namedtuple
from enum import Enum
from typing import Dict, List, Tuple
import bg_space as bg
import brainreg as program_for_log
import napari
import numpy as np
from bg_atlasapi import BrainGlobeAtlas
from brainglobe_napari_io.cellfinder.reader_dir impor... | Python |
3D | brainglobe/brainreg-napari | brainreg_napari/tests/__init__.py | .py | 0 | 0 | null | Python |
3D | brainglobe/brainreg-napari | brainreg_napari/tests/test_brainreg_napari.py | .py | 5,104 | 162 | import napari
import pytest
from bg_atlasapi import BrainGlobeAtlas
from brainreg_napari.register import (
add_registered_image_layers,
brainreg_register,
)
def test_add_detect_widget(make_napari_viewer):
"""
Smoke test to check that adding detection widget works
"""
viewer = make_napari_view... | Python |
3D | brainglobe/brainreg-napari | examples/load_sample_data.py | .py | 1,217 | 40 | """
Load and show sample data
=========================
This example:
- loads some sample data
- adds the data to a napari viewer
- loads the brainreg-napari registration plugin
- opens the napari viewer
"""
import napari
import numpy as np
from napari.layers import Layer
from brainreg_napari.sample_data import load_t... | Python |
3D | SZUHvern/D-UNet | data_load.py | .py | 8,790 | 256 | import nibabel as nib
import numpy as np
import os
import h5py
import random
import cv2
import copy
from matplotlib import pyplot as plt
from PIL import Image
import time
def nii_to_h5(path_nii,path_save,ratio=0.8):
data = []
label = []
ori = []
list_site = os.listdir(path_nii)
list_data = []
o... | Python |
3D | SZUHvern/D-UNet | model.py | .py | 17,534 | 519 | from __future__ import print_function
from keras.models import Model, load_model
from keras.optimizers import Adam, SGD
from keras.preprocessing.image import ImageDataGenerator
from keras.layers import *
from keras.callbacks import EarlyStopping, ModelCheckpoint
from keras.utils import multi_gpu_model
import math
impor... | Python |
3D | SZUHvern/D-UNet | Stroke_segment.py | .py | 6,124 | 149 | import numpy as np
import os
from model import *
from Statistics import *
if __name__ == "__main__":
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1"
path_h5_save = './h5/'
output_path = './model/'
dataset_name = '0.8'
load_weight = ''
mode = 'train' # use 'train' or 'detect'
img_size = [192, ... | Python |
3D | SZUHvern/D-UNet | Statistics.py | .py | 3,539 | 108 | from keras import backend as K
import numpy as np
def TP(y_true, y_pred):
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
true_positives = K.sum(K.round(K.clip(y_true_f * y_pred_f, 0, 1)))
return true_positives
def FP(y_true, y_pred):
y_true_f = K.flatten(y_true)
y_pred_f = K.flatte... | Python |
3D | overengineer/TR-FDTD | bitirme5.m | .m | 1,485 | 66 | clear all
close all
%TMz Polarization
%physical constants
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
nx = 249;
ny = 249;
delta = 1.2e-2; %1.2cm
dx = delta;
dy = delta;
dt = 20e-12; %0.95/(c*sqrt(dx^-2+dy^-2));
%f0 = 2e9; %2GHz
tw = 16*dt;
t0 = 200*dt;
srcx ... | MATLAB |
3D | overengineer/TR-FDTD | maxwell3d.py | .py | 2,255 | 104 | import torch
from math import sin, exp, sqrt, pi
def get_device():
try:
device = torch.device('cuda')
assert device
except:
device = torch.device('cpu')
return torch.device('cpu') #device
def zeros(m,n,k):
return torch.zeros((m,n,k), device=get_device(), dtype=torch.double)
de... | Python |
3D | overengineer/TR-FDTD | TR2D.m | .m | 1,295 | 60 | clear all
close all
load 'bitirme5.mat'
%TMz Polarization
%physical constants
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
nx = 249;
ny = 249;
delta = 1.2e-2; %1.2cm
dx = delta;
dy = delta;
dt = 20e-12; %0.95/(c*sqrt(dx^-2+dy^-2));
%f0 = 2e9; %2GHz
tw = 16*dt;
t0... | MATLAB |
3D | overengineer/TR-FDTD | diel_tumor_lin.m | .m | 4,148 | 160 | %physical constants
clear all;
close all;
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 0.5; % cm
height = 0.5;
length = 0.5; % cm
%source parameters
f0 = 1e9; % GHz
band = 2e9;
%tw = sqrt(-log(0.1)/(pi*band)^2);%1e-8/pi;
%spatial discretization
adipose = 1; %5... | MATLAB |
3D | overengineer/TR-FDTD | bitirme1.m | .m | 1,243 | 53 | %TMz Polarization
%physical constants
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
width = 1;
height = 1;
tw = 1e-9/pi;%?
t0 = 4*tw;
%discretization parameters
dx = 0.005;
dy = 0.005;
nx = width/dx;
ny = height/dy;
dt = 0.95/(c*sqrt(dx^-2+dy^-2));
%calculation p... | MATLAB |
3D | overengineer/TR-FDTD | Material3D.m | .m | 2,882 | 104 | %physical constants
clear all;
close all;
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 1;
height = 1;
length = 1;
%spatial discretization
dx = 0.02;
dy = dx;
dz = dx;
nx = width/dx;
ny = height/dy;
nz = length/dz;
%source
f0 =1e9;
tw = 1e-8/pi;
t0 = 4*tw;
src... | MATLAB |
3D | overengineer/TR-FDTD | Maxwell3D.m | .m | 2,511 | 83 | %physical constants
clear all;
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
width = 1;
height = 1;
depth = 1;
f0 =1e9;
tw = 1e-8/pi;%?
t0 = 4*tw;
%discretization parameters
dx = 0.01;
dy = dx;
dz = dx;
nx = width/dx;
ny = height/dy;
nz = depth/dz;
dt = 0.95... | MATLAB |
3D | overengineer/TR-FDTD | bitirme3.m | .m | 1,297 | 53 | clear all
close all
%TMz Polarization
%physical constants
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
nx = 249;
ny = 249;
delta = 1.2e-2; %1.2cm
dx = delta;
dy = delta;
dt = 20e-12;%0.95/(c*sqrt(dx^-2+dy^-2));
f0 = 2e9; % GHz
tw = 16*dt;
t0 = 200*dt;
eps_r =... | MATLAB |
3D | overengineer/TR-FDTD | kaynakTR_lossy.m | .m | 0 | 0 | null | MATLAB |
3D | overengineer/TR-FDTD | makale3d.m | .m | 3,918 | 152 | %physical constants
clear all;
close all;
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
nx = 249;
ny = 249;
delta = 1.2e-2; %1.2cm
dx = delta;
dy = delta;
dt = 20e-12; %0.95/(c*sqrt(dx^-2+dy^-2));
f0 = 2e9; %2GHz
tw = 16*dt;
t0 = 200*dt;
%spatial discretization
adipo... | MATLAB |
3D | overengineer/TR-FDTD | TR.m | .m | 3,739 | 139 | %physical constants
clear all;
close all;
load 'withtumor.mat';
load 'withouttumor.mat';
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 0.5; % 30cm
height = 0.5;
length = 0.5; % 1cm
%source parameters
f0 = 1e9; % GHz
band = 2e9;
tw = sqrt(-log(0.1)/(pi*band)^2... | MATLAB |
3D | overengineer/TR-FDTD | Conductivity.m | .m | 3,879 | 150 | %physical constants
clear all;
close all;
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 0.05; % cm
height = 0.05;
length = 0.002; % cm
%source parameters
f0 = 2e9; % GHz
tw = 1e-8/pi;
t0 = 4*tw;
%spatial discretization
adipose = 10;
tumor = 60;
sigma = 1... | MATLAB |
3D | overengineer/TR-FDTD | TR_lin.m | .m | 3,830 | 141 | %physical constants
clear all;
close all;
load 'withtumor.mat';
load 'withouttumor.mat';
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 0.5; % 30cm
height = 0.5;
length = 0.5; % 1cm
%source parameters
f0 = 1e9; % GHz
band = 2e9;
tw = sqrt(-log(0.1)/(pi*band)^2... | MATLAB |
3D | overengineer/TR-FDTD | WithoutTumor.m | .m | 3,851 | 147 | %physical constants
clear all;
close all;
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 0.5; % cm
height = 0.5;
length = 0.5; % cm
%source parameters
f0 = 1e9; % GHz
band = 2e9;
tw = sqrt(-log(0.1)/(pi*band)^2);%1e-8/pi;
t0 = 4*tw;
%spatial discretization
... | MATLAB |
3D | overengineer/TR-FDTD | bitirme2.m | .m | 1,302 | 53 | clear all
close all
%TMz Polarization
%physical constants
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
nx = 249;
ny = 249;
delta = 0.012; %1.2cm
dx = delta;
dy = delta;
dt = 20e-12;%0.95/(c*sqrt(dx^-2+dy^-2));
f0 = 2e9; % GHz
tw = 16*dt;
t0 = 200*dt;
eps_r = ... | MATLAB |
3D | overengineer/TR-FDTD | hytrf.m | .m | 0 | 0 | null | MATLAB |
3D | overengineer/TR-FDTD | diel_no_tumor_lin.m | .m | 3,831 | 147 | %physical constants
clear all;
close all;
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 0.5; % cm
height = 0.5;
length = 0.5; % cm
%source parameters
f0 = 1e9; % GHz
band = 2e9;
tw = sqrt(-log(0.1)/(pi*band)^2);%1e-8/pi;
t0 = 4*tw;
%spatial discretization
... | MATLAB |
3D | overengineer/TR-FDTD | WithTumor.m | .m | 4,179 | 160 | %physical constants
clear all;
close all;
c0 = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%box dimensions
width = 0.5; % cm
height = 0.5;
length = 0.5; % cm
%source parameters
f0 = 1e9; % GHz
band = 2e9;
%tw = sqrt(-log(0.1)/(pi*band)^2);%1e-8/pi;
%spatial discretization
adipose = 1; %5... | MATLAB |
3D | overengineer/TR-FDTD | bitirme4.m | .m | 1,300 | 53 | clear all
close all
%TMz Polarization
%physical constants
c = 2.998e8;
eta0 = 120*pi;
mu0 = pi*4e-7;
eps0 = 1e-9/(36*pi);
%environment parameters
nx = 249;
ny = 249;
delta = 1.2e-2; %1.2cm
dx = delta;
dy = delta;
dt = 20e-12; %0.95/(c*sqrt(dx^-2+dy^-2));
f0 = 2e9; %2GHz
tw = 16*dt;
t0 = 200*dt;
eps_r ... | MATLAB |
3D | overengineer/TR-FDTD | Eztr_lossy.m | .m | 0 | 0 | null | MATLAB |
3D | jianlin-cheng/TransFun | training.py | .py | 10,866 | 290 | import math
import os
import numpy as np
import torch.optim as optim
from torchsummary import summary
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score
import Constants
import params
from Dataset.Dataset import load_dataset
from models.gnn import GCN
import argparse
import torch
impo... | Python |
3D | jianlin-cheng/TransFun | predict.py | .py | 8,348 | 227 | import argparse
import os
import networkx as nx
import obonet
import torch
from Bio import SeqIO
from torch import optim
from torch_geometric.loader import DataLoader
import Constants
import params
from Dataset.Dataset import load_dataset
from models.gnn import GCN
from preprocessing.utils import load_ckp, get_sequenc... | Python |
3D | jianlin-cheng/TransFun | parser.py | .py | 1,369 | 29 | import warnings
import argparse
import os
import torch
warnings.filterwarnings("ignore", category=UserWarning)
os.environ['CUDA_LAUNCH_BLOCKING'] = "1"
parser = argparse.ArgumentParser()
parser.add_argument('--no-cuda', action='store_true', default=False, help='Disables CUDA training.')
parser.add_argument('--fastmo... | Python |
3D | jianlin-cheng/TransFun | params.py | .py | 918 | 40 | bio_kwargs = {
'hidden': 16,
'input_features_size': 1280,
'num_classes': 3774,
'edge_type': 'cbrt',
'edge_features': 0,
'egnn_layers': 12,
'layers': 1,
'device': 'cuda',
'wd': 5e-4
}
mol_kwargs = {
'hidden': 16,
'input_features_size': 1280,
'num_classes': 600,
'edge_... | Python |
3D | jianlin-cheng/TransFun | Constants.py | .py | 1,930 | 66 | residues = {
"A": 1, "C": 2, "D": 3, "E": 4, "F": 5, "G": 6, "H": 7, "I": 8, "K": 9, "L": 10, "M": 11,
"N": 12, "P": 13, "Q": 14, "R": 15, "S": 16, "T": 17, "V": 18, "W": 19, "Y": 20
}
INVALID_ACIDS = {"U", "O", "B", "Z", "J", "X", "*"}
amino_acids = {
"ALA": "A", "ARG": "R", "ASN": "N", "ASP": "D", "CYS"... | Python |
3D | jianlin-cheng/TransFun | net_utils.py | .py | 2,480 | 76 | import torch
import torch.nn as nn
from torch_geometric.nn import GCNConv, BatchNorm, global_add_pool, global_mean_pool, global_max_pool
class GCN(nn.Module):
def __init__(self, input_features, out_channels, relu=True):
super(GCN, self).__init__()
self.conv = GCNConv(input_features, out_channels)
... | Python |
3D | jianlin-cheng/TransFun | tools/jackhmmer.py | .py | 7,515 | 202 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python |
3D | jianlin-cheng/TransFun | tools/residue_constants.py | .py | 34,990 | 900 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python |
3D | jianlin-cheng/TransFun | tools/hhblits.py | .py | 5,522 | 155 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python |
3D | jianlin-cheng/TransFun | tools/utils.py | .py | 1,226 | 41 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python |
3D | jianlin-cheng/TransFun | tools/parsers.py | .py | 21,339 | 608 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python |
3D | jianlin-cheng/TransFun | tools/msa_identifiers.py | .py | 3,110 | 93 | # Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python |
3D | jianlin-cheng/TransFun | Sampler/ImbalancedDatasetSampler.py | .py | 3,323 | 90 | from typing import Callable
import torch
import Constants
from preprocessing.utils import class_distribution_counter, pickle_load
class ImbalancedDatasetSampler(torch.utils.data.sampler.Sampler):
"""Samples elements randomly from a given list of indices for imbalanced dataset
Arguments:
indices: a li... | Python |
3D | jianlin-cheng/TransFun | Sampler/Smote.py | .py | 2,953 | 86 | import torch
from random import randint
import random
class SMOTE(object):
def __init__(self, distance='euclidian', dims=512, k=5):
super(SMOTE, self).__init__()
self.newindex = 0
self.k = k
self.dims = dims
self.distance_measure = distance
def populate(self, N, i, nna... | Python |
3D | jianlin-cheng/TransFun | prep/utils.py | .py | 3,395 | 116 | from collections import deque, Counter
import warnings
import pandas as pd
import numpy as np
import math
BIOLOGICAL_PROCESS = 'GO:0008150'
MOLECULAR_FUNCTION = 'GO:0003674'
CELLULAR_COMPONENT = 'GO:0005575'
FUNC_DICT = {
'cc': CELLULAR_COMPONENT,
'mf': MOLECULAR_FUNCTION,
'bp': BIOLOGICAL_PROCESS
}
NAMES... | Python |
3D | jianlin-cheng/TransFun | models/gnn.py | .py | 5,528 | 134 | import itertools
import torch
from torch.nn import Sigmoid
from models.egnn_clean import egnn_clean as eg
import net_utils
class GCN(torch.nn.Module):
def __init__(self, **kwargs):
super(GCN, self).__init__()
input_features_size = kwargs['input_features_size']
hidden_channels = kwargs['h... | Python |
3D | jianlin-cheng/TransFun | models/egnn_clean/egnn_clean.py | .py | 8,270 | 217 | from torch import nn
import torch
from torch.nn import Sigmoid, Linear
from torch_geometric.nn import global_mean_pool
import net_utils
class E_GCL(nn.Module):
"""
E(n) Equivariant Convolutional Layer
re
"""
def __init__(self, input_nf, output_nf, hidden_nf, edges_in_d=0, act_fn=nn.SiLU(), resid... | Python |
3D | jianlin-cheng/TransFun | models/egnn_clean/__init__.py | .py | 0 | 0 | null | Python |
3D | jianlin-cheng/TransFun | preprocessing/preprocess.py | .py | 6,121 | 158 | import os
import subprocess
import pandas as pd
import torch
import esm
import torch.nn.functional as F
import Constants
from preprocessing.utils import pickle_save, pickle_load, count_proteins_biopython
# Script to test esm
def test_esm():
# Load ESM-1b model
model, alphabet = esm.pretrained.esm1b_t33_650M_... | Python |
3D | jianlin-cheng/TransFun | preprocessing/extract.py | .py | 5,095 | 137 | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import pathlib
import torch
from esm import Alphabet, FastaBatchedDataset, ProteinBertModel, pretr... | Python |
3D | jianlin-cheng/TransFun | preprocessing/create_go.py | .py | 27,035 | 617 | import os
import csv
import subprocess
import networkx as nx
import numpy as np
import obonet
import pandas as pd
from Bio.Seq import Seq
from Bio import SeqIO, SwissProt
from Bio.SeqRecord import SeqRecord
import Constants
from preprocessing.utils import pickle_save, pickle_load, get_sequence_from_pdb, fasta_for_msas... | Python |
3D | jianlin-cheng/TransFun | preprocessing/utils.py | .py | 13,800 | 405 | import math
import os, subprocess
import shutil
import pandas as pd
import torch
from Bio import SeqIO
import pickle
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from biopandas.pdb import PandasPdb
from collections import deque, Counter
import csv
from sklearn.metrics import roc_curve, auc
from torchv... | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.