-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from paulsbond/dev
Merging 2.0.1
- Loading branch information
Showing
9 changed files
with
84 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "2.0.0" | ||
__version__ = "2.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import functools | ||
import os | ||
import gemmi | ||
|
||
|
||
def _path(code: str) -> str: | ||
return os.path.join(os.environ["CLIBD_MON"], code[0].lower(), f"{code.upper()}.cif") | ||
|
||
|
||
@functools.lru_cache(maxsize=None) | ||
def atom_ids(code: str) -> set: | ||
return {atom.id for atom in chemcomp(code).atoms} | ||
|
||
|
||
@functools.lru_cache(maxsize=None) | ||
def chemcomp(code: str) -> gemmi.ChemComp: | ||
doc = gemmi.cif.read(_path(code)) | ||
return gemmi.make_chemcomp_from_block(doc[-1]) | ||
|
||
|
||
@functools.lru_cache(maxsize=None) | ||
def in_library(code: str) -> bool: | ||
return os.path.exists(_path(code)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import urllib.request | ||
import gemmi | ||
from modelcraft.cell import max_distortion, remove_scale, update_cell | ||
from modelcraft.structure import read_structure | ||
from . import in_temp_directory | ||
|
||
|
||
@in_temp_directory | ||
def test_1ana(): | ||
url = "https://ftp.ebi.ac.uk/pub/databases/pdb_versioned/data/entries/" | ||
url += "an/pdb_00001ana/pdb_00001ana_xyz_v1-2.cif.gz" | ||
urllib.request.urlretrieve(url, "1ana.cif.gz") | ||
structure = read_structure("1ana.cif.gz") | ||
assert structure.cell.parameters == (41.1, 41.1, 26.7, 90, 90, 90) | ||
assert structure.cell.fractionalization_matrix.tolist()[0][0] == 0 | ||
remove_scale(structure) | ||
assert structure.cell.fractionalization_matrix.tolist()[0][0] != 0 | ||
new_parameters = (41, 41, 27, 90, 90, 90) | ||
new_cell = gemmi.UnitCell(*new_parameters) | ||
assert max_distortion(structure.cell, new_cell) < 0.05 | ||
old_pos = list(structure[0][0][0][0].pos) | ||
update_cell(structure, new_cell) | ||
assert structure.cell.parameters == new_parameters | ||
new_pos = list(structure[0][0][0][0].pos) | ||
assert old_pos != new_pos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
gemmi >=0.4.0 | ||
numpy | ||
pandas | ||
requests | ||
scipy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters