From c5a52340bd6fdc33336a516a4b97058aa605ec51 Mon Sep 17 00:00:00 2001 From: Brady Johnston Date: Thu, 4 Jan 2024 11:32:44 +0800 Subject: [PATCH 1/3] extraction of ss from mmcif files --- molecularnodes/io/load.py | 3 +++ molecularnodes/io/local.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/molecularnodes/io/load.py b/molecularnodes/io/load.py index f2791d30..158440cf 100644 --- a/molecularnodes/io/load.py +++ b/molecularnodes/io/load.py @@ -66,6 +66,7 @@ def pdb_get_b_factors(file): b_factors.append(atoms.b_factor) return b_factors + def get_secondary_structure(array, file) -> np.array: """ Gets the secondary structure annotation that is included in mmtf files and returns it as a numerical numpy array. @@ -340,6 +341,8 @@ def att_is_carb(): return struc.filter_carbohydrates(array) def att_sec_struct(): + if hasattr(array, "sec_struct"): + return array.sec_struct if calculate_ss or not file: return comp_secondary_structure(array) else: diff --git a/molecularnodes/io/local.py b/molecularnodes/io/local.py index 9900e851..27e74c5b 100644 --- a/molecularnodes/io/local.py +++ b/molecularnodes/io/local.py @@ -1,4 +1,5 @@ import bpy +import numpy as np import warnings from .. import assembly from .load import create_molecule @@ -52,6 +53,7 @@ def load( except InvalidFileError: pass + else: warnings.warn("Unable to open local file. Format not supported.") # if bonds chosen but no bonds currently exist (mn.bonds is None) @@ -90,6 +92,35 @@ def load( return mol +def ss_id_to_numeric(id: str) -> int: + "Convert the given ids in the mmmCIF file to 1 AH / 2 BS / 3 Loop integers" + if "HELX" in id: + return int(1) + elif "STRN" in id: + return int(2) + else: + return int(3) + +class NoSecondaryStructureError(Exception): + """Raised when no secondary structure is found""" + pass + +def get_ss_mmcif(file): + conf = file.get_category('struct_conf') + if not conf: + raise NoSecondaryStructureError + starts = conf['beg_label_seq_id'].astype(int) + ends = conf['end_label_seq_id'].astype(int) + ss = conf['id'] + ss = np.array([ss_id_to_numeric(x) for x in ss]) + arrays = [] + for (start, end, s) in zip(starts, ends, ss): + arr = np.zeros((end - start + 1, 2), dtype=int) + arr[:, 0] = np.arange(start, end + 1, dtype=int) + arr[:, 1] = s + arrays.append(arr) + + return dict(np.vstack(arrays).tolist()) def open_structure_local_pdb(file_path): import biotite.structure.io.pdb as pdb @@ -116,6 +147,13 @@ def open_structure_local_pdbx(file_path): mol = pdbx.get_structure(file, extra_fields = ['b_factor', 'charge']) except InvalidFileError: mol = pdbx.get_component(file) + + try: + ss = get_ss_mmcif(file) + ss_per_atom = [ss.get(res_id, 3) for res_id in mol.res_id] + mol.set_annotation('sec_struct', ss_per_atom) + except NoSecondaryStructureError: + pass # pdbx doesn't include bond information apparently, so manually create them here if not mol.bonds: From 87b2408ee584efbfb097aceadae6e2efec134227 Mon Sep 17 00:00:00 2001 From: Brady Johnston Date: Thu, 4 Jan 2024 11:41:22 +0800 Subject: [PATCH 2/3] tweak secondary structure extraction --- molecularnodes/io/load.py | 69 +-- molecularnodes/io/pdb.py | 66 +++ .../test_color_chain/color_chain_values.txt | 410 +++++++++--------- 3 files changed, 272 insertions(+), 273 deletions(-) diff --git a/molecularnodes/io/load.py b/molecularnodes/io/load.py index 158440cf..52ff3a18 100644 --- a/molecularnodes/io/load.py +++ b/molecularnodes/io/load.py @@ -67,68 +67,7 @@ def pdb_get_b_factors(file): return b_factors -def get_secondary_structure(array, file) -> np.array: - """ - Gets the secondary structure annotation that is included in mmtf files and returns it as a numerical numpy array. - Parameters: - ----------- - array : numpy.array - The molecular coordinates array, from mmtf.get_structure() - file : mmtf.MMTFFile - The MMTF file containing the secondary structure information, from mmtf.MMTFFile.read() - - Returns: - -------- - atom_sse : numpy.array - Numerical numpy array representing the secondary structure of the molecule. - - Description: - ------------ - This function uses the biotite.structure package to extract the secondary structure information from the MMTF file. - The resulting secondary structures are `1: Alpha Helix, 2: Beta-sheet, 3: loop`. - """ - - from biotite.structure import spread_residue_wise - - sec_struct_codes = { - -1: "X", - 0 : "I", - 1 : "S", - 2 : "H", - 3 : "E", - 4 : "G", - 5 : "B", - 6 : "T", - 7 : "C" - } - - dssp_to_abc = { - "X" : 0, - "I" : 1, #"a", - "S" : 3, #"c", - "H" : 1, #"a", - "E" : 2, #"b", - "G" : 1, #"a", - "B" : 2, #"b", - "T" : 3, #"c", - "C" : 3 #"c" - } - - try: - sse = file["secStructList"] - except KeyError: - ss_int = np.full(len(array), 3) - print('Warning: "secStructList" field missing from MMTF file. Defaulting \ - to "loop" for all residues.') - else: - ss_int = np.array( - [dssp_to_abc.get(sec_struct_codes.get(ss)) for ss in sse], - dtype = int - ) - atom_sse = spread_residue_wise(array, ss_int) - - return atom_sse def comp_secondary_structure(array): @@ -343,14 +282,8 @@ def att_is_carb(): def att_sec_struct(): if hasattr(array, "sec_struct"): return array.sec_struct - if calculate_ss or not file: + if calculate_ss: return comp_secondary_structure(array) - else: - return get_secondary_structure(array, file) - - - - # these are all of the attributes that will be added to the structure # TODO add capcity for selection of particular attributes to include / not include to potentially diff --git a/molecularnodes/io/pdb.py b/molecularnodes/io/pdb.py index 120a6150..40e80623 100644 --- a/molecularnodes/io/pdb.py +++ b/molecularnodes/io/pdb.py @@ -86,6 +86,8 @@ def get_chain_entity_id(file): return ent_dic + + def set_atom_entity_id(mol, file): mol.add_annotation('entity_id', int) ent_dic = get_chain_entity_id(file) @@ -96,6 +98,69 @@ def set_atom_entity_id(mol, file): mol.set_annotation('entity_id', entity_ids) return entity_ids +def get_secondary_structure(array, file) -> np.array: + """ + Gets the secondary structure annotation that is included in mmtf files and returns it as a numerical numpy array. + + Parameters: + ----------- + array : numpy.array + The molecular coordinates array, from mmtf.get_structure() + file : mmtf.MMTFFile + The MMTF file containing the secondary structure information, from mmtf.MMTFFile.read() + + Returns: + -------- + atom_sse : numpy.array + Numerical numpy array representing the secondary structure of the molecule. + + Description: + ------------ + This function uses the biotite.structure package to extract the secondary structure information from the MMTF file. + The resulting secondary structures are `1: Alpha Helix, 2: Beta-sheet, 3: loop`. + """ + + from biotite.structure import spread_residue_wise + + sec_struct_codes = { + -1: "X", + 0 : "I", + 1 : "S", + 2 : "H", + 3 : "E", + 4 : "G", + 5 : "B", + 6 : "T", + 7 : "C" + } + + dssp_to_abc = { + "X" : 0, + "I" : 1, #"a", + "S" : 3, #"c", + "H" : 1, #"a", + "E" : 2, #"b", + "G" : 1, #"a", + "B" : 2, #"b", + "T" : 3, #"c", + "C" : 3 #"c" + } + + try: + sse = file["secStructList"] + except KeyError: + ss_int = np.full(len(array), 3) + print('Warning: "secStructList" field missing from MMTF file. Defaulting \ + to "loop" for all residues.') + else: + ss_int = np.array( + [dssp_to_abc.get(sec_struct_codes.get(ss)) for ss in sse], + dtype = int + ) + atom_sse = spread_residue_wise(array, ss_int) + + return atom_sse + def open_structure_rcsb(pdb_code, cache_dir = None): import biotite.structure.io.mmtf as mmtf import biotite.database.rcsb as rcsb @@ -107,6 +172,7 @@ def open_structure_rcsb(pdb_code, cache_dir = None): # the file. The stack will be of length = 1 if there is only one model in the file mol = mmtf.get_structure(file, extra_fields = ["b_factor", "charge"], include_bonds = True) set_atom_entity_id(mol, file) + mol.set_annotation('sec_struct', get_secondary_structure(mol, file)) return mol, file # operator that calls the function to import the structure from the PDB diff --git a/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt b/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt index d5e386c5..c21eabb4 100644 --- a/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt +++ b/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt @@ -1,60 +1,64 @@ -[[0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] +[[0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.84 0.747 0.36 1. ] + [0.84 0.36 0.8081 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.84 0.747 0.36 1. ] [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] [0.6402 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.8081 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.747 0.36 1. ] - [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] @@ -62,439 +66,435 @@ [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.6402 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.6347 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] + [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.8081 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.4866 1. ] + [0.6402 0.84 0.36 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.6347 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.84 0.36 0.4866 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.6402 0.84 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.84 0.747 0.36 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.6402 0.84 0.36 1. ] [0.6347 0.84 0.36 1. ] [0.84 0.36 0.8081 1. ] - [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.8081 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.84 0.36 0.4866 1. ] [0.84 0.36 0.4866 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.747 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] [0.84 0.747 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] - [0.7248 0.36 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] [0.84 0.36 0.8081 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.84 0.36 0.8081 1. ] - [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.6402 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] + [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.6347 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.84 0.747 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.84 0.747 0.36 1. ] - [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.8081 1. ] [0.84 0.36 0.8081 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.6402 0.84 0.36 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] + [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.8081 1. ] [0.7248 0.36 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.84 0.747 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.6402 0.84 0.36 1. ] [0.6347 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.6347 0.84 0.36 1. ] [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.36 0.8081 1. ] [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] + [0.7248 0.36 0.84 1. ] [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.6402 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.6347 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] + [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ]] \ No newline at end of file + [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ]] \ No newline at end of file From 484599f0f64649e4d497aafcdbca1d6f4604ff1d Mon Sep 17 00:00:00 2001 From: Brady Johnston Date: Fri, 5 Jan 2024 09:59:11 +0800 Subject: [PATCH 3/3] update test fix tests Revert "update test" This reverts commit 3b5b2fd0bd90aba9313f04f970c38acec014a36b. fix and add tests --- molecularnodes/blender/nodes.py | 2 +- molecularnodes/io/local.py | 60 ++- molecularnodes/io/pdb.py | 50 ++- .../test_color_chain/color_chain_values.txt | 404 +++++++++--------- .../test_get_ss_from_mmcif/sec_struc.txt | 3 + tests/test_load.py | 4 +- tests/test_pdbx.py | 26 ++ 7 files changed, 313 insertions(+), 236 deletions(-) create mode 100644 tests/snapshots/test_pdbx/test_get_ss_from_mmcif/sec_struc.txt create mode 100644 tests/test_pdbx.py diff --git a/molecularnodes/blender/nodes.py b/molecularnodes/blender/nodes.py index c2bb9406..13c30aed 100644 --- a/molecularnodes/blender/nodes.py +++ b/molecularnodes/blender/nodes.py @@ -663,7 +663,7 @@ def chain_color(name, input_list, label_prefix = "Chain ", field = "chain_id", s # create an input for this chain group.interface.new_socket(current_chain, in_out='INPUT', socket_type='NodeSocketColor').default_value = color.random_rgb(i) - # switch input colours 10 and 11 + # switch color input values for colors are index 10 and 11 link(node_input.outputs[current_chain], node_color.inputs[11]) link(node_compare.outputs['Result'], node_color.inputs['Switch']) diff --git a/molecularnodes/io/local.py b/molecularnodes/io/local.py index 27e74c5b..05400059 100644 --- a/molecularnodes/io/local.py +++ b/molecularnodes/io/local.py @@ -105,22 +105,51 @@ class NoSecondaryStructureError(Exception): """Raised when no secondary structure is found""" pass -def get_ss_mmcif(file): +def get_ss_mmcif(mol, file): + import biotite.structure as struc + conf = file.get_category('struct_conf') if not conf: raise NoSecondaryStructureError - starts = conf['beg_label_seq_id'].astype(int) - ends = conf['end_label_seq_id'].astype(int) - ss = conf['id'] - ss = np.array([ss_id_to_numeric(x) for x in ss]) - arrays = [] - for (start, end, s) in zip(starts, ends, ss): - arr = np.zeros((end - start + 1, 2), dtype=int) - arr[:, 0] = np.arange(start, end + 1, dtype=int) - arr[:, 1] = s - arrays.append(arr) - - return dict(np.vstack(arrays).tolist()) + starts = conf['beg_auth_seq_id'].astype(int) + ends = conf['end_auth_seq_id'].astype(int) + chains = conf['end_auth_asym_id'].astype(str) + id_label = conf['id'].astype(str) + + sheet = file.get_category('struct_sheet_range') + if sheet: + starts = np.append(starts, sheet['beg_auth_seq_id'].astype(int)) + ends = np.append(ends, sheet['end_auth_seq_id'].astype(int)) + chains = np.append(chains, sheet['end_auth_asym_id'].astype(str)) + id_label = np.append(id_label, np.repeat('STRN', len(sheet['id']))) + + id_int = np.array([ss_id_to_numeric(x) for x in id_label]) + lookup = dict() + for chain in np.unique(chains): + arrays = [] + mask = (chain == chains) + start_sub = starts[mask] + end_sub = ends[mask] + id_sub = id_int[mask] + + for (start, end, id) in zip(start_sub, end_sub, id_sub): + idx = np.arange(start, end + 1, dtype = int) + arr = np.zeros((len(idx), 2), dtype = int) + arr[:, 0] = idx + arr[:, 1] = 3 + arr[:, 1] = id + arrays.append(arr) + + lookup[chain] = dict(np.vstack(arrays).tolist()) + + ss = [] + + for i, (chain_id, res_id) in enumerate(zip(mol.chain_id, mol.res_id)): + ss.append(lookup[chain_id].get(res_id, 3)) + + arr = np.array(ss, dtype = int) + arr[~struc.filter_amino_acids(mol)] = 0 + return arr def open_structure_local_pdb(file_path): import biotite.structure.io.pdb as pdb @@ -132,6 +161,7 @@ def open_structure_local_pdb(file_path): mol = pdb.get_structure(file, extra_fields = ['b_factor', 'charge'], include_bonds = True) return mol, file + def open_structure_local_pdbx(file_path): import biotite.structure as struc import biotite.structure.io.pdbx as pdbx @@ -149,9 +179,7 @@ def open_structure_local_pdbx(file_path): mol = pdbx.get_component(file) try: - ss = get_ss_mmcif(file) - ss_per_atom = [ss.get(res_id, 3) for res_id in mol.res_id] - mol.set_annotation('sec_struct', ss_per_atom) + mol.set_annotation('sec_struct', get_ss_mmcif(mol, file)) except NoSecondaryStructureError: pass diff --git a/molecularnodes/io/pdb.py b/molecularnodes/io/pdb.py index 40e80623..53dd5c7e 100644 --- a/molecularnodes/io/pdb.py +++ b/molecularnodes/io/pdb.py @@ -43,7 +43,7 @@ def load( mol, coll_frames = create_molecule( array = mol, - name = pdb_code, + name = pdb_code, file = file, calculate_ss = False, centre = centre, @@ -123,27 +123,47 @@ def get_secondary_structure(array, file) -> np.array: from biotite.structure import spread_residue_wise sec_struct_codes = { - -1: "X", - 0 : "I", - 1 : "S", - 2 : "H", - 3 : "E", - 4 : "G", - 5 : "B", - 6 : "T", - 7 : "C" + -1: "X", # undefined + 0 : "I", # pi helix + 1 : "S", # bend + 2 : "H", # alpha helix + 3 : "E", # extended + 4 : "G", # 3-10 helix + 5 : "B", # bridge + 6 : "T", # turn + 7 : "C" # coil } + # convert to 1 AH / 2 BS / 3 LOOP + dssp_codes_to_int = { + -1: 0, # undefined + + 0 : 1, # pi helix + 2 : 1, # alpha helix + 4 : 1, # 3-10 helix + + 3 : 2, # extended + 5 : 2, # bridge + + 6 : 3, # turn + 1 : 3, # bend + 7 : 3 # coil + } + + + dssp_to_abc = { "X" : 0, - "I" : 1, #"a", - "S" : 3, #"c", + "I" : 3, #"a", + "G" : 1, #"a", "H" : 1, #"a", + "E" : 2, #"b", - "G" : 1, #"a", "B" : 2, #"b", + "T" : 3, #"c", - "C" : 3 #"c" + "S" : 3, #"c", + "C" : 3 #"c" } try: @@ -153,11 +173,13 @@ def get_secondary_structure(array, file) -> np.array: print('Warning: "secStructList" field missing from MMTF file. Defaulting \ to "loop" for all residues.') else: + pass ss_int = np.array( [dssp_to_abc.get(sec_struct_codes.get(ss)) for ss in sse], dtype = int ) atom_sse = spread_residue_wise(array, ss_int) + # atom_sse = spread_residue_wise(array, sse) return atom_sse diff --git a/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt b/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt index c21eabb4..6e1262a8 100644 --- a/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt +++ b/tests/snapshots/test_nodes/test_color_chain/color_chain_values.txt @@ -1,169 +1,182 @@ -[[0.6402 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] +[[0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.6402 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.6347 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.4866 1. ] - [0.6402 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.36 0.4866 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.36 0.8081 1. ] [0.7248 0.36 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] [0.84 0.36 0.4866 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.6347 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.7248 0.36 0.84 1. ] - [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.4866 1. ] + [0.6347 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] @@ -173,328 +186,315 @@ [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.84 0.747 0.36 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] - [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.6347 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.6402 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.4866 1. ] [0.84 0.36 0.4866 1. ] - [0.6347 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.4866 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] + [0.7248 0.36 0.84 1. ] [0.6402 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] + [0.6347 0.84 0.36 1. ] [0.84 0.36 0.8081 1. ] + [0.84 0.747 0.36 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] [0.6402 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] + [0.84 0.747 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.84 0.36 0.8081 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.747 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.84 0.747 0.36 1. ] - [0.84 0.747 0.36 1. ] - [0.6347 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.7248 0.36 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.7248 0.36 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.6402 0.84 0.36 1. ] [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.747 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.6347 0.84 0.36 1. ] [0.6347 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.747 0.36 1. ] + [0.84 0.36 0.8081 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.84 0.36 0.4866 1. ] + [0.7248 0.36 0.84 1. ] [0.84 0.36 0.8081 1. ] - [0.6347 0.84 0.36 1. ] + [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] + [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.84 0.36 0.4866 1. ] - [0.6402 0.84 0.36 1. ] - [0.36 0.486 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] [0.6347 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.747 0.36 1. ] [0.84 0.36 0.8081 1. ] + [0.84 0.36 0.4866 1. ] [0.84 0.36 0.8081 1. ] - [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.4866 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.6347 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] + [0.84 0.36 0.8081 1. ] + [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6347 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] + [0.84 0.747 0.36 1. ] + [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] + [0.84 0.36 0.4866 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] + [0.84 0.36 0.8081 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.7248 0.36 0.84 1. ] [0.36 0.486 0.84 1. ] [0.84 0.36 0.4866 1. ] + [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] + [0.6402 0.84 0.36 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.4866 1. ] - [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.6347 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] + [0.84 0.36 0.8081 1. ] + [0.84 0.36 0.8081 1. ] + [0.36 0.486 0.84 1. ] [0.7248 0.36 0.84 1. ] - [0.7248 0.36 0.84 1. ] + [0.6347 0.84 0.36 1. ] + [0.36 0.486 0.84 1. ] [0.84 0.36 0.8081 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] [0.36 0.486 0.84 1. ] [0.36 0.486 0.84 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.747 0.36 1. ] - [0.6347 0.84 0.36 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.36 0.8081 1. ] - [0.84 0.747 0.36 1. ] - [0.84 0.747 0.36 1. ] - [0.36 0.486 0.84 1. ] - [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] [0.84 0.36 0.4866 1. ] [0.36 0.486 0.84 1. ] + [0.7248 0.36 0.84 1. ] + [0.84 0.36 0.8081 1. ] [0.36 0.486 0.84 1. ] - [0.36 0.486 0.84 1. ] - [0.6402 0.84 0.36 1. ] - [0.7248 0.36 0.84 1. ]] \ No newline at end of file + [0.84 0.36 0.8081 1. ] + [0.6347 0.84 0.36 1. ] + [0.84 0.36 0.8081 1. ] + [0.36 0.486 0.84 1. ]] \ No newline at end of file diff --git a/tests/snapshots/test_pdbx/test_get_ss_from_mmcif/sec_struc.txt b/tests/snapshots/test_pdbx/test_get_ss_from_mmcif/sec_struc.txt new file mode 100644 index 00000000..c44bfb3a --- /dev/null +++ b/tests/snapshots/test_pdbx/test_get_ss_from_mmcif/sec_struc.txt @@ -0,0 +1,3 @@ +[3 1 3 1 1 3 1 3 2 3 3 1 3 3 3 3 2 3 1 1 3 2 1 3 1 3 1 3 2 3 3 1 3 2 1 3 3 + 3 3 2 1 2 3 2 1 3 3 1 1 3 3 3 1 3 3 3 3 1 1 3 3 3 1 1 0 3 2 1 1 1 3 1 3 3 + 1 1 3 3 2 1 3 1 3 3 3 3 1 3 3 1 3 3 3 1 3 3 2 1 3 3] \ No newline at end of file diff --git a/tests/test_load.py b/tests/test_load.py index c2dbc125..002a6dea 100644 --- a/tests/test_load.py +++ b/tests/test_load.py @@ -2,7 +2,6 @@ import pytest import tempfile import molecularnodes as mn -import numpy as np from .constants import ( test_data_directory, codes, @@ -77,7 +76,6 @@ def test_load_small_mol(snapshot): edges = ''.join([str(bond_type) for bond_type in bond_types]) snapshot.assert_match(edges, 'asn_edges.txt') - def test_rcsb_cache(snapshot): from pathlib import Path import tempfile @@ -94,4 +92,4 @@ def test_rcsb_cache(snapshot): assert os.path.exists(file) obj_2 = mn.io.pdb.load('6BQN', style='cartoon', cache_dir=test_cache) - assert get_verts(obj_1) == get_verts(obj_2) + assert get_verts(obj_1) == get_verts(obj_2) \ No newline at end of file diff --git a/tests/test_pdbx.py b/tests/test_pdbx.py new file mode 100644 index 00000000..e722af95 --- /dev/null +++ b/tests/test_pdbx.py @@ -0,0 +1,26 @@ +import molecularnodes as mn +import numpy as np + +import random +from .constants import test_data_directory +from .utils import sample_attribute_to_string + + + +def test_ss_id_to_numeric(): + examples = ['TURN_TY1_P68', 'BEND64', 'HELX_LH_PP_P9', 'STRN44'] + assert [3, 3, 1, 2] == [mn.io.local.ss_id_to_numeric(x) for x in examples] + +def test_get_ss_from_mmcif(snapshot): + mol, file = mn.io.local.open_structure_local_pdbx(test_data_directory / '1cd3.cif') + mol2, fil2 = mn.io.pdb.open_structure_rcsb('1cd3') + + random.seed(6) + random_idx = random.sample(range(mol.array_length()), 100) + + # assert (mol.sec_struct == mol2.sec_struct)[random_idx].all() + + snapshot.assert_match( + np.array2string(mol.sec_struct[random_idx], precision = 3, threshold = 1e4), + "sec_struc.txt" + ) \ No newline at end of file