Refactor summary_lines to ChainPairScoreResults dataclass#1
Conversation
Co-authored-by: y1zhou <17245097+y1zhou@users.noreply.github.com>
Co-authored-by: y1zhou <17245097+y1zhou@users.noreply.github.com>
|
@copilot Change the class name to |
Co-authored-by: y1zhou <17245097+y1zhou@users.noreply.github.com>
Done in 1e11f5a. Renamed:
|
|
@copilot What are some potential ways of refactoring the |
The
Potential refactoring approaches: Option 1: PyMOLCommand dataclass hierarchy @dataclass
class PyMOLAliasCommand:
name: str # e.g., "color_A_B"
chain1: str
chain2: str
color1: str
color2: str
resi_ranges1: str
resi_ranges2: str
def to_line(self) -> str: ...Option 2: Extend ChainPairScoreResults Option 3: Separate PyMOLScript dataclass @dataclass
class PyMOLScript:
header: str
chain_pair_comments: list[str] # from ChainPairScoreResults
alias_commands: list[PyMOLAliasCommand]
def to_lines(self) -> list[str]: ...Option 1 is cleanest for the alias commands. Option 3 provides the best structure for the full script. The challenge is that alias commands need residue range data that isn't currently in |
Introduces a
ChainPairScoreResultsdataclass for chain-pair summary scores, matching the existingPerResScoreResultspattern. Replaceslist[str]with structured data and strict formatting methods.Changes
ChainPairScoreResultsdataclass with 24 fields for chain-pair metrics (Chn1/Chn2, PAE/Dist cutoffs, ipSAE variants, pDockQ/pDockQ2, LIS, n0/d0 values, etc.)to_formatted_line(),header_line(),csv_header_line()for consistent outputScoreResults.summary_lines: list[str]→chain_pair_scores: list[ChainPairScoreResults]ScoreResults.by_res_data→by_res_scoresfor consistencyaggregate_byres_scores()to returnlist[ChainPairScoreResults]write_outputs()andmain()to use dataclass methodsOutput files verified identical to existing examples for AF2 and AF3 model types.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.