Chemical Properties API Reference¶
pycomptox.chemical.property.ChemicalProperties
¶
Bases: CachedAPIClient
Client for accessing chemical property data from EPA CompTox Dashboard.
This class provides methods for retrieving: - Property summaries (physchem and fate) - Predicted properties from QSAR models - Experimental property measurements - Environmental fate and transport data
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str
|
CompTox API key. If not provided, will attempt to load from saved configuration or COMPTOX_API_KEY environment variable. |
None
|
base_url
|
str
|
Base URL for the CompTox API. Defaults to EPA's endpoint. |
'https://comptox.epa.gov/ctx-api'
|
time_delay_between_calls
|
float, **kwargs
|
Delay in seconds between API calls for rate limiting. Default is 0.0 (no delay). |
0.0
|
Example
from pycomptox import ChemicalProperties props = ChemicalProperties()
Get property summary for Bisphenol A¶
summary = props.get_property_summary_by_dtxsid("DTXSID7020182")
Get experimental properties¶
exp_props = props.get_experimental_properties_by_dtxsid("DTXSID7020182")
Source code in src/pycomptox/chemical/property.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
__init__(api_key=None, base_url='https://comptox.epa.gov/ctx-api', time_delay_between_calls=0.0, **kwargs)
¶
Initialize the ChemicalProperties client.
Source code in src/pycomptox/chemical/property.py
get_all_experimental_property_names(use_cache=None)
¶
Get list of all available experimental property names.
Returns a list of all property names that have experimental (measured) values in the database. Useful for discovering what properties can be queried.
Returns:
| Type | Description |
|---|---|
List[Dict[str, str]]
|
List of dictionaries with 'propertyName' field |
Example
props = ChemicalProperties() exp_names = props.get_all_experimental_property_names() print(f"Available experimental properties: {len(exp_names)}") for prop in exp_names[:10]: ... print(f" - {prop['propertyName']}")
Source code in src/pycomptox/chemical/property.py
get_experimental_properties_by_dtxsid(dtxsid, use_cache=None)
¶
Get all experimental (measured) properties for a chemical by DTXSID.
Returns all available experimental property measurements from various data sources for the specified chemical.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., "DTXSID7020182") |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing experimental property data. Each entry includes: - dtxsid: DSSTox Substance Identifier - propName: Property name - propValue: Measured value - propUnit: Unit of measurement - sourceName: Data source - lsCitation: Literature citation - expDetailsTemperatureC: Temperature conditions - expDetailsPh: pH conditions - publicSourceUrl: URL to data source - And more fields... |
Example
props = ChemicalProperties() exp_props = props.get_experimental_properties_by_dtxsid("DTXSID7020182") for prop in exp_props: ... print(f"{prop['propName']}: {prop['propValue']} {prop.get('propUnit', '')}") ... print(f" Source: {prop.get('sourceName', 'N/A')}")
Source code in src/pycomptox/chemical/property.py
get_experimental_properties_by_dtxsid_batch(dtxsids, use_cache=None)
¶
Get experimental properties for multiple chemicals in a single request.
Batch retrieval of experimental (measured) properties for up to 1000 chemicals. More efficient than making individual requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsids
|
List[str]
|
List of DSSTox Substance Identifiers (max 1000) |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing experimental property data for all |
List[Dict[str, Any]]
|
requested chemicals. Each entry includes the same fields as |
List[Dict[str, Any]]
|
get_experimental_properties_by_dtxsid(). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If more than 1000 DTXSIDs are provided |
Example
props = ChemicalProperties() dtxsids = ["DTXSID7020182", "DTXSID0020232", "DTXSID5020108"] batch_props = props.get_experimental_properties_by_dtxsid_batch(dtxsids)
Group by chemical¶
by_chemical = {} for prop in batch_props: ... dtxsid = prop['dtxsid'] ... if dtxsid not in by_chemical: ... by_chemical[dtxsid] = [] ... by_chemical[dtxsid].append(prop)
for dtxsid, properties in by_chemical.items(): ... print(f"{dtxsid}: {len(properties)} experimental properties")
Source code in src/pycomptox/chemical/property.py
get_experimental_properties_by_name_and_range(property_name, min_value, max_value, use_cache=None)
¶
Get chemicals with experimental property values within a specified range.
Search for chemicals where a specific experimental (measured) property falls within the given range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_name
|
str
|
Property name (e.g., "Boiling Point", "Melting Point") |
required |
min_value
|
float
|
Minimum value of the range (inclusive) |
required |
max_value
|
float
|
Maximum value of the range (inclusive) |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing experimental property data with fields: - id: Property record ID - dtxsid: DSSTox Substance Identifier - dtxcid: DSSTox Compound Identifier - smiles: SMILES notation - propName: Property name - propValue: Measured value - propUnit: Unit of measurement - propValueOriginal: Original reported value - sourceName: Data source name - lsCitation: Literature citation - briefCitation: Brief citation - expDetailsPh: pH conditions - expDetailsTemperatureC: Temperature in Celsius - expDetailsPressureMmhg: Pressure in mmHg - publicSourceUrl: URL to public source - And more fields... |
Example
props = ChemicalProperties()
Find chemicals with boiling point between 100-200°C¶
results = props.get_experimental_properties_by_name_and_range( ... "Boiling Point", 100.0, 200.0 ... ) for chem in results[:5]: ... print(f"{chem['dtxsid']}: {chem['propValue']} {chem['propUnit']}")
Source code in src/pycomptox/chemical/property.py
get_fate_by_dtxsid_batch(dtxsids, use_cache=None)
¶
Get environmental fate properties for multiple chemicals in a single request.
Batch retrieval of environmental fate and transport properties for up to 1000 chemicals. More efficient than making individual requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsids
|
List[str]
|
List of DSSTox Substance Identifiers (max 1000) |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing fate property data for all |
List[Dict[str, Any]]
|
requested chemicals. Each entry includes similar fields as |
List[Dict[str, Any]]
|
experimental properties (propName, propValue, propUnit, etc.) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If more than 1000 DTXSIDs are provided |
Example
props = ChemicalProperties() dtxsids = ["DTXSID7020182", "DTXSID0020232", "DTXSID5020108"] fate_props = props.get_fate_by_dtxsid_batch(dtxsids)
Group by chemical¶
by_chemical = {} for prop in fate_props: ... dtxsid = prop['dtxsid'] ... if dtxsid not in by_chemical: ... by_chemical[dtxsid] = [] ... by_chemical[dtxsid].append(prop)
for dtxsid, properties in by_chemical.items(): ... print(f"{dtxsid}: {len(properties)} fate properties")
Source code in src/pycomptox/chemical/property.py
get_fate_summary_by_dtxsid(dtxsid, use_cache=None)
¶
Get environmental fate and transport property summary by DTXSID.
Returns a summary of predicted and experimental environmental fate properties including ranges, medians, and averages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., "DTXSID7020182") |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing fate property summaries with fields: - propName: Property name - unit: Unit of measurement - predictedRange: Range of predicted values - predictedMedian: Median predicted value - predictedAverage: Average predicted value - experimentalRange: Range of experimental values - experimentalMedian: Median experimental value - experimentalAverage: Average experimental value |
Example
props = ChemicalProperties() fate = props.get_fate_summary_by_dtxsid("DTXSID7020182") for prop in fate: ... print(f"{prop['propName']}: {prop.get('predictedMedian', 'N/A')} {prop.get('unit', '')}")
Source code in src/pycomptox/chemical/property.py
get_fate_summary_by_dtxsid_and_property(dtxsid, property_name, use_cache=None)
¶
Get environmental fate property summary for a specific property and chemical.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier |
required |
property_name
|
str
|
Name of the fate/transport property |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary containing summary for the specified fate property with fields: - propName: Property name - unit: Unit of measurement - predictedRange: Range of predicted values - predictedMedian: Median predicted value - predictedAverage: Average predicted value - experimentalRange: Range of experimental values - experimentalMedian: Median experimental value - experimentalAverage: Average experimental value |
Example
props = ChemicalProperties() koc = props.get_fate_summary_by_dtxsid_and_property( ... "DTXSID7020182", ... "Koc" ... ) print(f"Koc: {koc.get('predictedMedian')} {koc.get('unit')}")
Source code in src/pycomptox/chemical/property.py
get_predicted_properties_by_dtxsid(dtxsid, use_cache=None)
¶
Get all predicted (QSAR) properties for a chemical by DTXSID.
Returns all available predicted property values from various QSAR models for the specified chemical.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., "DTXSID7020182") |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing predicted property data. Each entry includes: - dtxsid: DSSTox Substance Identifier - dtxcid: DSSTox Compound Identifier - propName: Property name - propValue: Predicted value - propUnit: Unit of measurement - modelName: Name of prediction model - modelId: Model identifier - adConclusion: Applicability domain conclusion - hasQmrf: Whether QMRF documentation exists - And more fields... |
Example
props = ChemicalProperties() predicted = props.get_predicted_properties_by_dtxsid("DTXSID7020182") for prop in predicted: ... print(f"{prop['propName']}: {prop['propValue']} {prop.get('propUnit', '')}")
Source code in src/pycomptox/chemical/property.py
get_predicted_properties_by_dtxsid_batch(dtxsids, use_cache=None)
¶
Get predicted properties for multiple chemicals in a single request.
Batch retrieval of predicted (QSAR) properties for up to 1000 chemicals. More efficient than making individual requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsids
|
List[str]
|
List of DSSTox Substance Identifiers (max 1000) |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing predicted property data for all |
List[Dict[str, Any]]
|
requested chemicals. Each entry includes the same fields as |
List[Dict[str, Any]]
|
get_predicted_properties_by_dtxsid(). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If more than 1000 DTXSIDs are provided |
Example
props = ChemicalProperties() dtxsids = ["DTXSID7020182", "DTXSID0020232", "DTXSID5020108"] batch_props = props.get_predicted_properties_by_dtxsid_batch(dtxsids)
Group by chemical¶
by_chemical = {} for prop in batch_props: ... dtxsid = prop['dtxsid'] ... if dtxsid not in by_chemical: ... by_chemical[dtxsid] = [] ... by_chemical[dtxsid].append(prop)
for dtxsid, properties in by_chemical.items(): ... print(f"{dtxsid}: {len(properties)} properties")
Source code in src/pycomptox/chemical/property.py
get_predicted_property_by_name_and_range(property_name, min_value, max_value, use_cache=None)
¶
Get chemicals with predicted property values within a specified range.
Search for chemicals where a specific predicted property falls within the given range. Useful for finding chemicals with desired characteristics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
property_name
|
str
|
Property identifier/name |
required |
min_value
|
float
|
Minimum value of the range (inclusive) |
required |
max_value
|
float
|
Maximum value of the range (inclusive) |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing predicted property data with fields: - id: Property record ID - dtxsid: DSSTox Substance Identifier - dtxcid: DSSTox Compound Identifier - smiles: SMILES notation - canonQsarSmiles: Canonical QSAR-ready SMILES - propName: Property name - propCategory: Property category - propDescription: Property description - modelName: Prediction model name - modelId: Model identifier - propValue: Predicted value - propUnit: Unit of measurement - propValueString: Value as string - adMethod: Applicability domain method - adConclusion: AD conclusion - hasQmrf: Has QMRF documentation - And more fields... |
Example
props = ChemicalProperties()
Find chemicals with log P between 2 and 4¶
results = props.get_predicted_property_by_name_and_range( ... "Log P", 2.0, 4.0 ... ) for chem in results[:5]: ... print(f"{chem['dtxsid']}: {chem['propValue']}")
Source code in src/pycomptox/chemical/property.py
get_predicted_property_names(use_cache=None)
¶
Get list of all available predicted property names.
Returns a list of all property names that have predicted (QSAR) values in the database. Useful for discovering what properties can be queried.
Returns:
| Type | Description |
|---|---|
List[Dict[str, str]]
|
List of dictionaries with 'propertyName' field |
Example
props = ChemicalProperties() prop_names = props.get_predicted_property_names() print(f"Available properties: {len(prop_names)}") for prop in prop_names[:10]: ... print(f" - {prop['propertyName']}")
Source code in src/pycomptox/chemical/property.py
get_property_summary_by_dtxsid(dtxsid, use_cache=None)
¶
Get physicochemical property summary by DTXSID.
Returns a summary of predicted and experimental property values including ranges, medians, and averages for various physicochemical properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier (e.g., "DTXSID7020182") |
required |
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of dictionaries containing property summaries with fields: - propName: Property name - unit: Unit of measurement - predictedRange: Range of predicted values - predictedMedian: Median predicted value - predictedAverage: Average predicted value - experimentalRange: Range of experimental values - experimentalMedian: Median experimental value - experimentalAverage: Average experimental value |
Example
props = ChemicalProperties() summary = props.get_property_summary_by_dtxsid("DTXSID7020182") for prop in summary: ... print(f"{prop['propName']}: {prop.get('experimentalMedian', 'N/A')}")
Source code in src/pycomptox/chemical/property.py
get_summary_by_dtxsid_and_property(dtxsid, property_name, use_cache=None)
¶
Get physicochemical property summary for a specific property and chemical.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dtxsid
|
str
|
DSSTox Substance Identifier |
required |
property_name
|
str
|
Name of the property (e.g., "Boiling Point", "Melting Point") |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary containing summary for the specified property with fields: - propName: Property name - unit: Unit of measurement - predictedRange: Range of predicted values - predictedMedian: Median predicted value - predictedAverage: Average predicted value - experimentalRange: Range of experimental values - experimentalMedian: Median experimental value - experimentalAverage: Average experimental value |
Example
props = ChemicalProperties() bp_summary = props.get_summary_by_dtxsid_and_property( ... "DTXSID7020182", ... "Boiling Point" ... ) print(f"Boiling Point: {bp_summary.get('experimentalMedian')} {bp_summary.get('unit')}")