• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CCPBioSim / CodeEntropy / 13726590978

07 Mar 2025 06:07PM UTC coverage: 1.726%. First build
13726590978

push

github

web-flow
Merge pull request #45 from CCPBioSim/39-implement-ci-pipeline-pre-commit-hooks

Implement CI pipeline pre-commit hooks

27 of 1135 new or added lines in 23 files covered. (2.38%)

53 of 3071 relevant lines covered (1.73%)

0.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/CodeEntropy/poseidon/extractData/outputFiles.py
1
#!/usr/bin/env python
2

3
# import math
4
# import sys
5

6
# import numpy as np
7

8
# from CodeEntropy.poseidon.extractData.generalFunctions import (
9
#     calcAngleWithNearestNonlike,
10
# )
11

12

13
def moleculeObjectPopulation(all_data, allMoleculeList, frame, dimensions):
×
14
    """
15
    For all molecules in the system, populate a list with required
16
    info for further analysis across any trajectory frame.
17
    """
18

19
    for x in range(0, len(all_data)):
×
20
        atom = all_data[x]
×
21
        if atom.mass > 1.1:
×
22
            nearestInfo = []
×
NEW
23
            if atom.nearestAnyNonlike is not None:
×
24
                nearestInfo = [
×
25
                    atom.nearestAnyNonlike[0].atom_name,
26
                    atom.nearestAnyNonlike[0].resname,
27
                    atom.nearestAnyNonlike[0].resid,
28
                    round(atom.nearestAnyNonlike[1], 3),  # dist
29
                ]
30

NEW
31
            allMoleculeList.append(
×
32
                [
33
                    frame,  # 0
34
                    atom.atom_name,  # 1
35
                    atom.atom_num,  # 2
36
                    atom.resname,  # 3
37
                    atom.resid,  # 4
38
                    atom.bondedUA_H,  # 5
39
                    atom.molecule_atomNums,  # 6
40
                    nearestInfo,  # 7
41
                    atom.hydrationShellRAD_solute,  # 8
42
                    atom.RAD_shell_ranked,  # 9
43
                    atom.MweightedForces,  # 10
44
                    atom.MweightedTorques,  # 11
45
                    atom.UA_PKenergy,  # 12
46
                    atom.UAweightedForces,  # 13
47
                    atom.UAweightedTorques,  # 14
48
                    atom.dihedral_phi_type,  # 15
49
                    atom.molecule_UA_Fs,  # 16
50
                    atom.molecule_UA_Ts,  # 17
51
                    atom.RAD_nAtoms,  # 18
52
                ]
53
            )
54

55
        else:
56
            continue
×
57

58
    return allMoleculeList
×
59

60

61
def pdbGenerate(all_data, fileName, dimensions):
×
62
    """
63
    Output a pdb file to visualise different waters in system.
64
    Might have to also make an equivalent .csv file so that
65
    we have an easier time analysing the files.
66
    But append to one global file rather than each frame,
67
    so need a column of frame number for analysis later.
68
    pdb file pure for producing images with vmd,
69
    but could create these later anyway?
70
    Then we can choose our beta column?
71
    """
72

NEW
73
    data = open(fileName + "_solProx_dist.pdb", "w")
×
74
    # solute resid, int(dist) from solute resid
75

NEW
76
    data3 = open(fileName + "_RADHBlengths.pdb", "w")
×
77
    # Nc, N_acceptors/N_donors
78

NEW
79
    data6 = open(fileName + "_solProx_RAD.pdb", "w")
×
80
    # solute resid, int(dist) from solute resid
81

82
    file_list = [data, data3, data6]
×
83

84
    for x in range(0, len(all_data)):
×
85
        atom = all_data[x]
×
86

87
        try:
×
88
            a = int(atom.nearestAnyNonlike[0].resid)
×
89
        except TypeError:
×
90
            a = 0
×
91
        try:
×
92
            b = int(atom.nearestAnyNonlike[1])
×
93
        except TypeError:
×
94
            b = 0
×
95
        try:
×
96
            e = len(atom.RAD)
×
97
        except TypeError:
×
98
            e = 0
×
99
        try:
×
100
            As = len(atom.RAD_shell_ranked[1])
×
101
            Ds = len(atom.RAD_shell_ranked[2])
×
NEW
102
            DAhh_type = "%s%s" % (Ds, As)
×
103
            f = str(DAhh_type)
×
104
        except TypeError:
×
NEW
105
            f = "00"
×
106
        try:
×
107
            i = int(atom.hydrationShellRAD_solute)
×
108
        except (TypeError, ValueError):
×
109
            i = 0
×
110

NEW
111
        data.write(
×
112
            "\n".join(
113
                [
114
                    "{:6s}{:5d} {:^4s}{:1s}{:3s}"
115
                    " {:1s}{:4d}{:1s}   {:8.3f}{:8.3f}{:8.3f}"
116
                    "{:6.0f}{:6.0f}          {:>2s}{:2s}".format(
117
                        "ATOM",
118
                        int(str(atom.atom_num)[0:5]),
119
                        atom.atom_name,
120
                        " ",
121
                        atom.resname[0:3],
122
                        "A",
123
                        int(str(atom.resid)[0:4]),
124
                        " ",
125
                        float(atom.coords[0]),
126
                        float(atom.coords[1]),
127
                        float(atom.coords[2]),
128
                        a,
129
                        b,
130
                        " ",
131
                        " ",
132
                    )
133
                ]
134
            )
135
            + "\n"
136
        )
137

NEW
138
        data3.write(
×
139
            "\n".join(
140
                [
141
                    "{:6s}{:5d} {:^4s}{:1s}{:3s}"
142
                    " {:1s}{:4d}{:1s}   {:8.3f}{:8.3f}{:8.3f}"
143
                    "{:6.0f}    {:2s}          {:>2s}{:2s}".format(
144
                        "ATOM",
145
                        int(str(atom.atom_num)[0:5]),
146
                        atom.atom_name,
147
                        " ",
148
                        atom.resname[0:3],
149
                        "A",
150
                        int(str(atom.resid)[0:4]),
151
                        " ",
152
                        float(atom.coords[0]),
153
                        float(atom.coords[1]),
154
                        float(atom.coords[2]),
155
                        e,
156
                        f,
157
                        " ",
158
                        " ",
159
                    )
160
                ]
161
            )
162
            + "\n"
163
        )
164

NEW
165
        data6.write(
×
166
            "\n".join(
167
                [
168
                    "{:6s}{:5d} {:^4s}{:1s}{:3s}"
169
                    " {:1s}{:4d}{:1s}   {:8.3f}{:8.3f}{:8.3f}"
170
                    "{:6.0f}{:6.0f}          {:>2s}{:2s}".format(
171
                        "ATOM",
172
                        int(str(atom.atom_num)[0:5]),
173
                        atom.atom_name,
174
                        " ",
175
                        atom.resname[0:3],
176
                        "A",
177
                        int(str(atom.resid)[0:4]),
178
                        " ",
179
                        float(atom.coords[0]),
180
                        float(atom.coords[1]),
181
                        float(atom.coords[2]),
182
                        a,
183
                        i,
184
                        " ",
185
                        " ",
186
                    )
187
                ]
188
            )
189
            + "\n"
190
        )
191

192
    for d in file_list:
×
193
        d.close()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc