Skip to content

Commit

Permalink
add a few more xml scripts. Most are just examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadolfbr committed Sep 14, 2018
1 parent 3bd3f7b commit 802ecaa
Show file tree
Hide file tree
Showing 16 changed files with 484 additions and 40 deletions.
34 changes: 34 additions & 0 deletions apps/public/pdb_utils/fix_space_chain.py
@@ -0,0 +1,34 @@
#!/usr/bin/env python
import os,sys

def insert (source_str, insert_str, pos):
return source_str[:pos]+insert_str+source_str[pos:]

if __name__ == "__main__":

if len(sys.argv) == 1:
sys.exit("Fixes symmetry perl script issue with chains that are spaces. First argument is the pdb file")
input_pdb_file = sys.argv[1]

lines = open(input_pdb_file, 'r').readlines()
new_lines = []
for line in lines:
#print line
new_line = line
if len(line) > 4:
print line[0:6]
if line[0:6] == "HETATM":
chain_column = 22-1
chain = line[chain_column]
print chain
if chain == ' ' or len(line.strip()) == 77:
new_line = insert(new_line, " ", chain_column)


new_lines.append(new_line)


OUTFILE = open("test_pdb.pdb", 'w')
for line in new_lines:
OUTFILE.write(line)
OUTFILE.close()
43 changes: 43 additions & 0 deletions apps/public/pyrosetta/get_phi_psi.py
@@ -0,0 +1,43 @@
#!/usr/bin/env python

#Simple Script to get Phi/Psi using PyRosetta.
from __future__ import print_function
from argparse import ArgumentParser

import rosetta
from pyrosetta import *
pyrosetta.init()







if __name__ == "__main__":
parser = ArgumentParser("Get Phi/Psi of all residues in protein or a range of residues")


parser.add_argument('-s', help="Input Structure", required=True)
parser.add_argument('--start', help = "Starting resnum (pose/PDB - EX:24L)")
parser.add_argument('--span', help = "Number of residues to print from start")


options = parser.parse_args()


p = pose_from_pdb(options.s)

start = 1
if options.start:
start = rosetta.core.pose.parse_resnum(options.start, p)

end = p.total_residue()
if options.span:
end = start+int(options.span)

out = "res resPDB phi psi"
print(out)
for i in range(start, end+1):
out = str(i)+" "+p.pdb_info().pose2pdb(i)+" "+str(180+p.phi(i))+" "+str(180+p.psi(i))
print(out)
17 changes: 11 additions & 6 deletions apps/public/rosetta/score_analysis.py
Expand Up @@ -15,7 +15,7 @@
from jade.rosetta_jade.ScoreFiles import ScoreFile
from jade.basic.plotting.MakeFigure import *

import shutil
import os

########################################################################

Expand All @@ -27,10 +27,15 @@ def get_parser():
parser = ArgumentParser(
description="This utility parses and extracts data from score files in JSON format")

parser.add_argument("scorefiles", nargs='*', help="A list of scorefiles")
#parser.add_argument("scorefiles", nargs='*', help="A list of scorefiles")

parser.add_argument("-s", "--scoretypes",
default=["dSASA_int", "delta_unsatHbonds", "hbonds_int", "total_score", "dG_separated", "top_n_by_10"],
parser.add_argument("-s", "--scorefiles",
help = "Scorefiles to use",
nargs="*",
required = True)

parser.add_argument("--scoretypes",
default=["total_score"],
help="List of score terms to extract",
nargs='*')

Expand Down Expand Up @@ -376,14 +381,14 @@ def main():

for i in range(0, options.top_n):
print get_decoy_path(top_by_n_decoys[i][1])
shutil.copy(get_decoy_path(top_by_n_decoys[i][1]), options.outdir)
os.system("cp " +get_decoy_path(top_by_n_decoys[i][1]) +" "+options.outdir)
else:
ordered = sf.get_ordered_decoy_list(scoreterm, top_n=int(options.top_n), decoy_names=decoy_names)
top_decoys = [[o[0], pdb_dir + "/" + o[1]] for o in ordered]

for i in range(0, options.top_n):
print get_decoy_path(top_decoys[i][1])
shutil.copy(get_decoy_path(top_decoys[i][1]), options.outdir)
os.system("cp "+ get_decoy_path(top_decoys[i][1])+" "+ options.outdir)

########################################################################

Expand Down
14 changes: 14 additions & 0 deletions database/rosetta/xml_scripts/GTR.xml
@@ -0,0 +1,14 @@
<ROSETTASCRIPTS>
<RESIDUE_SELECTORS>
<Glycan name="all_glycans"/>
</RESIDUE_SELECTORS>
<SIMPLE_METRICS>
<TimingProfileMetric name="timing"/>
</SIMPLE_METRICS>
<MOVERS>
<GlycanTreeRelax name="model" layer_size="2" window_size="1" rounds="1" refine="false" />
</MOVERS>
<PROTOCOLS>
<Add mover="model" />
</PROTOCOLS>
</ROSETTASCRIPTS>
24 changes: 24 additions & 0 deletions database/rosetta/xml_scripts/analyze_interface_and_rmsd.xml
@@ -0,0 +1,24 @@
<ROSETTASCRIPTS>
<SCOREFXNS>
</SCOREFXNS>
<RESIDUE_SELECTORS>
</RESIDUE_SELECTORS>
<TASKOPERATIONS>
</TASKOPERATIONS>
<MOVE_MAP_FACTORIES>
</MOVE_MAP_FACTORIES>
<SIMPLE_METRICS>
<RMSDMetric name="rmsd" use_native="1" rmsd_type="rmsd_all_heavy" />
</SIMPLE_METRICS>
<FILTERS>
</FILTERS>
<MOVERS>
<InterfaceAnalyzerMover name="iam" pack_separated="1" interface="LH_A" packstat="0" />
<RunSimpleMetrics name="metrics" metrics="rmsd" />
</MOVERS>
<PROTOCOLS>
<Add mover="iam" />
<Add mover="metrics" />
</PROTOCOLS>
<OUTPUT />
</ROSETTASCRIPTS>
54 changes: 54 additions & 0 deletions database/rosetta/xml_scripts/design_focus_basic.xml
@@ -0,0 +1,54 @@
<ROSETTASCRIPTS>
<SCOREFXNS>
</SCOREFXNS>
<RESIDUE_SELECTORS>
<Index name="design_positions" resnums="%%positions%%"/>
<Neighborhood name="nbrhood" selector="design_positions" include_focus_in_subset="0"/>
<Neighborhood name="all_focus" selector="design_positions"/>
<Not name="others" selector="all_focus" />

</RESIDUE_SELECTORS>
<TASKOPERATIONS>
<OperateOnResidueSubset name="turn_off_others" selector="others"><PreventRepackingRLT/> </OperateOnResidueSubset>

<OperateOnResidueSubset name="rtrp" selector="nbrhood" ><RestrictToRepackingRLT /></OperateOnResidueSubset>
<OperateOnResidueSubset name="rtrp_all" selector="all_focus"><RestrictToRepackingRLT/> </OperateOnResidueSubset>
</TASKOPERATIONS>
<MOVE_MAP_FACTORIES>
</MOVE_MAP_FACTORIES>
<SIMPLE_METRICS>
<TimingProfileMetric name="timing"/>
<TotalEnergyMetric name="total_energy_delta" reference_name="pre_design_pose" custom_type="delta"/>
<TotalEnergyMetric name="total_energy_delta_native" use_native="1" custom_type="delta-native"/>
<SelectedResiduesMetric name="selection" residue_selector="design_positions"/>
<SelectedResiduesMetric name="rosetta_sele" residue_selector="design_positions" rosetta_numbering="1"/>
<SelectedResiduesPyMOLMetric name="pymol_selection" residue_selector="design_positions" />
<SelectedResiduesPyMOLMetric name="region" residue_selector="all_focus" custom_type="region"/>
<SequenceMetric name="sequence" residue_selector="design_positions" />
<ProtocolSettingsMetric name="settings" limit_to_options="positions,protocol"/>
</SIMPLE_METRICS>
<FILTERS>
</FILTERS>
<MOVERS>
<PackRotamersMover name="pack_focus" task_operations="rtrp_all,turn_off_others" />
<PackRotamersMover name="pack_focus_design" task_operations="rtrp,turn_off_others" />
<RunSimpleMetrics name="post_design_metrics" metrics="total_energy_delta,timing,selection,rosetta_sele,pymol_selection,region,sequence,total_energy_delta_native,settings" />
<SavePoseMover name="store_pre_design_pose" restore_pose="0" reference_name="pre_design_pose" />
<SavePoseMover name="store_current" restore_pose="0" reference_name="current"/>

<SavePoseMover name="get_current" restore_pose="1" reference_name="current"/>
</MOVERS>
<PROTOCOLS>

Run Packer on input as a CONTROL for score comparisons
<Add mover="store_current"/>
<Add mover="pack_focus"/>
<Add mover="store_pre_design_pose"/>

Run Packer to do design
<Add mover="get_current"/>
<Add mover="pack_focus_design" />
<Add mover="post_design_metrics" />
</PROTOCOLS>
<OUTPUT />
</ROSETTASCRIPTS>
71 changes: 71 additions & 0 deletions database/rosetta/xml_scripts/design_focus_cart_rel.xml
@@ -0,0 +1,71 @@
<ROSETTASCRIPTS>
<SCOREFXNS>
<ScoreFunction name="cart" weights="ref2015_cart" symmetric="0">
<!--Reweight scoretype="dihedral_constraint" weight=".3" /!-->
<Reweight scoretype="coordinate_constraint" weight="1.0"/>
</ScoreFunction>
</SCOREFXNS>
<RESIDUE_SELECTORS>
<Index name="design_positions" resnums="%%positions%%"/>
<Neighborhood name="nbrhood" selector="design_positions" include_focus_in_subset="0"/>
<Neighborhood name="all_focus" selector="design_positions"/>
<Not name="others" selector="all_focus" />

</RESIDUE_SELECTORS>
<TASKOPERATIONS>
<OperateOnResidueSubset name="turn_off_others" selector="others"><PreventRepackingRLT/></OperateOnResidueSubset>

<OperateOnResidueSubset name="rtrp" selector="nbrhood"><RestrictToRepackingRLT/></OperateOnResidueSubset>
<OperateOnResidueSubset name="rtrp_all" selector="all_focus"><RestrictToRepackingRLT/></OperateOnResidueSubset>

</TASKOPERATIONS>
<MOVE_MAP_FACTORIES>
<MoveMapFactory name="fr_mm_factory" bb="0" chi="0" cartesian="1">
<Chi residue_selector="all_focus" enable="1"/>
<Backbone residue_selector="all_focus" enable="1" />
</MoveMapFactory>
</MOVE_MAP_FACTORIES>
<SIMPLE_METRICS>
<TimingProfileMetric name="timing"/>
<TotalEnergyMetric name="total_energy_delta" reference_name="pre_design_pose" custom_type="delta"/>
<TotalEnergyMetric name="total_energy_delta_cart" reference_name="pre_design_pose" scorefxn="cart" custom_type="delta_cart"/>
<TotalEnergyMetric name="total_energy_delta_native" use_native="1" custom_type="delta-native"/>
<SelectedResiduesMetric name="selection" residue_selector="design_positions"/>
<SelectedResiduesMetric name="rosetta_sele" residue_selector="design_positions" rosetta_numbering="1"/>
<SelectedResiduesPyMOLMetric name="pymol_selection" residue_selector="design_positions" />
<SelectedResiduesPyMOLMetric name="region" residue_selector="all_focus" custom_type="region"/>
<SequenceMetric name="sequence" residue_selector="design_positions" />
<RMSDMetric name="rmsd" use_native="1" rmsd_type="rmsd_protein_bb_heavy"/>
<ProtocolSettingsMetric name="settings" limit_to_options="positions,protocol"/>
</SIMPLE_METRICS>
<FILTERS>
</FILTERS>
<MOVERS>
<FastRelax name="cart_focus" task_operations="rtrp_all,turn_off_others" movemap_factory="fr_mm_factory" cartesian="1" scorefxn="cart" ramp_down_constraints="1"/>
<FastRelax name="cart_focus_design" task_operations="rtrp,turn_off_others" movemap_factory="fr_mm_factory" cartesian="1" scorefxn="cart" ramp_down_constraints="1" disable_design="0"/>
<AddConstraintsToCurrentConformationMover name="apply_coordinate_constraints" cst_weight="1.0" use_distance_cst="False" coord_dev="0.5" bound_width="0" CA_only="True" bb_only="False" />
<ClearConstraintsMover name="remove_coordinate_constraints" />
<RunSimpleMetrics name="post_design_metrics" metrics="total_energy_delta,timing,selection,rosetta_sele,pymol_selection,region,sequence,rmsd,total_energy_delta_native,settings" />
<SavePoseMover name="store_pre_design_pose" restore_pose="0" reference_name="pre_design_pose" />
<SavePoseMover name="store_current" restore_pose="0" reference_name="current"/>
<SavePoseMover name="get_current" restore_pose="1" reference_name="current"/>
</MOVERS>
<PROTOCOLS>

Run Cartesian on input PDB as a SCORE CONTROL
<Add mover="apply_coordinate_constraints"/>
<Add mover="store_current"/>
<Add mover="cart_focus"/>

Make sure Coordinate Constraints are still there after ramp.
<Add mover="apply_coordinate_constraints" />
<Add mover="store_pre_design_pose"/>

Get original pose and run design.
<Add mover="get_current"/>
<Add mover="cart_focus_design" />
<Add mover="remove_coordinate_constraints"/>
<Add mover="post_design_metrics" />
</PROTOCOLS>
<OUTPUT />
</ROSETTASCRIPTS>
73 changes: 73 additions & 0 deletions database/rosetta/xml_scripts/design_focus_rel_ab_scan.xml
@@ -0,0 +1,73 @@
<ROSETTASCRIPTS>
<SCOREFXNS>
<ScoreFunction name="cart" weights="ref2015_cart" symmetric="0">
<!--Reweight scoretype="dihedral_constraint" weight=".3" /!-->
<Reweight scoretype="dihedral_constraint" weight=".3"/>
</ScoreFunction>
</SCOREFXNS>
<RESIDUE_SELECTORS>
<CDR name="cdr_rel" cdrs="%%cdrs%%" />
<Index name="design_positions" resnums="%%positions%%"/>
<Neighborhood name="nbrhood" selector="cdr_rel" include_focus_in_subset="0"/>
<Neighborhood name="all_cdrs_and_neighbors" selector="cdr_rel" include_focus_in_subset="1"/>

<Not name="not_designing" selector="design_positions" />
<Not name="not_packing" selector="all_cdrs_and_neighbors" />
</RESIDUE_SELECTORS>
<TASKOPERATIONS>
<OperateOnResidueSubset name="turn_off_others" selector="not_packing"><PreventRepackingRLT/></OperateOnResidueSubset>

<OperateOnResidueSubset name="rtrp" selector="not_designing"><RestrictToRepackingRLT/></OperateOnResidueSubset>

<ResfileCommandOperation name="cmd" command="%%cmd%%" residue_selector="design_positions"/>
</TASKOPERATIONS>
<MOVE_MAP_FACTORIES>
<MoveMapFactory name="fr_mm_factory" bb="0" chi="0" cartesian="1">
<Chi residue_selector="cdr_rel" enable="1"/>
<Backbone residue_selector="cdr_rel" enable="1" />
</MoveMapFactory>
</MOVE_MAP_FACTORIES>
<SIMPLE_METRICS>
<TimingProfileMetric name="timing"/>
<TotalEnergyMetric name="total_energy_delta_native" use_native="1" custom_type="delta-native"/>
<SelectedResiduesMetric name="selection" residue_selector="design_positions"/>
<SelectedResiduesMetric name="rosetta_sele" residue_selector="design_positions" rosetta_numbering="1"/>
<SelectedResiduesPyMOLMetric name="pymol_selection" residue_selector="design_positions" />
<SelectedResiduesPyMOLMetric name="region" residue_selector="all_cdrs_and_neighbors" custom_type="region"/>
<SequenceMetric name="sequence" residue_selector="design_positions" />
<RMSDMetric name="rmsd" use_native="1" rmsd_type="rmsd_protein_bb_heavy"/>
</SIMPLE_METRICS>
<FILTERS>
</FILTERS>
<MOVERS>
<FastRelax name="cart_focus" task_operations="turn_off_others" movemap_factory="fr_mm_factory" cartesian="1" scorefxn="cart" ramp_down_constraints="0"/>
<FastRelax name="cart_focus_design" task_operations="rtrp,turn_off_others,cmd" movemap_factory="fr_mm_factory" cartesian="1" scorefxn="cart" ramp_down_constraints="1" disable_design="0"/>
<AddConstraintsToCurrentConformationMover name="apply_coordinate_constraints" cst_weight="1.0" use_distance_cst="False" coord_dev="0.5" bound_width="0" CA_only="True" bb_only="False" />
<ClearConstraintsMover name="remove_constraints" />
<RunSimpleMetrics name="post_design_metrics" metrics="timing,selection,rosetta_sele,pymol_selection,region,sequence,rmsd,total_energy_delta_native" />
<AddConstraints name="apply_dih_csts">
<DihedralConstraintGenerator name="dih_cst_phi" dihedral="phi" residue_selector="cdr_rel" />
<DihedralConstraintGenerator name="dih_cst_psi" dihedral="psi" residue_selector="cdr_rel" />
</AddConstraints>
<RemoveConstraints name="rm_csts" constraint_generators="dih_cst_phi,dih_cst_psi" />

We are not going to do a general way here. I need to refactor this to be able to set a specific set of CDRs
For now, we manually do it.
<CDRDihedralConstraintMover name="H1_cst" cdr="H1" use_cluster_csts="1" />
<CDRDihedralConstraintMover name="H2_cst" cdr="H2" use_cluster_csts="1" />
<CDRDihedralConstraintMover name="H3_cst" cdr="H3" use_cluster_csts="1" />
</MOVERS>
<PROTOCOLS>

<!--Add mover="apply_dih_csts"/-->
<Add mover="H1_cst"/>
<Add mover="H2_cst"/>
<Add mover="H3_cst"/>

Get original pose and run design.
<Add mover="cart_focus_design" />
<Add mover="remove_constraints"/>
<Add mover="post_design_metrics" />
</PROTOCOLS>
<OUTPUT />
</ROSETTASCRIPTS>
19 changes: 19 additions & 0 deletions database/rosetta/xml_scripts/glycosylate_model.xml
@@ -0,0 +1,19 @@
<ROSETTASCRIPTS>
<RESIDUE_SELECTORS>
<Glycan name="all_glycans"/>
</RESIDUE_SELECTORS>
<SIMPLE_METRICS>
<TimingProfileMetric name="timing"/>
</SIMPLE_METRICS>
<MOVERS>
<SimpleGlycosylateMover name="glycosylate" positions="88A,295A,362A,448A,625B,130C,160C,289C,295C,301C,362C,88E,130E,295E,356E,392E,448E,406C,411C,463C,611D,616D,637D,160E,186E,339E,396E,406E,411E,463E,611F,616F,637F" glycosylation="man5" />
<GlycanTreeRelax name="model" layer_size="2" window_size="1" rounds="1" refine="false" />
<RunSimpleMetrics name="post_modeling_metrics" metrics="timing" prefix="post-model_"/>
</MOVERS>
<PROTOCOLS>
<Add mover="glycosylate"/>
<Add mover="model_glycans" />
<Add mover="post_modeling_metrics" />
</PROTOCOLS>
</ROSETTASCRIPTS>

0 comments on commit 802ecaa

Please sign in to comment.