Pharmacophore CrossMiner API
Programmatic access to pharmacophore searching, property analysis, and quantum biology tools. Perfect for high-throughput screening campaigns and automated workflows.
Base URL
http://localhost:8000Format
JSONPharmacophore Search
Search molecular databases with 3D pharmacophore queries
POST
/api/search/pharmacophoreRequest Body
{
"features": [
{
"type": "HBD",
"x": 1.1,
"y": 0.6,
"z": 1.9,
"radius": 2.0,
"optional": false
},
{
"type": "HBA",
"x": 2.7,
"y": 1.6,
"z": 3.3,
"radius": 2.0,
"optional": false
},
{
"type": "aromatic",
"x": -1.3,
"y": 2.0,
"z": 2.6,
"radius": 2.0,
"optional": false
}
]
}Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
max_results | integer | 100 | Maximum number of results to return |
similarity_threshold | float | 0.7 | Minimum similarity score (0.0-1.0) |
cURL Example
curl -X POST "http://localhost:8000/api/search/pharmacophore?max_results=100&similarity_threshold=0.7" \
-H "Content-Type: application/json" \
-d '{
"features": [
{"type": "HBD", "x": 1.1, "y": 0.6, "z": 1.9, "radius": 2.0, "optional": false},
{"type": "HBA", "x": 2.7, "y": 1.6, "z": 3.3, "radius": 2.0, "optional": false},
{"type": "aromatic", "x": -1.3, "y": 2.0, "z": 2.6, "radius": 2.0, "optional": false}
]
}'Python Example
import requests
import json
# Define pharmacophore query
query = {
"features": [
{"type": "HBD", "x": 1.1, "y": 0.6, "z": 1.9, "radius": 2.0, "optional": False},
{"type": "HBA", "x": 2.7, "y": 1.6, "z": 3.3, "radius": 2.0, "optional": False},
{"type": "aromatic", "x": -1.3, "y": 2.0, "z": 2.6, "radius": 2.0, "optional": False}
]
}
# Search database
response = requests.post(
"http://localhost:8000/api/search/pharmacophore",
params={"max_results": 100, "similarity_threshold": 0.7},
json=query
)
# Process results
results = response.json()
for hit in results["results"]:
print(f"{hit['molecule']['name']}: {hit['match_score']:.1%} match")
print(f" SMILES: {hit['molecule']['smiles']}")
print(f" Matched Features: {hit['matched_features']}/{hit['total_features']}")
print()Response Example
{
"query": {
"features": [...],
"max_results": 100,
"similarity_threshold": 0.7
},
"results": [
{
"molecule": {
"id": "mol_001",
"name": "Imatinib",
"smiles": "CC1=C(C=C(C=C1)NC(=O)C2=CC=C(C=C2)CN3CCN(CC3)C)NC4=NC=CC(=N4)C5=CC=CC=N5",
"source": "DrugBank",
"molecular_weight": 493.6,
"logp": 3.45,
"hbd_count": 2,
"hba_count": 7
},
"match_score": 1.0,
"matched_features": 4,
"total_features": 4,
"feature_matches": [
{"query_index": 0, "type": "HBD", "distance": 0.15},
{"query_index": 1, "type": "HBA", "distance": 0.23},
{"query_index": 2, "type": "aromatic", "distance": 0.18},
{"query_index": 3, "type": "hydrophobic", "distance": 0.45}
]
}
],
"total_results": 23,
"search_time_ms": 145
}Batch Screening
Screen multiple pharmacophore queries in a single request
POST
/api/search/batchPython Example - High-Throughput Screening
import requests
from typing import List, Dict
import pandas as pd
class PharmacophoreScreener:
"""High-throughput pharmacophore screening client"""
def __init__(self, base_url: str = "http://localhost:8000"):
self.base_url = base_url
def screen_library(self, queries: List[Dict], max_results: int = 1000):
"""Screen multiple pharmacophore queries"""
results = []
for i, query in enumerate(queries):
print(f"Screening query {i+1}/{len(queries)}...")
response = requests.post(
f"{self.base_url}/api/search/pharmacophore",
params={
"max_results": max_results,
"similarity_threshold": query.get("threshold", 0.7)
},
json={"features": query["features"]}
)
if response.status_code == 200:
data = response.json()
results.append({
"query_id": query.get("id", f"query_{i}"),
"hits": len(data["results"]),
"top_hit": data["results"][0] if data["results"] else None,
"search_time_ms": data["search_time_ms"]
})
return pd.DataFrame(results)
def export_results(self, results_df: pd.DataFrame, filename: str):
"""Export screening results to CSV"""
results_df.to_csv(filename, index=False)
print(f"Results exported to {filename}")
# Example usage
screener = PharmacophoreScreener()
# Define multiple queries for screening
queries = [
{
"id": "kinase_query_1",
"features": [
{"type": "HBD", "x": 1.1, "y": 0.6, "z": 1.9, "radius": 2.0, "optional": False},
{"type": "HBA", "x": 2.7, "y": 1.6, "z": 3.3, "radius": 2.0, "optional": False}
],
"threshold": 0.7
},
{
"id": "gpcr_query_1",
"features": [
{"type": "positive", "x": 4.8, "y": -1.6, "z": -2.7, "radius": 2.0, "optional": False},
{"type": "aromatic", "x": -1.4, "y": 2.5, "z": 2.7, "radius": 2.0, "optional": False}
],
"threshold": 0.65
}
]
# Run screening campaign
results = screener.screen_library(queries, max_results=500)
screener.export_results(results, "screening_campaign_results.csv")
# Analyze results
print(f"\nTotal queries screened: {len(results)}")
print(f"Total hits found: {results['hits'].sum()}")
print(f"Average search time: {results['search_time_ms'].mean():.1f} ms")Molecular Properties
Calculate molecular descriptors and drug-likeness
GET
/api/molecules/:idPython Example
import requests
# Get molecule with calculated properties
molecule_id = "mol_001"
response = requests.get(f"http://localhost:8000/api/molecules/{molecule_id}")
molecule = response.json()
print(f"Molecule: {molecule['name']}")
print(f"SMILES: {molecule['smiles']}")
print(f"\nProperties:")
print(f" Molecular Weight: {molecule['properties']['molecular_weight']:.2f}")
print(f" LogP: {molecule['properties']['logp']:.2f}")
print(f" TPSA: {molecule['properties']['tpsa']:.2f}")
print(f" HBD: {molecule['properties']['hbd_count']}")
print(f" HBA: {molecule['properties']['hba_count']}")
print(f" Rotatable Bonds: {molecule['properties']['rotatable_bonds']}")
print(f"\nLipinski's Rule of Five: {'PASS' if molecule['properties']['lipinski_violations'] == 0 else 'FAIL'}")3D Structure Generation
Convert SMILES to 3D MOL format for visualization
GET
/api/molecules/mol-formatPython Example
import requests
# Convert SMILES to 3D MOL format
smiles = "CC(C)Cc1ccc(C(C)C(=O)O)cc1" # Ibuprofen
response = requests.get(
"http://localhost:8000/api/molecules/mol-format",
params={"smiles": smiles}
)
mol_block = response.json()["mol_format"]
# Save to file for visualization
with open("molecule_3d.mol", "w") as f:
f.write(mol_block)
print(f"3D structure saved to molecule_3d.mol")
print(f"MOL block size: {len(mol_block)} characters")Best Practices for Production Use
Rate Limiting
- Implement exponential backoff for retries
- Batch requests where possible to reduce API calls
- Cache frequently used queries to avoid redundant searches
Error Handling
- Always check response status codes
- Handle network timeouts gracefully
- Log failed requests for debugging
- Validate input data before sending requests
Performance Optimization
- Use appropriate
max_resultslimits to reduce payload size - Filter results on the server side rather than client side
- Use streaming for large result sets when available
- Parallelize independent requests with proper connection pooling