Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/benatorc/PA-Graph-Transformer
/ functions
Functions
113 in github.com/benatorc/PA-Graph-Transformer
⨍
Functions
113
◇
Types & classes
12
↓ 14 callers
Method
add_stat
(self, stat_name, val, norm=1)
utils/data_utils.py:19
↓ 10 callers
Function
onek_unk_encoding
Returns a one-hot encoding of the given feature.
graph/mol_features.py:67
↓ 8 callers
Function
get_loader
(raw_data, split_indices, args, shuffle=False, num_workers=5, batch_size=0)
datasets/mol_dataset.py:39
↓ 8 callers
Function
get_shortest_paths
Returns the shortest paths for the given rd_mol. For every pair of atoms, if they are connected by a path <= max_path_length the atoms on
preprocess/shortest_paths.py:37
↓ 6 callers
Function
ordered_pair
(pair)
parse/generate_ring_data.py:12
↓ 4 callers
Function
assert_dict_equal
(source, target)
preprocess/test_shortest_paths.py:7
↓ 4 callers
Method
get_stats
(self)
utils/data_utils.py:25
↓ 3 callers
Function
create_dirs
(args, output_dir)
arguments.py:91
↓ 2 callers
Method
add_bond
(self, bond)
graph/mol_graph.py:41
↓ 2 callers
Function
generate_complex_ring_data
(smiles, n_pos, n_neg)
parse/generate_ring_data.py:133
↓ 2 callers
Function
get_args
()
arguments.py:6
↓ 2 callers
Function
get_grad_norm
(model, debug=False)
utils/train_utils.py:7
↓ 2 callers
Function
get_neigh_if_conjugated
(mol, atom_idx, ring)
parse/generate_ring_data.py:164
↓ 2 callers
Function
get_non_ring_neighbor
(mol, atom_idx, ring)
parse/generate_ring_data.py:96
↓ 2 callers
Function
get_num_path_features
Returns the number of path features for the model.
utils/path_utils.py:78
↓ 2 callers
Method
index_select_nei
(self, input, dim, index)
modules/conv_layer.py:31
↓ 2 callers
Function
init_model
(args, n_classes)
train/train_prop.py:15
↓ 2 callers
Function
init_model
(args, n_classes)
train/train_ring.py:16
↓ 2 callers
Function
is_conjugated_path
(mol, path_atoms)
parse/generate_ring_data.py:124
↓ 2 callers
Function
load_datasets
(raw_data, split_idx, args)
train/train_prop.py:23
↓ 2 callers
Function
load_datasets
(raw_data, split_idx, args, n_workers=5)
train/train_ring.py:24
↓ 2 callers
Function
test_model
(dataset_loaders, model, stat_names, train_func, args, inference_func=None)
train/train_base.py:101
↓ 2 callers
Function
train_model
(dataset_loaders, model, optimizer, stat_names, selection_stat, train_func, args, select_highe
train/train_base.py:7
↓ 1 callers
Method
_parse_molecules
Turn the smiles into atom and bonds through rdkit. Every bond is recorded as two directional bonds, and for each atom, keep track
graph/mol_graph.py:97
↓ 1 callers
Method
aggregate_atom_h
(self, atom_h, scope)
models/prop_predictor.py:29
↓ 1 callers
Method
avg_attn
(self, attn_probs, n_heads, batch_sz, max_atoms)
models/mol_transformer.py:82
↓ 1 callers
Method
compute_attn_probs
(self, attn_input, attn_mask, layer_idx, eps=1e-20)
models/mol_transformer.py:53
↓ 1 callers
Method
compute_nei_score
(self, attn_probs, path_mask)
models/mol_transformer.py:75
↓ 1 callers
Function
generate_ring_data
(smiles, n_pos, n_neg)
parse/generate_ring_data.py:30
↓ 1 callers
Function
generate_ring_position_data
(smiles, max_samples)
parse/generate_ring_data.py:77
↓ 1 callers
Function
get_args
()
utils/test_path_utils.py:11
↓ 1 callers
Function
get_atom_frag
Returns the fragment the atom belongs to.
preprocess/shortest_paths.py:50
↓ 1 callers
Method
get_atom_inputs
Constructs only the atom inputs for the batch of molecules.
graph/mol_graph.py:144
↓ 1 callers
Method
get_attn_input
(self, atom_h, path_input, max_atoms)
models/mol_transformer.py:44
↓ 1 callers
Method
get_graph_inputs
Constructs the graph inputs for the conv net. Returns: A tuple of tensors/numpy arrays that contains the input to the GCN.
graph/mol_graph.py:160
↓ 1 callers
Function
get_path_atoms
Given a pair of atom indices, returns the list of atoms on the path. Args: atom_1: The start atom on the path. atom_2: The end at
utils/path_utils.py:91
↓ 1 callers
Function
get_path_features
Returns a feature array for the path. Args: rd_mol: The rdkit mol object, used to extract features. path_atoms: A list of atoms i
utils/path_utils.py:138
↓ 1 callers
Function
get_ring_features
(ring_dict, atom_pair)
utils/path_utils.py:170
↓ 1 callers
Function
get_ring_paths
(rd_mol)
preprocess/shortest_paths.py:16
↓ 1 callers
Function
main
()
parse/split_data.py:27
↓ 1 callers
Function
main
()
parse/generate_ring_data.py:232
↓ 1 callers
Function
main
()
train/train_prop.py:43
↓ 1 callers
Function
main
()
train/train_ring.py:44
↓ 1 callers
Function
main
()
preprocess/shortest_paths.py:114
↓ 1 callers
Function
ordered_pair
(a1, a2)
utils/path_utils.py:8
↓ 1 callers
Function
ordered_pair
(a1, a2)
preprocess/shortest_paths.py:9
↓ 1 callers
Function
parse_mol
(data_dir, max_path_length)
preprocess/shortest_paths.py:97
↓ 1 callers
Function
read_mol_smiles
(data_path)
preprocess/shortest_paths.py:85
↓ 1 callers
Function
read_smiles
(data_path)
parse/generate_ring_data.py:20
↓ 1 callers
Function
read_smiles_from_file
(data_path)
utils/data_utils.py:47
↓ 1 callers
Function
split_data
Split the data in smiles_list to train, dev and test
parse/split_data.py:8
↓ 1 callers
Function
write_args
(args)
arguments.py:100
↓ 1 callers
Function
write_ring_output
(write_file, smiles_list, atom_pair_idx, labels, preds, n_classes=1)
train/train_ring.py:197
Method
__getitem__
(self, index)
datasets/mol_dataset.py:20
Method
__init__
(self, args)
modules/attention.py:6
Method
__init__
Creates graph conv layers for molecular graphs.
modules/conv_layer.py:9
Method
__init__
(self, stat_names)
utils/data_utils.py:7
Method
__init__
(self, raw_data, split_indices, args)
datasets/mol_dataset.py:9
Method
__init__
(self, args, use_attn=False)
models/mol_conv_net.py:10
Method
__init__
(self, args, n_classes=1)
models/atom_predictor.py:10
Method
__init__
(self, args, n_classes=1)
models/prop_predictor.py:10
Method
__init__
(self, args)
models/mol_transformer.py:11
Method
__init__
Initialize the atom object to keep track of its attributes. Args: idx: The index of the atom in the original molecule.
graph/mol_graph.py:18
Method
__init__
Initialize the bond object to keep track of its attributes.
graph/mol_graph.py:46
Method
__init__
(self, atoms, bonds)
graph/mol_graph.py:59
Method
__init__
Initialize the molecular graph inputs for the smiles list. Args: smiles_list: The input smiles strings in a list
graph/mol_graph.py:72
Method
__len__
(self)
datasets/mol_dataset.py:35
Function
backprop_grads
(model, optimizer, stats_tracker, args)
utils/train_utils.py:19
Function
bt_index_to_float
(bt_index)
graph/mol_features.py:36
Function
combine_data
(data)
datasets/mol_dataset.py:43
Function
compute_acc
(input_probs, target, n_classes=1)
utils/train_utils.py:29
Function
compute_auc
(input_probs, target)
utils/train_utils.py:39
Function
compute_max_atoms
Given the scopes for a batch of molecules, computes max atoms.
utils/model_utils.py:5
Function
convert_to_2D
Convert back to 2D Args: input: A tensor of shape [batch size, max padding, # features] scope: A list of start/length indices for
utils/model_utils.py:60
Function
convert_to_3D
Converts the input to a 3D batch matrix Args: input: A tensor of shape [# atoms, # features] scope: A list of start/length indice
utils/model_utils.py:14
Function
create_dir_if_not_exists
(dir_path)
utils/data_utils.py:112
Function
dict_to_dstr
Convert dictionary to a csv-friendly string.
utils/data_utils.py:128
Function
dict_to_pstr
Convert dictionary to a print-friendly string, sorted by key.
utils/data_utils.py:117
Method
forward
(self, atom_h, scope)
modules/attention.py:14
Method
forward
(self, graph_inputs)
modules/conv_layer.py:41
Method
forward
(self, mol_graph, stats_tracker=None)
models/mol_conv_net.py:22
Method
forward
(self, mol_graph, pair_idx, stats_tracker, output_attn=False)
models/atom_predictor.py:29
Method
forward
(self, mol_graph, stats_tracker, output_attn=False)
models/prop_predictor.py:43
Method
forward
(self, mol_graph, stats_tracker=None)
models/mol_transformer.py:88
Function
get_atom_features
Given an atom object, returns a numpy array of features.
graph/mol_features.py:74
Method
get_bond
(self, atom_1, atom_2)
graph/mol_graph.py:63
Function
get_bond_features
Given an bond object, returns a numpy array of features. bond can be None, in which case returns default features for a non-bond.
graph/mol_features.py:95
Function
get_bt_feature
Returns a one-hot vector representing the bond_type.
graph/mol_features.py:117
Function
get_bt_index
Returns the feature index for a particular bond type. Args: bond_type: Either a rdchem bond type object (can be None) or a float
graph/mol_features.py:53
Method
get_n_atoms
(self)
graph/mol_graph.py:93
Function
get_path_bond_feature
Given a rdkit bond object, returns the bond features for that bond. When the given input is none, returns a 0-vector
graph/mol_features.py:124
Function
get_path_input
(mols, shortest_paths, max_atoms, args, output_tensor=True)
utils/path_utils.py:15
Function
get_test_loader
(raw_data, split_idx, args)
train/train_prop.py:36
Function
get_test_loader
(raw_data, split_idx, args)
train/train_ring.py:37
Function
load_shortest_paths
(args)
utils/data_utils.py:101
Function
map_equiv
(source_map, target_map)
utils/data_utils.py:136
Function
merge_path_inputs
Merge path input matrices. Does not create CUDA tensors intentionally
utils/path_utils.py:57
Function
read_smiles_from_dir
(data_dir)
utils/data_utils.py:91
Function
read_smiles_multiclass
(data_path)
utils/data_utils.py:58
Function
read_smiles_ring_data
(data_path)
utils/data_utils.py:71
next →
1–100 of 113, ranked by callers