Conversation
A protein is one long chain that folds into one particular shape, and the shape is the entire point -- it decides what the protein does, and the same links in a different arrangement do a different job or none. protein.py reads an entry from RCSB and builds it at a size you can walk round. The default draws the fold and not the atoms. Every atom gives a solid lump, because the inside of a protein is packed and the chain you came to see is buried; one point per amino acid, joined up, is the chain itself. --style spacefill gives the lump, which is worth seeing once for exactly that reason. Colours are the secondary structure, and they are read rather than guessed: a PDB file carries HELIX and SHEET records written by whoever solved the structure, so red helix / yellow sheet / white loops is what the crystallo- graphers said, not what some heuristic here decided. It reproduces the known composition of four very different folds -- myoglobin 118 helix and 0 sheet, haemoglobin 448 and 0, both all-alpha globins; GFP 16 and 107, a beta barrel; crambin 21 and 8. The format is punch-card fixed columns and that is the whole difficulty. An atom NAMED "CA" in columns 13-16 is the alpha carbon every amino acid has in the middle of it; an atom whose ELEMENT is "CA" in columns 77-78 is calcium. Split the line on whitespace and the chain trace grows a spur out to wherever the calcium ion is sitting. There is a test for that, and for altLoc, waters, ligands and NMR models, all against inline text and no network. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kq1Cjkh3bVT1WLzh5FRVQG
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
protein.pyreads an entry from RCSB, live, and builds it at a size you can walk round.The default draws the fold, not the atoms. A protein is one long chain that folds into one shape, and the shape is the point. Drawn as every atom you get a solid lump, because the inside of a protein is packed and the chain you came to see is buried. One point per amino acid, joined up, is the chain.
--style spacefillgives the lump, which is worth seeing once for exactly that reason.The colours are read, not guessed. A PDB file carries
HELIXandSHEETrecords written by whoever solved the structure, so red helix / yellow sheet / white loops is what the crystallographers said. It reproduces the known composition of four very different folds:Two globins with zero sheet and GFP overwhelmingly sheet is not something a parsing bug lands.
The format is punch cards, and that is the whole difficulty. An atom named
CAin columns 13–16 is the alpha carbon every amino acid has in the middle of it; an atom whose element isCAin columns 77–78 is calcium. Split the line on whitespace and the chain trace grows a spur out to wherever the calcium ion sits. There's a test for that, and for altLoc conformers, waters, ligands and NMR models — all against inline text, no network.Built and verified in-world: 1UBQ came out at exactly the planned 14,613 blocks, with the colour split (42% sheet / 37% loop / 21% helix) mirroring the residue counts.
14 new tests, 250 total.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kq1Cjkh3bVT1WLzh5FRVQG