Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cescgina committed Apr 26, 2019
2 parents 8e0b8a0 + a2ad1a3 commit 8eefde0
Show file tree
Hide file tree
Showing 8 changed files with 768 additions and 29 deletions.
7 changes: 5 additions & 2 deletions AdaptivePELE/analysis/backtrackAdaptiveTrajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ def main(trajectory, snapshot, epoch, outputPath, out_filename, topology, use_pd
epoch = str(epoch)
sys.stderr.write("Writing pathway...\n")
with open(outputPath+out_filename, "a") as f:
f.write("ENDMDL\n".join(itertools.chain.from_iterable(pathway)))

if topology:
#Quick fix to avoid problems when visualizing with PyMol
f.write("ENDMDL\nMODEL 2\n".join(itertools.chain.from_iterable(pathway)))
else:
f.write("ENDMDL\n".join(itertools.chain.from_iterable(pathway)))

if __name__ == "__main__":
traj, num_snapshot, num_epoch, output_path, output_filename, top, use_pdb = parseArguments()
Expand Down
9 changes: 6 additions & 3 deletions AdaptivePELE/analysis/bestStructs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@
OUTPUT_FOLDER = 'BestStructs'
DIR = os.path.abspath(os.getcwd())
STEPS=3
HELP = "USE:\n\n- For xtc: python bestStructs.py 5 --top topology.pdb\n\n- For pdb: python bestStructs.py 5"


def parse_args():

parser = argparse.ArgumentParser()
parser = argparse.ArgumentParser(description=HELP, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("crit", type=str, nargs='+', help="Criteria we want to rank and output the strutures for. Must be a column of the report. i.e: Binding Energy")
parser.add_argument("--crit2", type=str, nargs='+', help="Second Criteria we want to rank and output the strutures for. Must be a column of the report. i.e: SasaLig, i.e.2. 3", default="")
parser.add_argument("--path", type=str, help="Path to Pele's results root folder i.e: path=/Pele/results/", default=DIR)
Expand Down Expand Up @@ -124,7 +125,7 @@ def main(criteria, path=DIR, n_structs=10, sort_order="min", out_freq=FREQ, outp
def extract_snapshot_from_pdb(path, f_id, output, topology, step, out_freq, f_out):
f_in = glob.glob(os.path.join(os.path.dirname(path), "*trajectory*_{}.pdb".format(f_id)))
if not f_in:
glob.glob(os.path.join(os.path.dirname(path), "*trajectory*_{}.*".format(f_id)))
f_in = glob.glob(os.path.join(os.path.dirname(path), "*trajectory*_{}.*".format(f_id)))
if len(f_in) == 0:
sys.exit("Trajectory {} not found. Be aware that PELE trajectories must contain the label \'trajectory\' in their file name to be detected".format("*trajectory*_{}".format(f_id)))
f_in = f_in[0]
Expand All @@ -147,7 +148,7 @@ def extract_snapshot_from_pdb(path, f_id, output, topology, step, out_freq, f_ou
raise AttributeError("Model not found. Check the -f option.")
traj.append("ENDMDL\n")
f.write("\n".join(traj))

print("Model {} selected".format(os.path.join(output, f_out)))

def extract_snapshot_from_xtc(path, f_id, output, topology, step, out_freq, f_out):
f_in = glob.glob(os.path.join(os.path.dirname(path), "*trajectory*_{}.xtc".format(f_id)))
Expand All @@ -156,6 +157,8 @@ def extract_snapshot_from_xtc(path, f_id, output, topology, step, out_freq, f_ou
if len(f_in) == 0:
sys.exit("Trajectory {} not found. Be aware that PELE trajectories must contain the label \'trajectory\' in their file name to be detected".format("*trajectory*_{}".format(f_id)))
splitTrajectory.main(output, [f_in[0], ], topology, [(step)/out_freq+1, ], template= f_out)
print("Model {} selected".format(f_out))




Expand Down
Loading

0 comments on commit 8eefde0

Please sign in to comment.