Mercurial > repos > chemteam > mdanalysis_dihedral
comparison angle.py @ 4:d8178fe9aaff draft
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
author | chemteam |
---|---|
date | Mon, 07 Oct 2019 12:52:20 -0400 |
parents | cc1d22357daf |
children | 0493024c3318 |
comparison
equal
deleted
inserted
replaced
3:554f60da9c8f | 4:d8178fe9aaff |
---|---|
14 from numpy.linalg import norm | 14 from numpy.linalg import norm |
15 | 15 |
16 | 16 |
17 def parse_command_line(argv): | 17 def parse_command_line(argv): |
18 parser = argparse.ArgumentParser() | 18 parser = argparse.ArgumentParser() |
19 parser.add_argument('--idcd', help='input dcd') | 19 parser.add_argument('--itraj', help='input traj') |
20 parser.add_argument('--ipdb', help='input pdb') | 20 parser.add_argument('--istr', help='input str') |
21 parser.add_argument('--itrajext', help='input traj ext') | |
22 parser.add_argument('--istrext', help='input str ext') | |
21 parser.add_argument('--isegid1', help='segid 1') | 23 parser.add_argument('--isegid1', help='segid 1') |
22 parser.add_argument('--iresid1', help='resid 1') | 24 parser.add_argument('--iresid1', help='resid 1') |
23 parser.add_argument('--iname1', help='name 1') | 25 parser.add_argument('--iname1', help='name 1') |
24 parser.add_argument('--isegid2', help='segid 2') | 26 parser.add_argument('--isegid2', help='segid 2') |
25 parser.add_argument('--iresid2', help='resid 2') | 27 parser.add_argument('--iresid2', help='resid 2') |
50 BC = C - B | 52 BC = C - B |
51 theta = np.arccos(np.dot(BA, BC)/(norm(BA)*norm(BC))) | 53 theta = np.arccos(np.dot(BA, BC)/(norm(BA)*norm(BC))) |
52 return np.rad2deg(theta) | 54 return np.rad2deg(theta) |
53 | 55 |
54 | 56 |
55 u = mda.Universe(args.ipdb, args.idcd, topology_format="PDB", format="DCD") | 57 u = mda.Universe(args.istr, args.itraj, |
58 topology_format=args.istrext, format=args.itrajext) | |
56 data = np.array([(u.trajectory.frame, theta(u)) for ts in u.trajectory]) | 59 data = np.array([(u.trajectory.frame, theta(u)) for ts in u.trajectory]) |
57 frame, theta = data.T | 60 frame, theta = data.T |
58 | 61 |
59 with open(args.output, 'w') as f: | 62 with open(args.output, 'w') as f: |
60 writer = csv.writer(f, delimiter='\t') | 63 writer = csv.writer(f, delimiter='\t') |