Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/colbuilder/chimera_scripts/generate_copies.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def apply_unit_cell_translation(model, translation, cell_params):
TRANSLATIONS = [
# (-4, 0, -4), # D4 = For strand 1 (blue) - top (1-2 interactions)
# (-3, 0, -3), # D3 =For strand 2 (green)
# (-2, 0, -2), # D2 =For strand 3 (pink)
# (-1, 0, -1), # D1 = For strand 4 (purple)
(0, 0, 0), # D0 = For strand 5 (orange) - reference position
(-5, 0, -4), # D5 = For strand 1 (blue) - bottom (5-1 interactions)
(-2, 0, -2), # D2 =For strand 3 (pink)
(-1, 0, -1), # D1 = For strand 4 (purple)
# (0, 0, 0), # D0 = For strand 5 (orange) - reference position
# (-5, 0, -4), # D5 = For strand 1 (blue) - bottom (5-1 interactions)
]

input_pdb = os.environ.get("INPUT_PDB")
Expand Down
17 changes: 17 additions & 0 deletions src/colbuilder/core/geometry/crosslink.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,21 @@ def read_crosslink(pdb_file: Union[str, Path]) -> List[Crosslink]:
)
)

elif (line[17:20] in ("LZD") and line[13:15] == "CE") or (
line[17:20] in ("LZS") and line[13:15] == "NZ1"
):
crosslinks.append(
Crosslink(
resid=line[22:26].strip(),
resname=line[17:20],
chain=line[21],
position=[
float(line[29:38]),
float(line[38:46]),
float(line[46:56]),
],
type="D",
)
)

return crosslinks
5 changes: 4 additions & 1 deletion src/colbuilder/core/sequence/optimize_crosslinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,7 @@ def optimize_crosslink(
LOG.debug("\nPhase 1: Backbone exploration")
angle_steps = np.linspace(-np.pi / 2, np.pi / 2, 8)
for residue_type in residue_types:
#restype_best_tracker = TransformationTracker()
for angle in angle_steps:
structures_copy = {k: v.copy() for k, v in best_structures.items()}
temp_tracker = TransformationTracker()
Expand All @@ -1032,12 +1033,13 @@ def optimize_crosslink(
if current_distance < best_distance:
best_distance = current_distance
best_structures = {k: v.copy() for k, v in structures_copy.items()}
best_tracker = temp_tracker.copy()
#restype_best_tracker = temp_tracker.copy()
current_tracker.update_from(temp_tracker)
if is_divalent:
LOG.debug(f"Improved distance: {dist1:.2f}")
else:
LOG.debug(f"Improved: {dist1:.2f}, {dist2:.2f}")
best_tracker = current_tracker.copy()

# Phase 2: Main optimization
LOG.debug("\nPhase 2: Main optimization")
Expand Down Expand Up @@ -1151,6 +1153,7 @@ def optimize_crosslink(

if accept:
current_tracker.update_from(temp_tracker)
best_tracker.update_from(temp_tracker)
if new_max_distance < best_max_distance:
best_max_distance = new_max_distance
best_structures = {k: v.copy() for k, v in structures.items()}
Expand Down
4 changes: 4 additions & 0 deletions src/colbuilder/core/utils/crosslinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,11 @@ async def optimize(self, input_pdb: Path, output_pdb: Path) -> Tuple[float, Path

# Generate new copies based on the current best input
generated_pdbs = await self._generate_copies(best_input)


all_generated_pdbs.extend(generated_pdbs)


if len(generated_pdbs) < 2:
raise SequenceGenerationError(
"Not enough PDB copies generated for optimization",
Expand Down Expand Up @@ -333,6 +336,7 @@ async def optimize(self, input_pdb: Path, output_pdb: Path) -> Tuple[float, Path
async def _generate_copies(self, input_pdb: Path) -> List[Path]:
"""Generate copies using Chimera."""
try:

generate_copies_script = self.chimera_scripts_dir / "generate_copies.py"
generated_pdbs_file = Path("generated_pdbs.txt")

Expand Down
Binary file added src/colbuilder/data/sequence/.crosslinks.csv.swp
Binary file not shown.
Loading