Add content-addressed supplemental coordinates and verified record links
Browse files- LICENSE +403 -0
- README.md +8 -0
- data/supplemental/coordinates_01.tar.gz +3 -0
- data/supplemental/coordinates_02.tar.gz +3 -0
- metadata/supplemental/README.md +55 -0
- metadata/supplemental/metric_conflicts.tsv.gz +3 -0
- metadata/supplemental/model_identities.tsv.gz +3 -0
- metadata/supplemental/models.tsv.gz +3 -0
- metadata/supplemental/record_links.tsv.gz +3 -0
- metadata/supplemental/structure_metadata.tsv.gz +3 -0
- metadata/supplemental/structures.tsv.gz +3 -0
- metadata/supplemental/verification.json +67 -0
- tools/ingest_supplemental.py +440 -0
LICENSE
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Attribution-NonCommercial-NoDerivatives 4.0 International
|
| 2 |
+
|
| 3 |
+
=======================================================================
|
| 4 |
+
|
| 5 |
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
| 6 |
+
does not provide legal services or legal advice. Distribution of
|
| 7 |
+
Creative Commons public licenses does not create a lawyer-client or
|
| 8 |
+
other relationship. Creative Commons makes its licenses and related
|
| 9 |
+
information available on an "as-is" basis. Creative Commons gives no
|
| 10 |
+
warranties regarding its licenses, any material licensed under their
|
| 11 |
+
terms and conditions, or any related information. Creative Commons
|
| 12 |
+
disclaims all liability for damages resulting from their use to the
|
| 13 |
+
fullest extent possible.
|
| 14 |
+
|
| 15 |
+
Using Creative Commons Public Licenses
|
| 16 |
+
|
| 17 |
+
Creative Commons public licenses provide a standard set of terms and
|
| 18 |
+
conditions that creators and other rights holders may use to share
|
| 19 |
+
original works of authorship and other material subject to copyright
|
| 20 |
+
and certain other rights specified in the public license below. The
|
| 21 |
+
following considerations are for informational purposes only, are not
|
| 22 |
+
exhaustive, and do not form part of our licenses.
|
| 23 |
+
|
| 24 |
+
Considerations for licensors: Our public licenses are
|
| 25 |
+
intended for use by those authorized to give the public
|
| 26 |
+
permission to use material in ways otherwise restricted by
|
| 27 |
+
copyright and certain other rights. Our licenses are
|
| 28 |
+
irrevocable. Licensors should read and understand the terms
|
| 29 |
+
and conditions of the license they choose before applying it.
|
| 30 |
+
Licensors should also secure all rights necessary before
|
| 31 |
+
applying our licenses so that the public can reuse the
|
| 32 |
+
material as expected. Licensors should clearly mark any
|
| 33 |
+
material not subject to the license. This includes other CC-
|
| 34 |
+
licensed material, or material used under an exception or
|
| 35 |
+
limitation to copyright. More considerations for licensors:
|
| 36 |
+
wiki.creativecommons.org/Considerations_for_licensors
|
| 37 |
+
|
| 38 |
+
Considerations for the public: By using one of our public
|
| 39 |
+
licenses, a licensor grants the public permission to use the
|
| 40 |
+
licensed material under specified terms and conditions. If
|
| 41 |
+
the licensor's permission is not necessary for any reason--for
|
| 42 |
+
example, because of any applicable exception or limitation to
|
| 43 |
+
copyright--then that use is not regulated by the license. Our
|
| 44 |
+
licenses grant only permissions under copyright and certain
|
| 45 |
+
other rights that a licensor has authority to grant. Use of
|
| 46 |
+
the licensed material may still be restricted for other
|
| 47 |
+
reasons, including because others have copyright or other
|
| 48 |
+
rights in the material. A licensor may make special requests,
|
| 49 |
+
such as asking that all changes be marked or described.
|
| 50 |
+
Although not required by our licenses, you are encouraged to
|
| 51 |
+
respect those requests where reasonable. More considerations
|
| 52 |
+
for the public:
|
| 53 |
+
wiki.creativecommons.org/Considerations_for_licensees
|
| 54 |
+
|
| 55 |
+
=======================================================================
|
| 56 |
+
|
| 57 |
+
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
|
| 58 |
+
International Public License
|
| 59 |
+
|
| 60 |
+
By exercising the Licensed Rights (defined below), You accept and agree
|
| 61 |
+
to be bound by the terms and conditions of this Creative Commons
|
| 62 |
+
Attribution-NonCommercial-NoDerivatives 4.0 International Public
|
| 63 |
+
License ("Public License"). To the extent this Public License may be
|
| 64 |
+
interpreted as a contract, You are granted the Licensed Rights in
|
| 65 |
+
consideration of Your acceptance of these terms and conditions, and the
|
| 66 |
+
Licensor grants You such rights in consideration of benefits the
|
| 67 |
+
Licensor receives from making the Licensed Material available under
|
| 68 |
+
these terms and conditions.
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
Section 1 -- Definitions.
|
| 72 |
+
|
| 73 |
+
a. Adapted Material means material subject to Copyright and Similar
|
| 74 |
+
Rights that is derived from or based upon the Licensed Material
|
| 75 |
+
and in which the Licensed Material is translated, altered,
|
| 76 |
+
arranged, transformed, or otherwise modified in a manner requiring
|
| 77 |
+
permission under the Copyright and Similar Rights held by the
|
| 78 |
+
Licensor. For purposes of this Public License, where the Licensed
|
| 79 |
+
Material is a musical work, performance, or sound recording,
|
| 80 |
+
Adapted Material is always produced where the Licensed Material is
|
| 81 |
+
synched in timed relation with a moving image.
|
| 82 |
+
|
| 83 |
+
b. Copyright and Similar Rights means copyright and/or similar rights
|
| 84 |
+
closely related to copyright including, without limitation,
|
| 85 |
+
performance, broadcast, sound recording, and Sui Generis Database
|
| 86 |
+
Rights, without regard to how the rights are labeled or
|
| 87 |
+
categorized. For purposes of this Public License, the rights
|
| 88 |
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
| 89 |
+
Rights.
|
| 90 |
+
|
| 91 |
+
c. Effective Technological Measures means those measures that, in the
|
| 92 |
+
absence of proper authority, may not be circumvented under laws
|
| 93 |
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
| 94 |
+
Treaty adopted on December 20, 1996, and/or similar international
|
| 95 |
+
agreements.
|
| 96 |
+
|
| 97 |
+
d. Exceptions and Limitations means fair use, fair dealing, and/or
|
| 98 |
+
any other exception or limitation to Copyright and Similar Rights
|
| 99 |
+
that applies to Your use of the Licensed Material.
|
| 100 |
+
|
| 101 |
+
e. Licensed Material means the artistic or literary work, database,
|
| 102 |
+
or other material to which the Licensor applied this Public
|
| 103 |
+
License.
|
| 104 |
+
|
| 105 |
+
f. Licensed Rights means the rights granted to You subject to the
|
| 106 |
+
terms and conditions of this Public License, which are limited to
|
| 107 |
+
all Copyright and Similar Rights that apply to Your use of the
|
| 108 |
+
Licensed Material and that the Licensor has authority to license.
|
| 109 |
+
|
| 110 |
+
g. Licensor means the individual(s) or entity(ies) granting rights
|
| 111 |
+
under this Public License.
|
| 112 |
+
|
| 113 |
+
h. NonCommercial means not primarily intended for or directed towards
|
| 114 |
+
commercial advantage or monetary compensation. For purposes of
|
| 115 |
+
this Public License, the exchange of the Licensed Material for
|
| 116 |
+
other material subject to Copyright and Similar Rights by digital
|
| 117 |
+
file-sharing or similar means is NonCommercial provided there is
|
| 118 |
+
no payment of monetary compensation in connection with the
|
| 119 |
+
exchange.
|
| 120 |
+
|
| 121 |
+
i. Share means to provide material to the public by any means or
|
| 122 |
+
process that requires permission under the Licensed Rights, such
|
| 123 |
+
as reproduction, public display, public performance, distribution,
|
| 124 |
+
dissemination, communication, or importation, and to make material
|
| 125 |
+
available to the public including in ways that members of the
|
| 126 |
+
public may access the material from a place and at a time
|
| 127 |
+
individually chosen by them.
|
| 128 |
+
|
| 129 |
+
j. Sui Generis Database Rights means rights other than copyright
|
| 130 |
+
resulting from Directive 96/9/EC of the European Parliament and of
|
| 131 |
+
the Council of 11 March 1996 on the legal protection of databases,
|
| 132 |
+
as amended and/or succeeded, as well as other essentially
|
| 133 |
+
equivalent rights anywhere in the world.
|
| 134 |
+
|
| 135 |
+
k. You means the individual or entity exercising the Licensed Rights
|
| 136 |
+
under this Public License. Your has a corresponding meaning.
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
Section 2 -- Scope.
|
| 140 |
+
|
| 141 |
+
a. License grant.
|
| 142 |
+
|
| 143 |
+
1. Subject to the terms and conditions of this Public License,
|
| 144 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
| 145 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
| 146 |
+
exercise the Licensed Rights in the Licensed Material to:
|
| 147 |
+
|
| 148 |
+
a. reproduce and Share the Licensed Material, in whole or
|
| 149 |
+
in part, for NonCommercial purposes only; and
|
| 150 |
+
|
| 151 |
+
b. produce and reproduce, but not Share, Adapted Material
|
| 152 |
+
for NonCommercial purposes only.
|
| 153 |
+
|
| 154 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
| 155 |
+
Exceptions and Limitations apply to Your use, this Public
|
| 156 |
+
License does not apply, and You do not need to comply with
|
| 157 |
+
its terms and conditions.
|
| 158 |
+
|
| 159 |
+
3. Term. The term of this Public License is specified in Section
|
| 160 |
+
6(a).
|
| 161 |
+
|
| 162 |
+
4. Media and formats; technical modifications allowed. The
|
| 163 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
| 164 |
+
all media and formats whether now known or hereafter created,
|
| 165 |
+
and to make technical modifications necessary to do so. The
|
| 166 |
+
Licensor waives and/or agrees not to assert any right or
|
| 167 |
+
authority to forbid You from making technical modifications
|
| 168 |
+
necessary to exercise the Licensed Rights, including
|
| 169 |
+
technical modifications necessary to circumvent Effective
|
| 170 |
+
Technological Measures. For purposes of this Public License,
|
| 171 |
+
simply making modifications authorized by this Section 2(a)
|
| 172 |
+
(4) never produces Adapted Material.
|
| 173 |
+
|
| 174 |
+
5. Downstream recipients.
|
| 175 |
+
|
| 176 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
| 177 |
+
recipient of the Licensed Material automatically
|
| 178 |
+
receives an offer from the Licensor to exercise the
|
| 179 |
+
Licensed Rights under the terms and conditions of this
|
| 180 |
+
Public License.
|
| 181 |
+
|
| 182 |
+
b. No downstream restrictions. You may not offer or impose
|
| 183 |
+
any additional or different terms or conditions on, or
|
| 184 |
+
apply any Effective Technological Measures to, the
|
| 185 |
+
Licensed Material if doing so restricts exercise of the
|
| 186 |
+
Licensed Rights by any recipient of the Licensed
|
| 187 |
+
Material.
|
| 188 |
+
|
| 189 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
| 190 |
+
may be construed as permission to assert or imply that You
|
| 191 |
+
are, or that Your use of the Licensed Material is, connected
|
| 192 |
+
with, or sponsored, endorsed, or granted official status by,
|
| 193 |
+
the Licensor or others designated to receive attribution as
|
| 194 |
+
provided in Section 3(a)(1)(A)(i).
|
| 195 |
+
|
| 196 |
+
b. Other rights.
|
| 197 |
+
|
| 198 |
+
1. Moral rights, such as the right of integrity, are not
|
| 199 |
+
licensed under this Public License, nor are publicity,
|
| 200 |
+
privacy, and/or other similar personality rights; however, to
|
| 201 |
+
the extent possible, the Licensor waives and/or agrees not to
|
| 202 |
+
assert any such rights held by the Licensor to the limited
|
| 203 |
+
extent necessary to allow You to exercise the Licensed
|
| 204 |
+
Rights, but not otherwise.
|
| 205 |
+
|
| 206 |
+
2. Patent and trademark rights are not licensed under this
|
| 207 |
+
Public License.
|
| 208 |
+
|
| 209 |
+
3. To the extent possible, the Licensor waives any right to
|
| 210 |
+
collect royalties from You for the exercise of the Licensed
|
| 211 |
+
Rights, whether directly or through a collecting society
|
| 212 |
+
under any voluntary or waivable statutory or compulsory
|
| 213 |
+
licensing scheme. In all other cases the Licensor expressly
|
| 214 |
+
reserves any right to collect such royalties, including when
|
| 215 |
+
the Licensed Material is used other than for NonCommercial
|
| 216 |
+
purposes.
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
Section 3 -- License Conditions.
|
| 220 |
+
|
| 221 |
+
Your exercise of the Licensed Rights is expressly made subject to the
|
| 222 |
+
following conditions.
|
| 223 |
+
|
| 224 |
+
a. Attribution.
|
| 225 |
+
|
| 226 |
+
1. If You Share the Licensed Material, You must:
|
| 227 |
+
|
| 228 |
+
a. retain the following if it is supplied by the Licensor
|
| 229 |
+
with the Licensed Material:
|
| 230 |
+
|
| 231 |
+
i. identification of the creator(s) of the Licensed
|
| 232 |
+
Material and any others designated to receive
|
| 233 |
+
attribution, in any reasonable manner requested by
|
| 234 |
+
the Licensor (including by pseudonym if
|
| 235 |
+
designated);
|
| 236 |
+
|
| 237 |
+
ii. a copyright notice;
|
| 238 |
+
|
| 239 |
+
iii. a notice that refers to this Public License;
|
| 240 |
+
|
| 241 |
+
iv. a notice that refers to the disclaimer of
|
| 242 |
+
warranties;
|
| 243 |
+
|
| 244 |
+
v. a URI or hyperlink to the Licensed Material to the
|
| 245 |
+
extent reasonably practicable;
|
| 246 |
+
|
| 247 |
+
b. indicate if You modified the Licensed Material and
|
| 248 |
+
retain an indication of any previous modifications; and
|
| 249 |
+
|
| 250 |
+
c. indicate the Licensed Material is licensed under this
|
| 251 |
+
Public License, and include the text of, or the URI or
|
| 252 |
+
hyperlink to, this Public License.
|
| 253 |
+
|
| 254 |
+
For the avoidance of doubt, You do not have permission under
|
| 255 |
+
this Public License to Share Adapted Material.
|
| 256 |
+
|
| 257 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
| 258 |
+
reasonable manner based on the medium, means, and context in
|
| 259 |
+
which You Share the Licensed Material. For example, it may be
|
| 260 |
+
reasonable to satisfy the conditions by providing a URI or
|
| 261 |
+
hyperlink to a resource that includes the required
|
| 262 |
+
information.
|
| 263 |
+
|
| 264 |
+
3. If requested by the Licensor, You must remove any of the
|
| 265 |
+
information required by Section 3(a)(1)(A) to the extent
|
| 266 |
+
reasonably practicable.
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
Section 4 -- Sui Generis Database Rights.
|
| 270 |
+
|
| 271 |
+
Where the Licensed Rights include Sui Generis Database Rights that
|
| 272 |
+
apply to Your use of the Licensed Material:
|
| 273 |
+
|
| 274 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
| 275 |
+
to extract, reuse, reproduce, and Share all or a substantial
|
| 276 |
+
portion of the contents of the database for NonCommercial purposes
|
| 277 |
+
only and provided You do not Share Adapted Material;
|
| 278 |
+
|
| 279 |
+
b. if You include all or a substantial portion of the database
|
| 280 |
+
contents in a database in which You have Sui Generis Database
|
| 281 |
+
Rights, then the database in which You have Sui Generis Database
|
| 282 |
+
Rights (but not its individual contents) is Adapted Material; and
|
| 283 |
+
|
| 284 |
+
c. You must comply with the conditions in Section 3(a) if You Share
|
| 285 |
+
all or a substantial portion of the contents of the database.
|
| 286 |
+
|
| 287 |
+
For the avoidance of doubt, this Section 4 supplements and does not
|
| 288 |
+
replace Your obligations under this Public License where the Licensed
|
| 289 |
+
Rights include other Copyright and Similar Rights.
|
| 290 |
+
|
| 291 |
+
|
| 292 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
| 293 |
+
|
| 294 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
| 295 |
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
| 296 |
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
| 297 |
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
| 298 |
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
| 299 |
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
| 300 |
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
| 301 |
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
| 302 |
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
| 303 |
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
| 304 |
+
|
| 305 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
| 306 |
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
| 307 |
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
| 308 |
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
| 309 |
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
| 310 |
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
| 311 |
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
| 312 |
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
| 313 |
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
| 314 |
+
|
| 315 |
+
c. The disclaimer of warranties and limitation of liability provided
|
| 316 |
+
above shall be interpreted in a manner that, to the extent
|
| 317 |
+
possible, most closely approximates an absolute disclaimer and
|
| 318 |
+
waiver of all liability.
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
Section 6 -- Term and Termination.
|
| 322 |
+
|
| 323 |
+
a. This Public License applies for the term of the Copyright and
|
| 324 |
+
Similar Rights licensed here. However, if You fail to comply with
|
| 325 |
+
this Public License, then Your rights under this Public License
|
| 326 |
+
terminate automatically.
|
| 327 |
+
|
| 328 |
+
b. Where Your right to use the Licensed Material has terminated under
|
| 329 |
+
Section 6(a), it reinstates:
|
| 330 |
+
|
| 331 |
+
1. automatically as of the date the violation is cured, provided
|
| 332 |
+
it is cured within 30 days of Your discovery of the
|
| 333 |
+
violation; or
|
| 334 |
+
|
| 335 |
+
2. upon express reinstatement by the Licensor.
|
| 336 |
+
|
| 337 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
| 338 |
+
right the Licensor may have to seek remedies for Your violations
|
| 339 |
+
of this Public License.
|
| 340 |
+
|
| 341 |
+
c. For the avoidance of doubt, the Licensor may also offer the
|
| 342 |
+
Licensed Material under separate terms or conditions or stop
|
| 343 |
+
distributing the Licensed Material at any time; however, doing so
|
| 344 |
+
will not terminate this Public License.
|
| 345 |
+
|
| 346 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
| 347 |
+
License.
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
Section 7 -- Other Terms and Conditions.
|
| 351 |
+
|
| 352 |
+
a. The Licensor shall not be bound by any additional or different
|
| 353 |
+
terms or conditions communicated by You unless expressly agreed.
|
| 354 |
+
|
| 355 |
+
b. Any arrangements, understandings, or agreements regarding the
|
| 356 |
+
Licensed Material not stated herein are separate from and
|
| 357 |
+
independent of the terms and conditions of this Public License.
|
| 358 |
+
|
| 359 |
+
|
| 360 |
+
Section 8 -- Interpretation.
|
| 361 |
+
|
| 362 |
+
a. For the avoidance of doubt, this Public License does not, and
|
| 363 |
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
| 364 |
+
conditions on any use of the Licensed Material that could lawfully
|
| 365 |
+
be made without permission under this Public License.
|
| 366 |
+
|
| 367 |
+
b. To the extent possible, if any provision of this Public License is
|
| 368 |
+
deemed unenforceable, it shall be automatically reformed to the
|
| 369 |
+
minimum extent necessary to make it enforceable. If the provision
|
| 370 |
+
cannot be reformed, it shall be severed from this Public License
|
| 371 |
+
without affecting the enforceability of the remaining terms and
|
| 372 |
+
conditions.
|
| 373 |
+
|
| 374 |
+
c. No term or condition of this Public License will be waived and no
|
| 375 |
+
failure to comply consented to unless expressly agreed to by the
|
| 376 |
+
Licensor.
|
| 377 |
+
|
| 378 |
+
d. Nothing in this Public License constitutes or may be interpreted
|
| 379 |
+
as a limitation upon, or waiver of, any privileges and immunities
|
| 380 |
+
that apply to the Licensor or You, including from the legal
|
| 381 |
+
processes of any jurisdiction or authority.
|
| 382 |
+
|
| 383 |
+
=======================================================================
|
| 384 |
+
|
| 385 |
+
Creative Commons is not a party to its public
|
| 386 |
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
| 387 |
+
its public licenses to material it publishes and in those instances
|
| 388 |
+
will be considered the “Licensor.” The text of the Creative Commons
|
| 389 |
+
public licenses is dedicated to the public domain under the CC0 Public
|
| 390 |
+
Domain Dedication. Except for the limited purpose of indicating that
|
| 391 |
+
material is shared under a Creative Commons public license or as
|
| 392 |
+
otherwise permitted by the Creative Commons policies published at
|
| 393 |
+
creativecommons.org/policies, Creative Commons does not authorize the
|
| 394 |
+
use of the trademark "Creative Commons" or any other trademark or logo
|
| 395 |
+
of Creative Commons without its prior written consent including,
|
| 396 |
+
without limitation, in connection with any unauthorized modifications
|
| 397 |
+
to any of its public licenses or any other arrangements,
|
| 398 |
+
understandings, or agreements concerning use of licensed material. For
|
| 399 |
+
the avoidance of doubt, this paragraph does not form part of the
|
| 400 |
+
public licenses.
|
| 401 |
+
|
| 402 |
+
Creative Commons may be contacted at creativecommons.org.
|
| 403 |
+
|
README.md
CHANGED
|
@@ -123,3 +123,11 @@ states. Receptors of 174 hashes occur against other peptides, as recorded in the
|
|
| 123 |
## Current-record coordinate proofreading
|
| 124 |
|
| 125 |
The independent VDJdb proofreading script now checks PDB accessions across every current record, including observations retained under publication chunks after deduplication. It extends the earlier 360-accession aggregate-chunk check to 367 accessions across 411 current records. Six additional deposited files (`9NU7`, `9NV6`, `9NV2`, `9NVE`, `9NW2`, `9NVA`) are preserved under `data/pdb_sources/`; `7NA5` was already in the native archive. The script verifies all archived assets, source checksums and current record links, and writes separate coordinate-to-record and native-coverage Parquet tables. The existing historical archives and source-row associations are unchanged. Run `processing/proofread_structure_files.py` in the VDJdb source repository; see [the structural output contract](https://docs.isalgo.dev/vdjdb-db/outputs.html#structure-files-and-current-record-cross-links).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
## Current-record coordinate proofreading
|
| 124 |
|
| 125 |
The independent VDJdb proofreading script now checks PDB accessions across every current record, including observations retained under publication chunks after deduplication. It extends the earlier 360-accession aggregate-chunk check to 367 accessions across 411 current records. Six additional deposited files (`9NU7`, `9NV6`, `9NV2`, `9NVE`, `9NW2`, `9NVA`) are preserved under `data/pdb_sources/`; `7NA5` was already in the native archive. The script verifies all archived assets, source checksums and current record links, and writes separate coordinate-to-record and native-coverage Parquet tables. The existing historical archives and source-row associations are unchanged. Run `processing/proofread_structure_files.py` in the VDJdb source repository; see [the structural output contract](https://docs.isalgo.dev/vdjdb-db/outputs.html#structure-files-and-current-record-cross-links).
|
| 126 |
+
|
| 127 |
+
## Supplemental coordinate catalogue
|
| 128 |
+
|
| 129 |
+
[The supplemental catalogue](metadata/supplemental/README.md) adds content-addressed
|
| 130 |
+
coordinates and reviewed current-record links. It separates reported assignments,
|
| 131 |
+
constructed mismatches, mutants and native structures. A coordinate file or sequence
|
| 132 |
+
match alone does not establish experimental validation. Generator confidence values
|
| 133 |
+
remain separate from assay outcomes; no assay outcomes are included.
|
data/supplemental/coordinates_01.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b70afc1300c7f4ebbae42cb48bf41721cc0a8b21523c1a9ba9e101827e9e0d94
|
| 3 |
+
size 477622181
|
data/supplemental/coordinates_02.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04f1bbbfd89a66cbec527871ec61a1532ff6efe992a1acc791bee7612211c3c9
|
| 3 |
+
size 283964776
|
metadata/supplemental/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Supplemental structure catalogue
|
| 2 |
+
|
| 3 |
+
This collection preserves 13191 source coordinate files as 11802 distinct structure contents.
|
| 4 |
+
The two supplemental archives contain 11279 new files; 523 identical files are referenced in the
|
| 5 |
+
historical archive. Each `structure_id` is the SHA256 of the exported uncompressed file.
|
| 6 |
+
New archive members have neutral SHA256 filenames. Source paths, sample names and source-member
|
| 7 |
+
mappings remain private.
|
| 8 |
+
|
| 9 |
+
| File | Unit and purpose |
|
| 10 |
+
|---|---|
|
| 11 |
+
| `structures.tsv.gz` | One row per structure content: SHA256, relative archive path, archive member and uncompressed byte count |
|
| 12 |
+
| `models.tsv.gz` | 13151 distinct allowlisted structural metadata observations, including supplied confidences and resolved coordinate-chain sequences |
|
| 13 |
+
| `record_links.tsv.gz` | 16110 structure/record/sequence-state links: 4773 structures linked to 7288 current records |
|
| 14 |
+
| `model_identities.tsv.gz` | Structure content to build model identity; different coordinate frames can share one model identity |
|
| 15 |
+
| `structure_metadata.tsv.gz` | Build-compatible metadata: 4730 rows for 4727 model identities, restricted to independently matched reported assignments |
|
| 16 |
+
| `metric_conflicts.tsv.gz` | One row per model/metric disagreement, with the number of distinct supplied values |
|
| 17 |
+
| `verification.json` | Exact counts, output hashes, input-table hashes and verification results |
|
| 18 |
+
|
| 19 |
+
`source_disposition` distinguishes native, predicted, mock, mutant and unknown construction.
|
| 20 |
+
`pairing_status=reported_assignment` records a supplied receptor/pMHC association; it is not an
|
| 21 |
+
experimental binder call. Constructed mismatches remain explicit. Native, mock, mutant and unknown
|
| 22 |
+
observations do not enter the predicted-model build metadata. Functional screen outcomes and their
|
| 23 |
+
statistics are absent. `experimental_validation` remains unknown or not applicable.
|
| 24 |
+
|
| 25 |
+
Links require both current junctions to occur uniquely and literally in the appropriate resolved
|
| 26 |
+
coordinate chains, the exact peptide sequence, and compatible recorded species and both MHC partners
|
| 27 |
+
and class. `sequence_state` distinguishes submitted original from repaired junctions. Later numeric
|
| 28 |
+
HLA fields are compared at protein resolution; expression suffixes are retained. VDJdb junctions
|
| 29 |
+
include the conserved anchors. These links establish paired-junction/pMHC availability, not identical
|
| 30 |
+
complete receptor constructs or independent experimental validation.
|
| 31 |
+
|
| 32 |
+
For 617 models, the original MHC annotation is retained in `source_mhc_annotation`; the corrected
|
| 33 |
+
context follows the declared generation allele and literal agreement with independently linked
|
| 34 |
+
historical MHC coordinates. One additional model has unproved MHC context and remains unlinked.
|
| 35 |
+
Blank class annotations are completed only for explicit HLA-A/B/C alleles paired with B2M;
|
| 36 |
+
`source_mhc_class`, `mhc_class_completed` and `mhc_context_basis` record that derivation.
|
| 37 |
+
|
| 38 |
+
Generator confidences retain their supplied numerical values. `iptm`, `ptm`, `ranking_confidence`
|
| 39 |
+
and `tcr_pmhc_iptm` are dimensionless; `plddt` uses the generator's 0-100 scale.
|
| 40 |
+
Exact supplied-value disagreements affect 587 model identities: 578 for `iptm`, 1 each for `plddt`,
|
| 41 |
+
`ptm` and `ranking_confidence`, and 9 for `tcr_pmhc_iptm`. Original observations remain in `models.tsv.gz`.
|
| 42 |
+
Every conflicting build-facing cell is empty; values are never averaged, rounded to agreement or
|
| 43 |
+
selected between sources. `has_conflicting_metrics` and `n_conflicting_metrics` flag affected rows.
|
| 44 |
+
A missing observation does not contradict an identical supplied value.
|
| 45 |
+
|
| 46 |
+
Identifying noncoordinate annotations were removed from 187 exported copies, totaling 374 lines.
|
| 47 |
+
Every coordinate and chemical record remains byte-identical, and parsed chain sequences were checked
|
| 48 |
+
before and after removal. These copies are not claimed to preserve complete source-file bytes.
|
| 49 |
+
Original input hashes and redaction mappings remain private. Other source files are preserved verbatim.
|
| 50 |
+
|
| 51 |
+
Regenerate with `tools/ingest_supplemental.py` in an environment containing `tcren` and `polars`, using
|
| 52 |
+
an authorized private source manifest and the declared current `records.parquet` / `chains.parquet`.
|
| 53 |
+
The exporter streams raw inputs, deduplicates content, uses deterministic gzip/tar headers, and verifies
|
| 54 |
+
all exported digests. `--self-check` exercises metadata boundaries, exact links and redaction safeguards.
|
| 55 |
+
No structure prediction, annotation search, scoring or model fitting is performed.
|
metadata/supplemental/metric_conflicts.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7abb079f2e16994d46e73fd27d110e60bfa9f3152bc69bbcce2c676290e1ccb1
|
| 3 |
+
size 23003
|
metadata/supplemental/model_identities.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ddabed3c2f3d7aad4796246ca92ba6c6280a7326c0c6c30829fa6a31343d2ee7
|
| 3 |
+
size 244898
|
metadata/supplemental/models.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dad847c9dcf88e0683a626d578943527666a77d86675565044ea6a5737c37281
|
| 3 |
+
size 1706995
|
metadata/supplemental/record_links.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:758e981a30e760978174ad537c755fa00dc8326d7c91ef820a5b1aa374762d2f
|
| 3 |
+
size 261238
|
metadata/supplemental/structure_metadata.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c63f5ffe11320ebde649e4f24124caabe436e6d3fd51624768130060dfd4d70e
|
| 3 |
+
size 463907
|
metadata/supplemental/structures.tsv.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b16e5a40a720fdbfac109404fcda16260fc0d805ee46d36a8f57fd07a156e263
|
| 3 |
+
size 568238
|
metadata/supplemental/verification.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"assay_results_included": false,
|
| 3 |
+
"build_metadata_rows": 4730,
|
| 4 |
+
"build_model_identities": 4727,
|
| 5 |
+
"conflict_policy": "Exact supplied-value disagreements remain separate observations; conflicting build-facing cells are unavailable, without rounding, averaging or selecting a source.",
|
| 6 |
+
"conflicting_model_metrics": {
|
| 7 |
+
"iptm": 578,
|
| 8 |
+
"plddt": 1,
|
| 9 |
+
"ptm": 1,
|
| 10 |
+
"ranking_confidence": 1,
|
| 11 |
+
"tcr_pmhc_iptm": 9
|
| 12 |
+
},
|
| 13 |
+
"coordinate_and_chemical_records_unchanged": true,
|
| 14 |
+
"database_table_sha256": {
|
| 15 |
+
"chains.parquet": "cbb2fc5e8e470e61bc10f9b97aa5e2b0aa4d5725276bfdb4952aca7d075dc35f",
|
| 16 |
+
"records.parquet": "3cee2bef7e99363cb95cd36a5090600fc7708a50034c29826151425a856481c3"
|
| 17 |
+
},
|
| 18 |
+
"distinct_structures": 11802,
|
| 19 |
+
"existing_coordinate_members": 523,
|
| 20 |
+
"files": {
|
| 21 |
+
"data/supplemental/coordinates_01.tar.gz": {
|
| 22 |
+
"bytes": 477622181,
|
| 23 |
+
"sha256": "b70afc1300c7f4ebbae42cb48bf41721cc0a8b21523c1a9ba9e101827e9e0d94"
|
| 24 |
+
},
|
| 25 |
+
"data/supplemental/coordinates_02.tar.gz": {
|
| 26 |
+
"bytes": 283964776,
|
| 27 |
+
"sha256": "04f1bbbfd89a66cbec527871ec61a1532ff6efe992a1acc791bee7612211c3c9"
|
| 28 |
+
},
|
| 29 |
+
"metadata/supplemental/metric_conflicts.tsv.gz": {
|
| 30 |
+
"bytes": 23003,
|
| 31 |
+
"sha256": "7abb079f2e16994d46e73fd27d110e60bfa9f3152bc69bbcce2c676290e1ccb1"
|
| 32 |
+
},
|
| 33 |
+
"metadata/supplemental/model_identities.tsv.gz": {
|
| 34 |
+
"bytes": 244898,
|
| 35 |
+
"sha256": "ddabed3c2f3d7aad4796246ca92ba6c6280a7326c0c6c30829fa6a31343d2ee7"
|
| 36 |
+
},
|
| 37 |
+
"metadata/supplemental/models.tsv.gz": {
|
| 38 |
+
"bytes": 1706995,
|
| 39 |
+
"sha256": "dad847c9dcf88e0683a626d578943527666a77d86675565044ea6a5737c37281"
|
| 40 |
+
},
|
| 41 |
+
"metadata/supplemental/record_links.tsv.gz": {
|
| 42 |
+
"bytes": 261238,
|
| 43 |
+
"sha256": "758e981a30e760978174ad537c755fa00dc8326d7c91ef820a5b1aa374762d2f"
|
| 44 |
+
},
|
| 45 |
+
"metadata/supplemental/structure_metadata.tsv.gz": {
|
| 46 |
+
"bytes": 463907,
|
| 47 |
+
"sha256": "c63f5ffe11320ebde649e4f24124caabe436e6d3fd51624768130060dfd4d70e"
|
| 48 |
+
},
|
| 49 |
+
"metadata/supplemental/structures.tsv.gz": {
|
| 50 |
+
"bytes": 568238,
|
| 51 |
+
"sha256": "b16e5a40a720fdbfac109404fcda16260fc0d805ee46d36a8f57fd07a156e263"
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
"historical_model_identities_retained": 1298,
|
| 55 |
+
"link_basis": "Unique literal paired junction substrings in resolved coordinates, exact peptide/species/MHC context. Full receptor constructs are not established.",
|
| 56 |
+
"linked_records": 7288,
|
| 57 |
+
"linked_structures": 4773,
|
| 58 |
+
"metadata_rows": 13151,
|
| 59 |
+
"models_with_conflicting_metrics": 587,
|
| 60 |
+
"new_coordinate_members": 11279,
|
| 61 |
+
"record_link_rows": 16110,
|
| 62 |
+
"redacted_annotation_lines": 374,
|
| 63 |
+
"redacted_structures": 187,
|
| 64 |
+
"source_identifiers_included": false,
|
| 65 |
+
"source_members": 13191,
|
| 66 |
+
"verified_coordinate_digests": 11802
|
| 67 |
+
}
|
tools/ingest_supplemental.py
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Preserve authorized coordinates with content identities and allowlisted public metadata.
|
| 2 |
+
|
| 3 |
+
Run in the tcren environment. --manifest is a PRIVATE provenance input containing
|
| 4 |
+
source paths and per-member structural metadata. It must never enter the deposit.
|
| 5 |
+
No annotation, prediction, scoring, assay-label inference or source editing occurs.
|
| 6 |
+
"""
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
import argparse
|
| 9 |
+
import csv
|
| 10 |
+
import gzip
|
| 11 |
+
import hashlib
|
| 12 |
+
import io
|
| 13 |
+
import json
|
| 14 |
+
import math
|
| 15 |
+
import re
|
| 16 |
+
import tarfile
|
| 17 |
+
import tempfile
|
| 18 |
+
|
| 19 |
+
FIELDS = ['source_disposition', 'pairing_status', 'experimental_validation', 'is_native',
|
| 20 |
+
'species', 'antigen.epitope', 'mhc.a', 'mhc.b', 'mhc.class', 'cdr3.alpha',
|
| 21 |
+
'cdr3.beta', 'pdb_id', 'iptm', 'plddt', 'ptm', 'ranking_confidence',
|
| 22 |
+
'tcr_pmhc_iptm', 'in_spec', 'source_mhc_annotation', 'mhc_context_basis', 'source_mhc_class', 'mhc_class_completed']
|
| 23 |
+
METRICS = ['iptm', 'plddt', 'ptm', 'ranking_confidence', 'tcr_pmhc_iptm']
|
| 24 |
+
SEQUENCES = ['coordinate_alpha', 'coordinate_beta', 'coordinate_peptide', 'coordinate_mhca']
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def require_private_paths(root, *paths):
|
| 28 |
+
if any(path.resolve().is_relative_to(root.resolve()) for path in paths):
|
| 29 |
+
raise ValueError('Private manifests and mappings must remain outside the public dataset root')
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def coordinates(path):
|
| 33 |
+
"""Yield literal uncompressed coordinate bytes without extracting an archive."""
|
| 34 |
+
from tcren.structure.io import is_structure_file
|
| 35 |
+
if path.name.endswith(('.tar.gz', '.tgz', '.tar')):
|
| 36 |
+
with tarfile.open(path, 'r|*') as stream:
|
| 37 |
+
for member in stream:
|
| 38 |
+
if member.isfile() and is_structure_file(member.name):
|
| 39 |
+
raw = stream.extractfile(member).read()
|
| 40 |
+
yield member.name, gzip.decompress(raw) if member.name.endswith('.gz') else raw
|
| 41 |
+
elif is_structure_file(path):
|
| 42 |
+
raw = path.read_bytes()
|
| 43 |
+
yield path.name, gzip.decompress(raw) if path.name.endswith('.gz') else raw
|
| 44 |
+
else:
|
| 45 |
+
raise ValueError('Expected a coordinate file or archive')
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def sanitize_annotations(raw, suffix):
|
| 49 |
+
"""Remove private path-bearing text, preserving literal coordinate/chemistry records."""
|
| 50 |
+
protected = (b'ATOM ', b'HETATM', b'MODEL ', b'TER ', b'ENDMDL', b'SEQRES',
|
| 51 |
+
b'LINK ', b'CONECT', b'HET ', b'HETNAM', b'HETSYN', b'FORMUL', b'MODRES',
|
| 52 |
+
b'SSBOND', b'CISPEP', b'SITE ', b'ANISOU', b'SIGATM', b'SIGUIJ')
|
| 53 |
+
lines = raw.splitlines(keepends=True)
|
| 54 |
+
private = [line for line in lines if any(path in line for path in (b'/Users/', b'/projects/', b'/home/'))]
|
| 55 |
+
if not private:
|
| 56 |
+
return raw, 0
|
| 57 |
+
if suffix != '.pdb' or any(line.startswith(protected) for line in private):
|
| 58 |
+
raise ValueError('Sensitive identifier in a coordinate/chemical record requires review')
|
| 59 |
+
# PDB coordinate and chemical records are never rewritten or normalized.
|
| 60 |
+
output = b''.join(line for line in lines if line not in private)
|
| 61 |
+
before = b''.join(line for line in lines if line.startswith(protected))
|
| 62 |
+
after = b''.join(line for line in output.splitlines(keepends=True) if line.startswith(protected))
|
| 63 |
+
if hashlib.sha256(before).digest() != hashlib.sha256(after).digest():
|
| 64 |
+
raise ValueError('Confidentiality redaction changed coordinate/chemical records')
|
| 65 |
+
from tcren.structure.io import parse_structure
|
| 66 |
+
sequences = []
|
| 67 |
+
for content in [raw, output]:
|
| 68 |
+
with tempfile.NamedTemporaryFile(suffix=suffix) as temporary:
|
| 69 |
+
temporary.write(content)
|
| 70 |
+
temporary.flush()
|
| 71 |
+
structure = parse_structure(temporary.name, pdb_id='redaction-check', keep_modified=True)
|
| 72 |
+
sequences.append([(chain.chain_id, chain.sequence()) for chain in structure.chains])
|
| 73 |
+
if sequences[0] != sequences[1]:
|
| 74 |
+
raise ValueError('Confidentiality redaction changed resolved chain sequences')
|
| 75 |
+
return output, len(private)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def write_tsv(path, rows, fields):
|
| 79 |
+
with path.open('wb') as raw, gzip.GzipFile(filename='', mode='wb', fileobj=raw, mtime=0) as gz:
|
| 80 |
+
with io.TextIOWrapper(gz, encoding='utf-8', newline='') as text:
|
| 81 |
+
writer = csv.DictWriter(text, fieldnames=fields, delimiter='\t', lineterminator='\n')
|
| 82 |
+
writer.writeheader()
|
| 83 |
+
writer.writerows(rows)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def sha_file(path):
|
| 87 |
+
with path.open('rb') as stream:
|
| 88 |
+
return hashlib.file_digest(stream, 'sha256').hexdigest()
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def public_metadata(metadata):
|
| 92 |
+
unknown = set(metadata) - set(FIELDS)
|
| 93 |
+
if unknown:
|
| 94 |
+
raise ValueError('Private input metadata contains non-allowlisted field names')
|
| 95 |
+
out = {key: str(metadata.get(key, '')) for key in FIELDS}
|
| 96 |
+
if any(token in value for value in out.values() for token in ['/Users/', '/projects/', '/home/']):
|
| 97 |
+
raise ValueError('Identifying source path in public metadata')
|
| 98 |
+
if out['source_disposition'] not in {'native', 'predicted', 'mock', 'mutant', 'unknown'}:
|
| 99 |
+
raise ValueError('Invalid construction disposition')
|
| 100 |
+
if out['pairing_status'] not in {'reported_assignment', 'constructed_mismatch', 'unknown'}:
|
| 101 |
+
raise ValueError('Invalid pairing status')
|
| 102 |
+
if out['experimental_validation'] not in {'unknown', 'not_applicable'}:
|
| 103 |
+
raise ValueError('Assay results are not permitted')
|
| 104 |
+
if out['is_native'] not in {'true', 'false'}:
|
| 105 |
+
raise ValueError('Native status must be explicit')
|
| 106 |
+
for field in METRICS:
|
| 107 |
+
if out[field] in {'', 'NA', 'NaN', 'nan', 'None'}:
|
| 108 |
+
out[field] = ''
|
| 109 |
+
elif not math.isfinite(float(out[field])):
|
| 110 |
+
raise ValueError('Generator confidence must be finite or absent')
|
| 111 |
+
else:
|
| 112 |
+
out[field] = repr(float(out[field]))
|
| 113 |
+
return out
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def exact_links(models, tables):
|
| 117 |
+
"""Prove literal paired junction presence and exact peptide/species/pMHC context."""
|
| 118 |
+
import polars as pl
|
| 119 |
+
eligible = [m for m in models if m['pairing_status'] == 'reported_assignment'
|
| 120 |
+
and m['source_disposition'] == 'predicted' and all(m[c] for c in SEQUENCES[:3])]
|
| 121 |
+
fields = ['structure_id', 'record_id', 'sequence_state', 'link_basis']
|
| 122 |
+
if not eligible:
|
| 123 |
+
return [], fields
|
| 124 |
+
records = pl.read_parquet(tables/'records.parquet').select('record_id', 'species',
|
| 125 |
+
pl.col('antigen_epitope').alias('antigen.epitope'), pl.col('mhc_a').alias('mhc.a'),
|
| 126 |
+
pl.col('mhc_b').alias('mhc.b'), pl.col('mhc_class').alias('mhc.class'))
|
| 127 |
+
chains = pl.read_parquet(tables/'chains.parquet')
|
| 128 |
+
for gene, side in [('TRA', 'alpha'), ('TRB', 'beta')]:
|
| 129 |
+
records = records.join(chains.filter(pl.col('gene') == gene).select('record_id',
|
| 130 |
+
pl.col('cdr3').alias('repaired_'+side), pl.col('cdr3_original').alias('original_'+side)),
|
| 131 |
+
on='record_id', how='inner', validate='1:1')
|
| 132 |
+
context = ['species', 'antigen.epitope', 'mhc.a', 'mhc.b', 'mhc.class']
|
| 133 |
+
states = pl.concat([records.select('record_id', *context,
|
| 134 |
+
pl.col(state+'_alpha').alias('junction_alpha'), pl.col(state+'_beta').alias('junction_beta'),
|
| 135 |
+
pl.lit(state).alias('sequence_state')) for state in ['original', 'repaired']])
|
| 136 |
+
states = states.with_columns([pl.col(c).str.replace(
|
| 137 |
+
r'^(HLA-[A-Z0-9]+\*\d+:\d+)(?::\d+)*$', '${1}').alias(c) for c in ['mhc.a', 'mhc.b']])
|
| 138 |
+
states = states.filter(pl.all_horizontal([pl.col(c).fill_null('') != ''
|
| 139 |
+
for c in context+['junction_alpha', 'junction_beta']]))
|
| 140 |
+
model = pl.DataFrame(eligible).select('structure_id', *context, 'cdr3.alpha', 'cdr3.beta',
|
| 141 |
+
'coordinate_alpha', 'coordinate_beta', 'coordinate_peptide').with_columns([
|
| 142 |
+
pl.col(c).str.replace(r'^(HLA-[A-Z0-9]+\*\d+:\d+)(?::\d+)*$', '${1}').alias(c)
|
| 143 |
+
for c in ['mhc.a', 'mhc.b']]).unique().filter(
|
| 144 |
+
pl.all_horizontal([pl.col(c) != '' for c in context]))
|
| 145 |
+
supplied = (pl.col('cdr3.alpha') != '') & (pl.col('cdr3.beta') != '')
|
| 146 |
+
known = model.filter(supplied)
|
| 147 |
+
unknown = model.filter(~supplied)
|
| 148 |
+
keyed = states.with_columns(pl.col('junction_alpha').alias('cdr3.alpha'),
|
| 149 |
+
pl.col('junction_beta').alias('cdr3.beta'))
|
| 150 |
+
candidates = [known.join(keyed, on=context+['cdr3.alpha', 'cdr3.beta'], how='inner')]
|
| 151 |
+
# Bound context-only candidates; source-provided junctions use exact joins above.
|
| 152 |
+
for chunk in unknown.iter_slices(64):
|
| 153 |
+
candidates.append(chunk.join(states, on=context, how='inner').filter(
|
| 154 |
+
(pl.col('coordinate_alpha').str.count_matches(pl.col('junction_alpha'), literal=True) == 1) &
|
| 155 |
+
(pl.col('coordinate_beta').str.count_matches(pl.col('junction_beta'), literal=True) == 1)))
|
| 156 |
+
matched = pl.concat(candidates).filter(
|
| 157 |
+
(pl.col('coordinate_peptide') == pl.col('antigen.epitope')) &
|
| 158 |
+
(pl.col('coordinate_alpha').str.count_matches(pl.col('junction_alpha'), literal=True) == 1) &
|
| 159 |
+
(pl.col('coordinate_beta').str.count_matches(pl.col('junction_beta'), literal=True) == 1) &
|
| 160 |
+
((pl.col('cdr3.alpha') == '') | (pl.col('cdr3.alpha') == pl.col('junction_alpha'))) &
|
| 161 |
+
((pl.col('cdr3.beta') == '') | (pl.col('cdr3.beta') == pl.col('junction_beta'))))
|
| 162 |
+
return matched.select('structure_id', 'record_id', 'sequence_state').unique().with_columns(
|
| 163 |
+
pl.lit('literal_paired_junctions_peptide_species_pmhc').alias('link_basis')).sort(
|
| 164 |
+
'structure_id', 'record_id', 'sequence_state').to_dicts(), fields
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
def ingest(args):
|
| 168 |
+
from tcren.structure.io import parse_structure
|
| 169 |
+
root = args.root.resolve()
|
| 170 |
+
require_private_paths(root, args.manifest, args.private_mapping)
|
| 171 |
+
manifest = json.loads(args.manifest.read_text())
|
| 172 |
+
data = root/'data/supplemental'
|
| 173 |
+
meta = root/'metadata/supplemental'
|
| 174 |
+
data.mkdir(parents=True, exist_ok=True)
|
| 175 |
+
meta.mkdir(parents=True, exist_ok=True)
|
| 176 |
+
existing = {}
|
| 177 |
+
for path in sorted(root.rglob('*')):
|
| 178 |
+
if not path.is_file() or '.git' in path.parts or data in path.parents:
|
| 179 |
+
continue
|
| 180 |
+
if path.name.endswith(('.tgz', '.tar.gz', '.pdb', '.pdb.gz', '.cif.gz', '.mmcif.gz')):
|
| 181 |
+
for member, raw in coordinates(path):
|
| 182 |
+
digest = hashlib.sha256(raw).hexdigest()
|
| 183 |
+
existing.setdefault(digest, {'archive_path': str(path.relative_to(root)),
|
| 184 |
+
'archive_member': member, 'coordinate_bytes': len(raw)})
|
| 185 |
+
print('Existing distinct coordinate contents:', len(existing), flush=True)
|
| 186 |
+
catalogue, models, private = {}, [], []
|
| 187 |
+
archives = []
|
| 188 |
+
for batch in manifest['batches']:
|
| 189 |
+
if not re.fullmatch(r'coordinates_[0-9]{2,}', batch['output_id']):
|
| 190 |
+
raise ValueError('Output archives require neutral numbered names')
|
| 191 |
+
archive_path = data/(batch['output_id']+'.tar.gz')
|
| 192 |
+
archives.append(archive_path)
|
| 193 |
+
with archive_path.open('wb') as raw_out, gzip.GzipFile(filename='', mode='wb',
|
| 194 |
+
fileobj=raw_out, mtime=0, compresslevel=6) as gz, tarfile.open(
|
| 195 |
+
fileobj=gz, mode='w|', format=tarfile.USTAR_FORMAT) as output:
|
| 196 |
+
for source in batch['sources']:
|
| 197 |
+
path = Path(source['path'])
|
| 198 |
+
source_sha = sha_file(path)
|
| 199 |
+
for member, raw in coordinates(path):
|
| 200 |
+
original_sha = hashlib.sha256(raw).hexdigest()
|
| 201 |
+
suffix = '.cif' if member.removesuffix('.gz').endswith(('.cif', '.mmcif')) else '.pdb'
|
| 202 |
+
raw, removed_lines = sanitize_annotations(raw, suffix)
|
| 203 |
+
digest = hashlib.sha256(raw).hexdigest()
|
| 204 |
+
metadata = public_metadata(source['metadata'].get(member, source.get('default', {})))
|
| 205 |
+
suffix = '.cif' if member.removesuffix('.gz').endswith(('.cif', '.mmcif')) else '.pdb'
|
| 206 |
+
if digest not in existing:
|
| 207 |
+
name = digest+suffix
|
| 208 |
+
entry = tarfile.TarInfo(name)
|
| 209 |
+
entry.size = len(raw)
|
| 210 |
+
entry.mode = 0o644
|
| 211 |
+
output.addfile(entry, io.BytesIO(raw))
|
| 212 |
+
existing[digest] = {'archive_path': str(archive_path.relative_to(root)),
|
| 213 |
+
'archive_member': name, 'coordinate_bytes': len(raw)}
|
| 214 |
+
catalogue[digest] = {'structure_id': digest, **existing[digest]}
|
| 215 |
+
sequence = {key: '' for key in SEQUENCES}
|
| 216 |
+
if source.get('chain_roles'):
|
| 217 |
+
with tempfile.NamedTemporaryFile(suffix=suffix) as temporary:
|
| 218 |
+
temporary.write(raw)
|
| 219 |
+
temporary.flush()
|
| 220 |
+
structure = parse_structure(temporary.name, pdb_id=digest, keep_modified=b'HETATM' in raw)
|
| 221 |
+
by_chain = {chain.chain_id: chain.sequence() for chain in structure.chains}
|
| 222 |
+
for field, chain in source['chain_roles'].items():
|
| 223 |
+
sequence[field] = by_chain.get(chain, '')
|
| 224 |
+
if metadata['pairing_status'] == 'reported_assignment' and not all(
|
| 225 |
+
sequence[field] for field in SEQUENCES[:3]):
|
| 226 |
+
raise ValueError('Reported assignment lacks required coordinate chains')
|
| 227 |
+
models.append({'structure_id': digest, **metadata, **sequence})
|
| 228 |
+
private.append({'structure_id': digest, 'source_path': str(path),
|
| 229 |
+
'source_member': member, 'source_sha256': source_sha,
|
| 230 |
+
'original_coordinate_sha256': original_sha, 'redacted_annotation_lines': removed_lines})
|
| 231 |
+
print('Completed neutral archive:', archive_path.name, archive_path.stat().st_size, flush=True)
|
| 232 |
+
model_fields = ['structure_id', *FIELDS, *SEQUENCES]
|
| 233 |
+
models = [dict(zip(model_fields, key)) for key in sorted({tuple(row[k] for k in model_fields) for row in models})]
|
| 234 |
+
cat = sorted(catalogue.values(), key=lambda row: row['structure_id'])
|
| 235 |
+
links, link_fields = exact_links(models, args.tables)
|
| 236 |
+
write_tsv(meta/'structures.tsv.gz', cat, ['structure_id', 'archive_path', 'archive_member', 'coordinate_bytes'])
|
| 237 |
+
write_tsv(meta/'models.tsv.gz', models, model_fields)
|
| 238 |
+
write_tsv(meta/'record_links.tsv.gz', links, link_fields)
|
| 239 |
+
write_tsv(args.private_mapping, private, ['structure_id', 'source_path', 'source_member', 'source_sha256',
|
| 240 |
+
'original_coordinate_sha256', 'redacted_annotation_lines'])
|
| 241 |
+
verified = set()
|
| 242 |
+
wanted = set(catalogue)
|
| 243 |
+
for path in sorted({root/row['archive_path'] for row in cat}):
|
| 244 |
+
for member, raw in coordinates(path):
|
| 245 |
+
digest = hashlib.sha256(raw).hexdigest()
|
| 246 |
+
if digest in wanted and catalogue[digest]['archive_path'] == str(path.relative_to(root)):
|
| 247 |
+
assert catalogue[digest]['archive_member'] == member
|
| 248 |
+
assert catalogue[digest]['coordinate_bytes'] == len(raw)
|
| 249 |
+
verified.add(digest)
|
| 250 |
+
assert verified == wanted
|
| 251 |
+
new_members = 0
|
| 252 |
+
for path in archives:
|
| 253 |
+
for member, raw in coordinates(path):
|
| 254 |
+
assert Path(member).stem == hashlib.sha256(raw).hexdigest()
|
| 255 |
+
if any(token in raw for token in [b'/Users/', b'/projects/', b'/home/']):
|
| 256 |
+
raise ValueError('Identifying source path remains in exported coordinates')
|
| 257 |
+
new_members += 1
|
| 258 |
+
report = {'source_members': len(private), 'distinct_structures': len(cat), 'metadata_rows': len(models),
|
| 259 |
+
'new_coordinate_members': new_members, 'existing_coordinate_members': len(cat)-new_members,
|
| 260 |
+
'verified_coordinate_digests': len(verified), 'record_link_rows': len(links),
|
| 261 |
+
'linked_structures': len({x['structure_id'] for x in links}),
|
| 262 |
+
'linked_records': len({x['record_id'] for x in links}),
|
| 263 |
+
'assay_results_included': False, 'source_identifiers_included': False,
|
| 264 |
+
'redacted_structures': sum(row['redacted_annotation_lines'] > 0 for row in private),
|
| 265 |
+
'redacted_annotation_lines': sum(row['redacted_annotation_lines'] for row in private),
|
| 266 |
+
'coordinate_and_chemical_records_unchanged': True,
|
| 267 |
+
'link_basis': 'Unique literal paired junction substrings in resolved coordinates, exact peptide/species/MHC context. Full receptor constructs are not established.',
|
| 268 |
+
'files': {str(p.relative_to(root)): {'sha256': sha_file(p), 'bytes': p.stat().st_size}
|
| 269 |
+
for p in [*archives, meta/'structures.tsv.gz', meta/'models.tsv.gz', meta/'record_links.tsv.gz']}}
|
| 270 |
+
(meta/'verification.json').write_text(json.dumps(report, indent=2, sort_keys=True)+'\n')
|
| 271 |
+
print(json.dumps({k:v for k,v in report.items() if k != 'files'}, indent=2), flush=True)
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
def build_metadata(args):
|
| 275 |
+
"""Emit build rows only after exact coordinate/context proof, preserving model identity."""
|
| 276 |
+
import polars as pl
|
| 277 |
+
root = args.root.resolve()
|
| 278 |
+
require_private_paths(root, args.manifest, args.private_mapping)
|
| 279 |
+
meta = root/'metadata/supplemental'
|
| 280 |
+
manifest = json.loads(args.manifest.read_text())
|
| 281 |
+
declared = {(s['path'], member): identity for batch in manifest['batches']
|
| 282 |
+
for s in batch['sources'] for member, identity in s.get('model_identities', {}).items()}
|
| 283 |
+
identities = {}
|
| 284 |
+
with gzip.open(args.private_mapping, 'rt') as stream:
|
| 285 |
+
for row in csv.DictReader(stream, delimiter='\t'):
|
| 286 |
+
identity = declared.get((row['source_path'], row['source_member']))
|
| 287 |
+
if identity:
|
| 288 |
+
identities.setdefault(row['structure_id'], set()).add(identity)
|
| 289 |
+
if any(len(values) != 1 for values in identities.values()):
|
| 290 |
+
raise ValueError('One coordinate content has conflicting declared model identities')
|
| 291 |
+
models = pl.read_csv(meta/'models.tsv.gz', separator='\t', infer_schema_length=0).fill_null('')
|
| 292 |
+
models = models.filter((pl.col('pairing_status') == 'reported_assignment') &
|
| 293 |
+
(pl.col('source_disposition') == 'predicted'))
|
| 294 |
+
links = pl.read_csv(meta/'record_links.tsv.gz', separator='\t', infer_schema_length=0)
|
| 295 |
+
chains = pl.read_parquet(args.tables/'chains.parquet')
|
| 296 |
+
current = pl.read_parquet(args.tables/'records.parquet').select('record_id', 'species',
|
| 297 |
+
pl.col('antigen_epitope').alias('antigen.epitope'), pl.col('mhc_a').alias('mhc.a'),
|
| 298 |
+
pl.col('mhc_b').alias('mhc.b'), pl.col('mhc_class').alias('mhc.class'))
|
| 299 |
+
for gene, side in [('TRA', 'alpha'), ('TRB', 'beta')]:
|
| 300 |
+
current = current.join(chains.filter(pl.col('gene') == gene).select('record_id',
|
| 301 |
+
pl.col('cdr3').alias('repaired_'+side), pl.col('cdr3_original').alias('original_'+side)),
|
| 302 |
+
on='record_id', how='inner', validate='1:1')
|
| 303 |
+
context = ['species', 'antigen.epitope', 'mhc.a', 'mhc.b', 'mhc.class']
|
| 304 |
+
states = pl.concat([current.select('record_id', *context,
|
| 305 |
+
pl.col(state+'_alpha').alias('junction_alpha'), pl.col(state+'_beta').alias('junction_beta'),
|
| 306 |
+
pl.lit(state).alias('sequence_state')) for state in ['original', 'repaired']])
|
| 307 |
+
states = states.with_columns([pl.col(c).str.replace(
|
| 308 |
+
r'^(HLA-[A-Z0-9]+\*\d+:\d+)(?::\d+)*$', '${1}').alias(c) for c in ['mhc.a', 'mhc.b']])
|
| 309 |
+
models = models.with_columns([pl.col(c).str.replace(
|
| 310 |
+
r'^(HLA-[A-Z0-9]+\*\d+:\d+)(?::\d+)*$', '${1}').alias(c) for c in ['mhc.a', 'mhc.b']])
|
| 311 |
+
proven = models.join(links, on='structure_id', how='inner').join(states,
|
| 312 |
+
on=['record_id', 'sequence_state', *context], how='inner').filter(
|
| 313 |
+
((pl.col('cdr3.alpha') == '') | (pl.col('cdr3.alpha') == pl.col('junction_alpha'))) &
|
| 314 |
+
((pl.col('cdr3.beta') == '') | (pl.col('cdr3.beta') == pl.col('junction_beta'))))
|
| 315 |
+
identity = {key: next(iter(values)) for key, values in identities.items()}
|
| 316 |
+
proven = proven.with_columns(pl.col('structure_id').replace_strict(identity,
|
| 317 |
+
default=pl.col('structure_id')).alias('tcr_pmhc_hash'))
|
| 318 |
+
output_fields = ['tcr_pmhc_hash', 'is_native', 'cdr3.alpha', 'cdr3.beta', *context, *METRICS]
|
| 319 |
+
out = proven.select('tcr_pmhc_hash', pl.lit('false').alias('is_native'),
|
| 320 |
+
pl.col('junction_alpha').alias('cdr3.alpha'), pl.col('junction_beta').alias('cdr3.beta'),
|
| 321 |
+
*context, *METRICS).unique().sort('tcr_pmhc_hash', 'cdr3.alpha', 'cdr3.beta')
|
| 322 |
+
conflicts = []
|
| 323 |
+
conflict_counts = {}
|
| 324 |
+
for metric in METRICS:
|
| 325 |
+
bad = out.filter(pl.col(metric) != '').group_by('tcr_pmhc_hash').agg(
|
| 326 |
+
pl.col(metric).n_unique().alias('n_distinct_supplied_values')).filter(
|
| 327 |
+
pl.col('n_distinct_supplied_values') > 1)
|
| 328 |
+
conflict_counts[metric] = bad.height
|
| 329 |
+
conflicts.extend(bad.with_columns(pl.lit(metric).alias('metric')).select(
|
| 330 |
+
'tcr_pmhc_hash', 'metric', 'n_distinct_supplied_values').to_dicts())
|
| 331 |
+
out = out.with_columns(pl.when(pl.col('tcr_pmhc_hash').is_in(bad['tcr_pmhc_hash'].to_list()))
|
| 332 |
+
.then(pl.lit('')).otherwise(pl.col(metric)).alias(metric))
|
| 333 |
+
# Remaining nonempty values agree exactly; missing observations add no competing value.
|
| 334 |
+
identity_fields = ['tcr_pmhc_hash', 'is_native', 'cdr3.alpha', 'cdr3.beta', *context]
|
| 335 |
+
out = out.group_by(identity_fields).agg([
|
| 336 |
+
pl.col(c).filter(pl.col(c) != '').first().fill_null('').alias(c) for c in METRICS])
|
| 337 |
+
conflict_frame = pl.DataFrame(conflicts, schema={'tcr_pmhc_hash':pl.String,
|
| 338 |
+
'metric':pl.String, 'n_distinct_supplied_values':pl.Int64})
|
| 339 |
+
counts = conflict_frame.group_by('tcr_pmhc_hash').len().rename({'len':'n_conflicting_metrics'})
|
| 340 |
+
out = out.join(counts, on='tcr_pmhc_hash', how='left').with_columns(
|
| 341 |
+
pl.col('n_conflicting_metrics').fill_null(0),
|
| 342 |
+
(pl.col('n_conflicting_metrics').fill_null(0) > 0).alias('has_conflicting_metrics')).sort(
|
| 343 |
+
'tcr_pmhc_hash', 'cdr3.alpha', 'cdr3.beta')
|
| 344 |
+
output_fields += ['has_conflicting_metrics', 'n_conflicting_metrics']
|
| 345 |
+
conflict_path = meta/'metric_conflicts.tsv.gz'
|
| 346 |
+
write_tsv(conflict_path, sorted(conflicts, key=lambda row:(row['tcr_pmhc_hash'],row['metric'])),
|
| 347 |
+
['tcr_pmhc_hash', 'metric', 'n_distinct_supplied_values'])
|
| 348 |
+
path = meta/'structure_metadata.tsv.gz'
|
| 349 |
+
write_tsv(path, out.to_dicts(), output_fields)
|
| 350 |
+
association = proven.select('structure_id', 'tcr_pmhc_hash').unique().sort('structure_id', 'tcr_pmhc_hash')
|
| 351 |
+
write_tsv(meta/'model_identities.tsv.gz', association.to_dicts(), ['structure_id', 'tcr_pmhc_hash'])
|
| 352 |
+
report = json.loads((meta/'verification.json').read_text())
|
| 353 |
+
report['database_table_sha256'] = {name:sha_file(args.tables/name) for name in ['records.parquet','chains.parquet']}
|
| 354 |
+
report['build_metadata_rows'] = out.height
|
| 355 |
+
report['build_model_identities'] = out['tcr_pmhc_hash'].n_unique()
|
| 356 |
+
report['historical_model_identities_retained'] = len(set(out['tcr_pmhc_hash']) & set(identity.values()))
|
| 357 |
+
report['conflicting_model_metrics'] = conflict_counts
|
| 358 |
+
report['models_with_conflicting_metrics'] = counts.height
|
| 359 |
+
report['conflict_policy'] = 'Exact supplied-value disagreements remain separate observations; conflicting build-facing cells are unavailable, without rounding, averaging or selecting a source.'
|
| 360 |
+
for p in [path, meta/'model_identities.tsv.gz', conflict_path]:
|
| 361 |
+
report['files'][str(p.relative_to(root))] = {'sha256': sha_file(p), 'bytes': p.stat().st_size}
|
| 362 |
+
(meta/'verification.json').write_text(json.dumps(report, indent=2, sort_keys=True)+'\n')
|
| 363 |
+
print('Build metadata:', out.height, 'rows;', out['tcr_pmhc_hash'].n_unique(), 'model identities', flush=True)
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
def self_check():
|
| 367 |
+
with tempfile.TemporaryDirectory() as tmp:
|
| 368 |
+
root = Path(tmp)/'public'
|
| 369 |
+
require_private_paths(root, Path(tmp)/'private.json', Path(tmp)/'private.tsv.gz')
|
| 370 |
+
for nested in [root/'mapping.tsv.gz', root/'metadata/private.json']:
|
| 371 |
+
try:
|
| 372 |
+
require_private_paths(root, nested)
|
| 373 |
+
except ValueError:
|
| 374 |
+
pass
|
| 375 |
+
else:
|
| 376 |
+
raise AssertionError('Private provenance path boundary failed')
|
| 377 |
+
base = dict(source_disposition='predicted', pairing_status='reported_assignment',
|
| 378 |
+
experimental_validation='unknown', is_native='false')
|
| 379 |
+
assert public_metadata(base)['iptm'] == ''
|
| 380 |
+
for extra in [{'y': '1'}, {'source_path': '/private'}, {'iptm': 'inf'}]:
|
| 381 |
+
try:
|
| 382 |
+
public_metadata(base | extra)
|
| 383 |
+
except ValueError:
|
| 384 |
+
pass
|
| 385 |
+
else:
|
| 386 |
+
raise AssertionError('Metadata boundary failed')
|
| 387 |
+
with tempfile.TemporaryDirectory() as tmp:
|
| 388 |
+
path = Path(tmp)/'check.tsv.gz'
|
| 389 |
+
write_tsv(path, [{'id': 'a'}], ['id'])
|
| 390 |
+
first = path.read_bytes()
|
| 391 |
+
write_tsv(path, [{'id': 'a'}], ['id'])
|
| 392 |
+
assert first == path.read_bytes()
|
| 393 |
+
atom = b'ATOM 1 CA ALA A 1 1.000 2.000 3.000 1.00 20.00 C \n'
|
| 394 |
+
raw = atom + b'#BEGIN_POSE_ENERGIES_TABLE /projects/private/source.pdb\n'
|
| 395 |
+
clean, removed = sanitize_annotations(raw, '.pdb')
|
| 396 |
+
assert clean == atom and removed == 1
|
| 397 |
+
try:
|
| 398 |
+
sanitize_annotations(atom.rstrip() + b' /projects/private\n', '.pdb')
|
| 399 |
+
except ValueError:
|
| 400 |
+
pass
|
| 401 |
+
else:
|
| 402 |
+
raise AssertionError('Coordinate-record redaction boundary failed')
|
| 403 |
+
import polars as pl
|
| 404 |
+
with tempfile.TemporaryDirectory() as tmp:
|
| 405 |
+
tables = Path(tmp)
|
| 406 |
+
pl.DataFrame({'record_id':['R1'], 'species':['HomoSapiens'], 'antigen_epitope':['AAA'],
|
| 407 |
+
'mhc_a':['HLA-A*02:01'], 'mhc_b':['B2M'], 'mhc_class':['MHCI']}).write_parquet(tables/'records.parquet')
|
| 408 |
+
pl.DataFrame({'record_id':['R1','R1'], 'gene':['TRA','TRB'],
|
| 409 |
+
'cdr3':['CAVF','CASSF'], 'cdr3_original':['CAVF','CASSF']}).write_parquet(tables/'chains.parquet')
|
| 410 |
+
model = public_metadata(base | {'species':'HomoSapiens', 'antigen.epitope':'AAA',
|
| 411 |
+
'mhc.a':'HLA-A*02:01', 'mhc.b':'B2M', 'mhc.class':'MHCI'}) | {
|
| 412 |
+
'structure_id':'a'*64, 'coordinate_alpha':'QQCAVFSS', 'coordinate_beta':'QQCASSFSS',
|
| 413 |
+
'coordinate_peptide':'AAA', 'coordinate_mhca':'MMMM'}
|
| 414 |
+
links, _ = exact_links([model], tables)
|
| 415 |
+
assert len(links) == 2 and {row['record_id'] for row in links} == {'R1'}
|
| 416 |
+
known = model | {'cdr3.alpha':'CAVF', 'cdr3.beta':'CASSF'}
|
| 417 |
+
assert exact_links([known, model], tables)[0] == links
|
| 418 |
+
assert exact_links([known | {'cdr3.alpha':'WRONG'}], tables)[0] == []
|
| 419 |
+
assert exact_links([model | {'source_disposition':'mock'}], tables)[0] == []
|
| 420 |
+
assert exact_links([model | {'mhc.a':'HLA-A*01:01'}], tables)[0] == []
|
| 421 |
+
assert exact_links([model | {'coordinate_beta':'WRONG'}], tables)[0] == []
|
| 422 |
+
assert exact_links([model | {'coordinate_alpha':'CAVFCAVF'}], tables)[0] == []
|
| 423 |
+
print('Supplemental ingestion self-check passed')
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
if __name__ == '__main__':
|
| 427 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 428 |
+
parser.add_argument('--root', type=Path)
|
| 429 |
+
parser.add_argument('--manifest', type=Path)
|
| 430 |
+
parser.add_argument('--tables', type=Path)
|
| 431 |
+
parser.add_argument('--private-mapping', type=Path)
|
| 432 |
+
parser.add_argument('--self-check', action='store_true')
|
| 433 |
+
args = parser.parse_args()
|
| 434 |
+
if args.self_check:
|
| 435 |
+
self_check()
|
| 436 |
+
elif not all([args.root, args.manifest, args.tables, args.private_mapping]):
|
| 437 |
+
parser.error('root, manifest, tables and private-mapping are required')
|
| 438 |
+
else:
|
| 439 |
+
ingest(args)
|
| 440 |
+
build_metadata(args)
|