Icon representing a recipe

Recipe: Band cysteines

created by latin krepin

Profile


Name
Band cysteines
ID
108574
Shared with
Public
Parent
None
Children
Created on
March 11, 2024 at 08:58 AM UTC
Updated on
March 11, 2024 at 09:48 AM UTC
Description

band cysteine sulfurs close enough to make a disulfide bond. should work on most puzzles without input

Best for


Code


MIN_CYS_DISTANCE=6 DISULFIDE_BOND_LENGTH=2.05 BAND_STRENGTH=10 function MakePairsSet(segment_list) -- make sure each pair appears only once pairs_set={} for _, segment1 in pairs(segment_list) do for _, segment2 in pairs(segment_list) do if segment1 ~= segment2 then if segment1 > segment2 then subset={segment2,segment1} else subset={segment1,segment2} end -- use string as key because same tables can have different hashes key=table.concat(subset, '_') if pairs_set[key] == nil then pairs_set[key] = subset end end end end return pairs_set end function GetCysteines() cysteines={} cys_index=1 for i=1, structure.GetCount() do aa=structure.GetAminoAcid(i) if aa=='c' then cysteines[cys_index]=i cys_index=cys_index+1 end end return cysteines end cysteines = GetCysteines() cysteine_pairs = MakePairsSet(cysteines) for _, cysteine_pair in pairs(cysteine_pairs) do cysteine1, cysteine2 = unpack(cysteine_pair) band55 = band.AddBetweenSegments(cysteine1,cysteine2,5,5) band_length = band.GetLength(band55) band.Delete(band55) if band_length < MIN_CYS_DISTANCE then band66 = band.AddBetweenSegments(cysteine1,cysteine2,6,6) band.SetGoalLength(band66, DISULFIDE_BOND_LENGTH) band.SetStrength(band66, BAND_STRENGTH) end end

Comments