Skip to content

Commit

Permalink
Flake fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jwtoney committed Feb 5, 2024
1 parent 71c2af1 commit e5570d6
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion molSimplify/Informatics/MOF/MOF_descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def make_MOF_SBU_RACs(SBUlist, SBU_subgraph, molcif, depth, name, cell_v, anchor
"""""""""
functional_atoms = []
for jj in range(len(temp_mol.graph)):
if not jj in link_list: # linker atom is not bonded to a metal
if jj not in link_list: # linker atom is not bonded to a metal
if not set({temp_mol.atoms[jj].sym}) & set({"C","H"}): # not a carbon nor a hydrogen. syms get symbols.
functional_atoms.append(jj)
"""""""""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def make_MOF_SBU_RACs(SBUlist, SBU_subgraph, molcif, depth, name,cell,anchoring_
for jj in range(len(temp_mol.graph)):
#print(link_list)
#print(main)
if not jj in main:
if jj not in main:

Check warning on line 143 in molSimplify/Informatics/MOF/MOF_descriptors_alternate_functional.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/MOF_descriptors_alternate_functional.py#L143

Added line #L143 was not covered by tests
if not set({temp_mol.atoms[jj].sym}) & set({"H"}):
functional_atoms.append(jj)
print(functional_atoms)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def make_MOF_SBU_RACs(SBUlist, SBU_subgraph, molcif, depth, name,cell,anchoring_
#print(main)
#print(link_list)
if jj in main:
if not jj in link_list:
if jj not in link_list:

Check warning on line 142 in molSimplify/Informatics/MOF/MOF_descriptors_alternate_functional_2.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/MOF_descriptors_alternate_functional_2.py#L142

Added line #L142 was not covered by tests
if not set({temp_mol.atoms[jj].sym}) & set({"C","H"}):
functional_atoms.append(jj)
else:
Expand Down
6 changes: 3 additions & 3 deletions molSimplify/Informatics/MOF/PBC_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def returnXYZandGraph(filename, atoms, cell, fcoords, molgraph):
cart_coord=np.dot(fcoord,cell)
coord_list.append([cart_coord[0],cart_coord[1],cart_coord[2]])
tmpstr=",".join([at for at in atoms])
if filename != None:
if filename is not None:

Check warning on line 395 in molSimplify/Informatics/MOF/PBC_functions.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/PBC_functions.py#L395

Added line #L395 was not covered by tests
np.savetxt(filename[:-4]+".net",molgraph,fmt="%i",delimiter=",",header=tmpstr)
return coord_list, molgraph

Expand Down Expand Up @@ -936,7 +936,7 @@ def get_closed_subgraph(linkers, SBUlist, adj_matrix):
current_linker_list = current_linker_list-SBUlist
checked_list.add(start_idx)
for val in loop_over:
if (not val in SBUlist):
if val not in SBUlist:

Check warning on line 939 in molSimplify/Informatics/MOF/PBC_functions.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/PBC_functions.py#L939

Added line #L939 was not covered by tests
current_linker_list.update(np.nonzero(adj_matrix[val])[1]) # np.nonzero(adj_matrix[val])[1] are the indices of atoms with bonds to the atom with index val
left_to_check = current_linker_list-checked_list-SBUlist # Linker atoms whose connecting atoms still need to be checked.
if len(left_to_check) == 0:
Expand Down Expand Up @@ -1042,7 +1042,7 @@ def disorder_detector(name):
disordered_atom_types = []
disordered_atom_occupancies = []

if occupancy_index != False: # This means that occupancy information is available
if occupancy_index: # This means that occupancy information is available

Check warning on line 1045 in molSimplify/Informatics/MOF/PBC_functions.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/PBC_functions.py#L1045

Added line #L1045 was not covered by tests
for idx, at in enumerate(atomlines): # Go through the lines of the cif with atom specific information. Atom by atom.
ln=at.strip().split()

Expand Down
2 changes: 1 addition & 1 deletion molSimplify/Informatics/MOF/cluster_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def make_MOF_SBU_RACs(SBUlist, SBU_subgraph, molcif, depth, name,cell,anchoring_
"""""""""
functional_atoms = []
for jj in range(len(temp_mol.graph)):
if not jj in link_list:
if jj not in link_list:

Check warning on line 86 in molSimplify/Informatics/MOF/cluster_extraction.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/cluster_extraction.py#L86

Added line #L86 was not covered by tests
if not set({temp_mol.atoms[jj].sym}) & set({"C","H"}):
functional_atoms.append(jj)
# At this point, we look at the cycles for the graph, then add atoms if they are part of a cycle
Expand Down
6 changes: 2 additions & 4 deletions molSimplify/Informatics/MOF/fragment_MOFs_for_pormake.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,13 @@ def identify_short_linkers(molcif, initial_SBU_list, initial_SBU_subgraphlist, r
else:
# check number of times we cross PBC :
# TODO: we still can fail in multidentate ligands!
linker_cart_coords = np.array([at.coords() \
for at in [molcif.getAtom(val) for val in atoms_list]])
linker_cart_coords = np.array([at.coords() for at in [molcif.getAtom(val) for val in atoms_list]])

Check warning on line 685 in molSimplify/Informatics/MOF/fragment_MOFs_for_pormake.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/fragment_MOFs_for_pormake.py#L685

Added line #L685 was not covered by tests
linker_adjmat = np.array(linker_subgraphlist[ii])
pr_image_organic = ligand_detect(cell_v, linker_cart_coords, linker_adjmat, linkeranchors_list)
sbu_temp = linkeranchors_atoms.copy()
sbu_temp.update({val for val in initial_SBU_list[list(sbu_connect_list)[0]]})
sbu_temp = list(sbu_temp)
sbu_cart_coords = np.array([at.coords() \
for at in [molcif.getAtom(val) for val in sbu_temp]])
sbu_cart_coords = np.array([at.coords() for at in [molcif.getAtom(val) for val in sbu_temp]])

Check warning on line 691 in molSimplify/Informatics/MOF/fragment_MOFs_for_pormake.py

View check run for this annotation

Codecov / codecov/patch

molSimplify/Informatics/MOF/fragment_MOFs_for_pormake.py#L691

Added line #L691 was not covered by tests
sbu_adjmat = slice_mat(adj_matrix.todense(), sbu_temp)
pr_image_sbu = ligand_detect(cell_v, sbu_cart_coords, sbu_adjmat,set(range(len(linkeranchors_list))))
if not (len(np.unique(pr_image_sbu, axis=0))==1 and len(np.unique(pr_image_organic, axis=0))==1): # linker
Expand Down

0 comments on commit e5570d6

Please sign in to comment.