Icon representing a recipe

Recipe: Contacts (actual) to RR file v0.1

created by Susume

Profile


Name
Contacts (actual) to RR file v0.1
ID
101869
Shared with
Public
Parent
Contacts to RR file
Children
None
Created on
February 15, 2016 at 04:32 AM UTC
Updated on
February 15, 2016 at 04:32 AM UTC
Description

Prints all actual contacts in CASP RR file format for use in external viewing program such as CMView. Before using output, replace spaces in data rows (not header rows) with tabs.

Best for


Code


-- Contacts to RR file -- Prints actual contacts in CASP RR format for viewing in external program such as CMView. -- CMView reads an RR file and displays a contact map, which can then be saved as a PNG file. -- It can also compare two contact maps in one image. -- Before using output, replace spaces in data rows (NOT header rows) with tabs. SPACE = " " MINDIST = 0 MAXDIST = 12 --pairs of residues closer than this many angstroms will appear in the RR file SeqLineLen = 50 --max characters per line in primary sequence SegCount = structure.GetCount() PuzzleName = puzzle.GetName() PuzzleNum = string.match(PuzzleName, "%d%d%d%d") function Header() print("PFRMAT RR") print("TARGET T"..PuzzleNum) --CMView contact viewer expects a T on front of target number print("MODEL 1") end function PrimarySequence() Seg = 0 -- segment counter repeat SeqLine = "" Char = 0 -- count of characters in Line repeat Seg = Seg+1 SeqLine = SeqLine..structure.GetAminoAcid(Seg) Char = Char+1 until Char==SeqLineLen or Seg==SegCount print(string.upper(SeqLine)) until Seg==SegCount end function Footer() print("END") end function DataRows() for i = 1, SegCount-2 do for j = i+2, SegCount do --Weight = contactmap.GetHeat(i, j) Weight = 1 --because these are actual contacts if structure.GetDistance(i,j) <= MAXDIST then print(i..SPACE..j..SPACE..MINDIST..SPACE..MAXDIST..SPACE..Weight) end end end end function Main() Header() PrimarySequence() DataRows() Footer() end ---------------- Main()

Comments