Skip to content

Commit

Permalink
#1899 Import of modified IDT monomers
Browse files Browse the repository at this point in the history
Add monomer library support.
Add IDT modification support.
Add UT
  • Loading branch information
AliaksandrDziarkach committed Apr 29, 2024
1 parent ba0747b commit 35f1928
Show file tree
Hide file tree
Showing 18 changed files with 4,748 additions and 872 deletions.
2 changes: 2 additions & 0 deletions api/tests/integration/ref/formats/idt_to_ket.py.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*** IDT to KET ***
idt_acg.ket:SUCCEED
idt_maxmgc.ket:SUCCEED
idt_2moera.ket:SUCCEED
idt_modifications.ket:SUCCEED
30 changes: 19 additions & 11 deletions api/tests/integration/tests/formats/idt_to_ket.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,29 @@ def find_diff(a, b):
root = joinPathPy("molecules/", __file__)
ref_path = joinPathPy("ref/", __file__)

fasta_files = [
"idt_acg",
"idt_maxmgc",
]

for filename in fasta_files:
mol = indigo.loadIdtFromFile(os.path.join(root, filename + ".idt"))
# with open(os.path.join(ref_path, filename) + ".ket", "w") as file:
idt_names = ["idt_acg", "idt_maxmgc", "idt_2moera", "idt_modifications"]

idt_data = {
"idt_acg": "ACG",
"idt_maxmgc": "mA*mGC",
"idt_2moera": "/52MOErA//i2MOErA//32MOErA/",
"idt_modifications": "/5Phos//i2MOErC//3Phos/",
}

lib = indigo.loadMoleculeFromFile(
os.path.join(ref_path, "monomer_library.ket")
)

for idt_name in idt_names:
mol = indigo.loadIdt(idt_data[idt_name])
# with open(os.path.join(ref_path, idt_name) + ".ket", "w") as file:
# file.write(mol.json())
with open(os.path.join(ref_path, filename) + ".ket", "r") as file:
with open(os.path.join(ref_path, idt_name) + ".ket", "r") as file:
ket_ref = file.read()
ket = mol.json()
diff = find_diff(ket_ref, ket)
if not diff:
print(filename + ".ket:SUCCEED")
print(idt_name + ".ket:SUCCEED")
else:
print(filename + ".ket:FAILED")
print(idt_name + ".ket:FAILED")
print(diff)
Loading

0 comments on commit 35f1928

Please sign in to comment.