Spaces:
Sleeping
Sleeping
Download app/shared_parameters.py from awolter/gelpredict: direct link, hf CLI and curl.
- Browser
- Download file 26.6 kB
-
https://huggingface.co/spaces/awolter/gelpredict/resolve/main/app/shared_parameters.py
- Command line
-
hf download hf://spaces/awolter/gelpredict/app/shared_parameters.py
-
curl -L -o shared_parameters.py https://huggingface.co/spaces/awolter/gelpredict/resolve/main/app/shared_parameters.py
26.6 kB
"""
GelPredict Shared Parameters
- Single source of truth for all dropdowns, ranges, and validation rules
- Ensures consistency across LAB and LITERATURE GUIs
- Used by: Hydrogels, Cell Growth, Morphology modules
"""
from typing import Dict, List, Tuple, Any
# ============================================================================
# ECM & HYDROGEL PARAMETERS
# ============================================================================
# ECM Families
ECM_FAMILIES = [
"collagen",
"decECM",
"fibrin",
"alginate",
"gelMA",
"hyaluronan",
"PEG_DA",
"composite",
"other"
]
# Species (Source organisms)
SPECIES = [
"human",
"porcine",
"bovine",
"ovine",
"equine",
"murine",
"rat",
"chicken",
"fish",
"other"
]
# Tissues/Organs
TISSUES = [
"mammary",
"dermis",
"myocardium",
"skeletal_muscle",
"tendon",
"cartilage",
"bone",
"liver",
"kidney",
"lung",
"intestine",
"bladder",
"brain",
"spinal_cord",
"adipose",
"placenta",
"umbilical_cord",
"whole_organ",
"mixed_tissue",
"other"
]
# Protein Assay Methods
PROTEIN_ASSAY_METHODS = [
"",
"BCA",
"Bradford",
"Lowry",
"DC_assay",
"A280",
"Biuret",
"other"
]
# ============================================================================
# CHEMISTRY & REAGENT OPTIONS (For consistency across all GUIs)
# ============================================================================
# Common Buffers & Solutions
COMMON_BUFFERS = [
"PBS",
"DPBS",
"HBSS",
"Tris-HCl",
"HEPES",
"MOPS",
"Bicarbonate buffer",
"Phosphate buffer",
"Acetate buffer",
"Citrate buffer",
"Glycine buffer",
"DI water",
"Distilled water",
"Ultrapure water",
"Other"
]
# Common Bases (for pH adjustment)
COMMON_BASES = [
"NaOH",
"KOH",
"Na2CO3",
"NaHCO3",
"Tris base",
"HEPES",
"Triethanolamine",
"Other"
]
# Common Acids (for pH adjustment)
COMMON_ACIDS = [
"HCl",
"Acetic acid",
"Phosphoric acid",
"Citric acid",
"Lactic acid",
"Other"
]
# Common Salts
COMMON_SALTS = [
"NaCl",
"KCl",
"CaCl2",
"MgCl2",
"MgSO4",
"Na2HPO4",
"KH2PO4",
"Glucose",
"Other"
]
# Decellularization Agents
DECELL_AGENTS = [
"SDS (Sodium dodecyl sulfate)",
"Triton X-100",
"Tween-20",
"Sodium deoxycholate",
"CHAPS",
"N-lauroylsarcosine sodium salt",
"Peracetic acid",
"Acetic acid",
"Freeze-thaw (physical)",
"Hypotonic/hypertonic",
"Other"
]
# Delipidization Solvents
DELIPID_SOLVENTS = [
"Isopropanol",
"Ethanol",
"Acetone",
"Chloroform/methanol",
"Petroleum ether",
"Hexane",
"SDS",
"Triton X-100",
"Other"
]
# Enzymes (for digestion/processing)
COMMON_ENZYMES = [
"Pepsin",
"Trypsin",
"Collagenase",
"Dispase",
"DNase",
"RNase",
"Elastase",
"Hyaluronidase",
"Proteinase K",
"Other"
]
# Diluents (for reconstitution/dilution after lyophilization)
COMMON_DILUENTS = [
"DI water",
"PBS (1x)",
"DPBS",
"0.001M HCl",
"0.01M HCl",
"0.1M HCl",
"0.001M Acetic acid",
"0.01M Acetic acid",
"0.02M Acetic acid",
"0.1M Acetic acid",
"0.5M Acetic acid",
"0.1M NaOH",
"DMEM",
"Culture media",
"Saline (0.9% NaCl)",
"HEPES buffer",
"Tris-HCl buffer",
"Sodium bicarbonate buffer",
"Custom buffer",
"Other"
]
# Reagent Purposes (for gelation/processing)
REAGENT_PURPOSES = [
"Neutralization",
"pH adjustment",
"Ionic strength adjustment",
"Buffer capacity",
"Crosslinking",
"Gelation trigger",
"Osmolarity adjustment",
"Media supplement",
"Enzyme cofactor",
"Stabilization",
"Preservation",
"Sterilization",
"Other"
]
# Gelation Step Types (for dynamic builder)
GELATION_STEP_TYPES = [
"Dilute/Concentrate",
"Add Reagent",
"pH Adjust",
"Incubate",
"Media Wash",
"Hydrate",
"Stability Test",
"Crosslink",
"Mix/Vortex",
"Other"
]
# Processing Step Types (for ECM prep)
PROCESSING_STEP_TYPES = [
"Decellularization",
"Wash",
"Delipidization",
"Enzymatic Digestion",
"Homogenization",
"Grinding/Milling",
"Freeze-Thaw",
"Lyophilization",
"pH Adjustment",
"Dialysis",
"Filtration",
"Centrifugation",
"Sterilization",
"Storage",
"Other"
]
# Filtration Types
FILTER_TYPES = [
"spin_filter",
"syringe_filter",
"vacuum_filter",
"gravity_filter",
"membrane_filter",
"depth_filter",
"other"
]
# Common Filter Pore Sizes
FILTER_PORE_SIZES = [
"0.1 µm",
"0.22 µm",
"0.45 µm",
"0.8 µm",
"5 µm",
"10 µm",
"40 µm",
"70 µm",
"100 µm",
"10 kDa",
"30 kDa",
"50 kDa",
"100 kDa",
"Other"
]
# Centrifuge Purposes
CENTRIFUGE_PURPOSES = [
"clarification",
"concentration",
"pellet_removal",
"debris_removal",
"phase_separation",
"desalting",
"buffer_exchange",
"other"
]
# Probe Types (for turbidity/gelation kinetics)
PROBE_TYPES = [
"",
"turbidity_OD",
"rheology",
"visual_tilt",
"fluorescence",
"other"
]
# Failure Modes
FAILURE_MODES = [
"",
"no_gelation",
"weak_gel",
"precipitation",
"syneresis",
"enzymatic_degradation",
"contamination",
"other"
]
# Commercial Products (Hydrogels)
COMMERCIAL_PRODUCTS = {
"Matrigel": {"vendor": "Corning", "family": "collagen", "catalog_prefix": "354"},
"Matrigel GFR": {"vendor": "Corning", "family": "collagen", "catalog_prefix": "356"},
"Cultrex": {"vendor": "R&D Systems", "family": "collagen", "catalog_prefix": "3432"},
"Cultrex BME": {"vendor": "R&D Systems", "family": "collagen", "catalog_prefix": "3433"},
"Geltrex": {"vendor": "Thermo Fisher", "family": "collagen", "catalog_prefix": "A1413"},
"PureCol": {"vendor": "Advanced BioMatrix", "family": "collagen", "catalog_prefix": "5005"},
"VitroCol": {"vendor": "Advanced BioMatrix", "family": "collagen", "catalog_prefix": "5007"},
"Rat Tail Collagen I": {"vendor": "Corning", "family": "collagen", "catalog_prefix": "354236"},
"Collagen I": {"vendor": "Invitrogen", "family": "collagen", "catalog_prefix": "A1048"},
"Custom/Other": {"vendor": "", "family": "", "catalog_prefix": ""}
}
# Numeric Ranges (for validation)
RANGES = {
"ecm_total_protein_mgml": (0.0, 100.0),
"pre_pH": (0.0, 14.0),
"target_pH": (0.0, 14.0),
"pre_conductivity_mS": (0.0, 150.0),
"temp_incubation_C": (0.0, 80.0),
"uv_absorbance": (0.0, 10.0),
"gel_strength_score_0to3": (0, 3),
"confidence_0to1": (0.0, 1.0),
"time_to_halfmax_min": (0.0, 10000.0),
"od_wavelength_nm": (300, 900),
}
# ============================================================================
# CELL CULTURE PARAMETERS
# ============================================================================
# Cell Lines (50+ common lines)
CELL_LINES = [
# Human epithelial/breast
"MCF10A", "MCF-12A", "MCF7", "MDA-MB-231", "T47D", "ZR-75-1", "BT-474", "SK-BR-3",
# Human fibroblasts
"HFF-1", "BJ", "WI-38", "MRC-5", "IMR-90",
# Human stem cells
"hMSC", "hESC", "hiPSC", "hASC", "hBMSC",
# Human endothelial
"HUVEC", "HMEC-1", "EA.hy926", "HCAEC",
# Human kidney/liver
"HEK293", "HEK293T", "HepG2", "Huh7",
# Human other
"A549", "Caco-2", "HeLa", "HT-1080", "U-2 OS",
# Mouse fibroblasts
"NIH-3T3", "L929", "MEF",
# Mouse stem/progenitor
"mMSC", "mESC", "C2C12", "C3H10T1/2",
# Mouse other
"MC3T3-E1", "4T1", "B16-F10", "RAW 264.7", "EPH4", "EpH4-Ev",
# Rat
"PC12", "H9c2", "RBL-2H3",
# Porcine
"CPAE", "PK-15",
# Other/Custom
"Primary cells", "Patient-derived", "Organoid", "Co-culture", "Other"
]
# Fluorescent Reporters
FLUORESCENT_REPORTERS = [
"None", "GFP", "EGFP", "RFP", "mCherry", "tdTomato",
"CFP", "YFP", "mTurquoise", "Venus", "Citrine",
"iRFP", "mKate2", "TagBFP", "Multiple", "Other"
]
# Seeding Methods (Primary)
SEEDING_METHODS = [
"bioprinted",
"microinjected_manual",
"microinjected_automated",
"mixed_in_gel",
"on_top_2D",
"sandwiched",
"encapsulated",
"overlay",
"droplet",
"other"
]
# ============================================================================
# SPATIAL SEEDING PARAMETERS (For Bioprinting & Microinjection)
# ============================================================================
# Injection/Print Patterns (XY layout)
INJECTION_PATTERNS = [
"single_point", # 1 injection
"linear_array", # 1 row, N injections
"grid_2d", # M rows × N columns
"concentric_circles", # Concentric rings
"radial_spokes", # Spoke pattern from center
"random_distributed", # Random XY positions
"custom_coordinates" # User-defined XY list
]
# Z-depth strategies
Z_DEPTH_STRATEGIES = [
"single_depth", # All injections at same Z
"varying_depth", # Different Z per injection
"z_gradient", # Z increases/decreases
"void_formation", # Start_Z to End_Z (creates void/channel)
"layered_discrete", # Multiple discrete Z planes
"spiral_3d" # 3D spiral pattern
]
# Spacing patterns (XY)
SPACING_PATTERNS = [
"uniform", # Equal spacing
"gradient_increasing", # Spacing increases
"gradient_decreasing", # Spacing decreases
"clustered", # Groups with gaps
"logarithmic", # Log-scale spacing
"custom" # User-defined spacing
]
# Typical spacing ranges (mm)
SPACING_RANGES = {
"ultra_tight": (0.05, 0.1),
"tight": (0.1, 0.5),
"medium": (0.5, 1.5),
"loose": (1.5, 3.0),
"sparse": (3.0, 10.0),
"custom": (0.0, 50.0)
}
# Cell count per injection strategies
CELLS_PER_INJECTION_STRATEGIES = [
"uniform", # Same count all injections
"gradient_center_high", # More in center
"gradient_edge_high", # More at edges
"gradient_linear", # Linear increase/decrease
"alternating", # High-low-high pattern
"random", # Random variation
"custom_per_injection" # Specify each
]
# Print/Injection Parameters
INJECTION_PARAMS = {
"needle_sizes": [
# Gauge sizes (smaller number = larger diameter)
"18G (1.27mm)", "20G (0.91mm)", "22G (0.72mm)", "25G (0.51mm)",
"27G (0.41mm)", "30G (0.31mm)", "32G (0.24mm)", "33G (0.21mm)", "34G (0.18mm)",
# Direct diameter (for your 1.0mm)
"1.0mm", "0.8mm", "0.5mm", "Other"
],
"flow_rate_uL_per_sec": (0.1, 100.0), # μL/sec
"dwell_time_sec": (0.0, 60.0), # Seconds at injection site
"injection_volume_uL": (0.1, 1000.0), # μL per injection
}
# Well Geometry (for hydrogel height calculations)
# Format: {plate_type: {well_diameter_mm, well_area_mm2}}
WELL_GEOMETRY = {
"6-well": {"diameter_mm": 34.8, "area_mm2": 950.0, "max_volume_uL": 3000},
"12-well": {"diameter_mm": 22.1, "area_mm2": 383.0, "max_volume_uL": 2000},
"24-well": {"diameter_mm": 15.6, "area_mm2": 191.0, "max_volume_uL": 1000},
"48-well": {"diameter_mm": 11.0, "area_mm2": 95.0, "max_volume_uL": 500},
"96-well": {"diameter_mm": 6.4, "area_mm2": 32.2, "max_volume_uL": 200},
"384-well": {"diameter_mm": 3.6, "area_mm2": 10.2, "max_volume_uL": 80},
}
# Default Bioprinting Parameters (User-Specific)
# These are the typical settings for collagen bioprinting workflow
DEFAULT_BIOPRINT_PARAMS = {
"hydrogel_volume_uL": 700.0,
"well_type": "24-well",
"pattern_type": "grid_2d",
"rows": 3, # 3 lines
"columns": 10, # 10 injections per line
"xy_spacing_within_line_mm": 0.3, # 0.3 mm between injections in same line
"xy_spacing_between_lines_mm": 1.5, # 1.5 mm between lines
"spacing_pattern": "uniform",
"z_strategy": "void_formation",
"z_start_mm": 1.5,
"z_end_mm": 1.51, # Very small void (0.01 mm = 10 μm)
"cells_per_injection": 50,
"cell_distribution": "uniform",
"needle_size": "1.0mm", # Your standard needle
"injection_volume_uL": 5.0,
"flow_rate_uL_per_sec": 1.0,
"notes": "Standard collagen bioprinting protocol"
}
# Base Media Options
BASE_MEDIA = [
"DMEM",
"DMEM/F-12",
"Ham's F-12",
"RPMI-1640",
"MEM",
"EMEM",
"IMDM",
"M199",
"Other"
]
# Serum & Supplements
SERA_SUPPLEMENTS = [
"FBS",
"FCS",
"HS (Human Serum)",
"Knockout Serum",
"B27",
"N2",
"Other"
]
# Growth Factors
GROWTH_FACTORS = [
"EGF",
"FGF-basic",
"FGF2",
"FGF7",
"VEGF",
"IGF-1",
"PDGF",
"TGF-β",
"HGF",
"NGF",
"BDNF",
"Other"
]
# Extra Media Additions
EXTRA_ADDITIONS = [
"Insulin",
"Transferrin",
"Selenium (ITS)",
"Hydrocortisone",
"Cholera toxin",
"Adenine",
"L-Glutamine",
"HEPES",
"Sodium pyruvate",
"Non-essential amino acids",
"β-mercaptoethanol",
"Ascorbic acid",
"Dexamethasone",
"Retinoic acid",
"ROCK inhibitor (Y-27632)",
"Antibiotic (Pen/Strep)",
"Gentamicin",
"Other"
]
# Cell Assay Types
CELL_ASSAYS = [
"MTT",
"AlamarBlue",
"Live/Dead",
"Trypan Blue",
"Brightfield Count",
"Flow Cytometry",
"IF",
"IHC",
"Western Blot",
"qPCR",
"Other"
]
# Cell Ranges
CELL_RANGES = {
"passage_number": (0, 200),
"seeding_density_cells_per_ml": (0.0, 5e8),
"incubator_temp_C": (0.0, 60.0),
"incubator_CO2_percent": (0.0, 20.0),
"viability_percent": (0.0, 100.0),
"confluence_percent": (0.0, 100.0),
}
# ============================================================================
# MORPHOLOGY PARAMETERS
# ============================================================================
# Structure Types
STRUCTURE_TYPES = [
"organoid",
"2D_monolayer",
"3D_spheroid",
"colony",
"aggregate",
"single_cells",
"other"
]
# Lumen Morphology
LUMEN_MORPHOLOGIES = [
"none",
"single_central",
"multiple_small",
"thin_irregular",
"large_expanded",
"cystic"
]
# Branching Complexity
BRANCHING_LEVELS = [
"none",
"simple",
"moderate",
"complex",
"highly_complex"
]
# Cell Shapes
CELL_SHAPES = [
"epithelial",
"mesenchymal",
"rounded",
"elongated",
"spindle",
"cuboidal",
"columnar",
"mixed"
]
# Differentiation States
DIFFERENTIATION_STATES = [
"undifferentiated",
"partially_differentiated",
"fully_differentiated",
"mixed_population"
]
# Monolayer Integrity
MONOLAYER_INTEGRITY = [
"intact",
"minor_gaps",
"major_gaps",
"lifting",
"deteriorating"
]
# Imaging Modalities
IMAGING_MODALITIES = [
"brightfield",
"phase_contrast",
"confocal",
"two_photon",
"IF",
"IHC",
"live_imaging",
"SEM",
"TEM",
"other"
]
# Expression Levels (IF/IHC)
EXPRESSION_LEVELS = [
"negative",
"weak",
"moderate",
"strong",
"very_strong"
]
# Cellular Localization
LOCALIZATIONS = [
"nuclear",
"cytoplasmic",
"membrane",
"ECM",
"secreted",
"mixed"
]
# Common Immunofluorescence Markers
COMMON_MARKERS = {
"Epithelial": ["CK8", "CK14", "CK18", "CK19", "E-cadherin", "EpCAM"],
"Luminal": ["ER-alpha", "PR", "CK8/18", "GATA3"],
"Basal/Myoepithelial": ["CK5", "CK14", "p63", "SMA", "CD10"],
"Stem/Progenitor": ["CD44", "CD24", "ALDH1", "Sox2", "Oct4"],
"Proliferation": ["Ki67", "PCNA", "BrdU", "EdU"],
"Apoptosis": ["Cleaved Caspase-3", "TUNEL", "Annexin V"],
"ECM": ["Collagen IV", "Laminin", "Fibronectin", "Integrin-β1"],
"Junctions": ["ZO-1", "Claudin", "Occludin", "β-catenin"],
"Signaling": ["p-ERK", "p-AKT", "STAT3", "NFκB"],
"Other": ["Custom"]
}
# ============================================================================
# LITERATURE-SPECIFIC OPTIONS
# ============================================================================
# For literature data where values may not be reported
UNKNOWN_OPTIONS = {
"temperature": ["Not Reported", "Room Temperature (~25°C)", "Physiological (37°C)", "Specific Value"],
"pH": ["Not Reported", "Neutral (~7.0)", "Physiological (~7.4)", "Specific Value"],
"time": ["Not Reported", "Approximate", "Specific Value"],
"concentration": ["Not Reported", "Standard/Typical", "Specific Value"],
}
# Common literature reporting patterns
APPROXIMATE_VALUES = {
"temp_room": 25.0,
"temp_physiological": 37.0,
"temp_ice": 4.0,
"pH_neutral": 7.0,
"pH_physiological": 7.4,
"pH_acidic": 4.0,
}
# Morphology Score Ranges
MORPHOLOGY_SCORES = {
"maturity_score_0to5": (0, 5),
"complexity_score_0to5": (0, 5),
"health_score_0to5": (0, 5),
}
# Size Ranges (micrometers)
SIZE_RANGES = {
"lumen_diameter_um": (0.0, 1000.0),
"structure_diameter_um": (0.0, 5000.0),
"structure_volume_um3": (0.0, 1e9),
"branching_count": (0, 100),
"cell_count_estimated": (0, 1000000),
}
# ============================================================================
# PROTOCOL STEP TYPES
# ============================================================================
# ECM Processing Steps (12 types)
PROCESSING_STEP_TYPES = [
"Decell",
"Wash",
"Delipid",
"Enzyme",
"Homogenize",
"Grind/Mill",
"Freeze-Thaw",
"Lyophilize",
"pH Adjust",
"Dialysis",
"Storage",
"Other"
]
# Gelation Protocol Steps (8 types)
GELATION_STEP_TYPES = [
"Dilute/Conc",
"Add Reagent",
"pH Adjust",
"Incubate",
"Media Wash",
"Hydrate",
"Stability Test",
"Other"
]
# Common Decellularization Methods
DECELL_METHODS = [
"SDS",
"Triton X-100",
"CHAPS",
"Freeze-Thaw",
"Enzymatic",
"Supercritical CO2",
"Combination",
"Other"
]
# Common Enzymes for Digestion
DIGESTION_ENZYMES = [
"Pepsin",
"Trypsin",
"Collagenase",
"Dispase",
"DNase",
"RNase",
"Combination",
"Other"
]
# ============================================================================
# UNIT SYSTEMS
# ============================================================================
# Concentration Units
CONCENTRATION_UNITS = {
"mass_conc": ["ng/mL", "µg/mL", "mg/mL", "g/L"],
"molar": ["nM", "µM", "mM", "M"],
"percent": ["%", "v/v%", "w/v%", "w/w%"],
"fold": ["x"],
"activity": ["U/mL", "U/mg"],
"volume": ["mL/L"],
}
# All concentration units (flattened)
ALL_CONCENTRATION_UNITS = [
"ng/mL", "µg/mL", "mg/mL", "g/L",
"nM", "µM", "mM", "M",
"%", "v/v%", "w/v%", "w/w%",
"x",
"U/mL", "U/mg",
"mL/L"
]
# Temperature Units
TEMPERATURE_UNITS = ["°C", "°F", "K"]
# Time Units
TIME_UNITS = ["min", "hours", "days", "weeks"]
# Volume Units
VOLUME_UNITS = ["µL", "mL", "L"]
# pH Scale
PH_RANGE = (0.0, 14.0)
# ============================================================================
# VALIDATION FUNCTIONS
# ============================================================================
def validate_range(value: float, range_name: str) -> bool:
"""Validate a numeric value against named range."""
if range_name in RANGES:
min_val, max_val = RANGES[range_name]
return min_val <= value <= max_val
elif range_name in CELL_RANGES:
min_val, max_val = CELL_RANGES[range_name]
return min_val <= value <= max_val
elif range_name in MORPHOLOGY_SCORES:
min_val, max_val = MORPHOLOGY_SCORES[range_name]
return min_val <= value <= max_val
elif range_name in SIZE_RANGES:
min_val, max_val = SIZE_RANGES[range_name]
return min_val <= value <= max_val
return True # Unknown range - assume valid
def validate_in_list(value: str, list_name: str) -> bool:
"""Validate a value is in a named list."""
lists_map = {
"ecm_families": ECM_FAMILIES,
"species": SPECIES,
"tissues": TISSUES,
"protein_assay_methods": PROTEIN_ASSAY_METHODS,
"cell_lines": CELL_LINES,
"fluorescent_reporters": FLUORESCENT_REPORTERS,
"seeding_methods": SEEDING_METHODS,
"base_media": BASE_MEDIA,
"structure_types": STRUCTURE_TYPES,
"lumen_morphologies": LUMEN_MORPHOLOGIES,
"branching_levels": BRANCHING_LEVELS,
"cell_shapes": CELL_SHAPES,
"differentiation_states": DIFFERENTIATION_STATES,
}
if list_name in lists_map:
return value in lists_map[list_name]
return True # Unknown list - assume valid
# ============================================================================
# HELPER FUNCTIONS
# ============================================================================
def get_family_abbreviation(family: str) -> str:
"""Get standard abbreviation for ECM family."""
family_map = {
"decECM": "dECM",
"collagen": "COL",
"fibrin": "FIB",
"alginate": "ALG",
"gelMA": "gMA",
"hyaluronan": "HA",
"PEG_DA": "PEG",
"composite": "COMP",
"other": "OTH"
}
return family_map.get(family, family[:4].upper() if family else "UNK")
def get_species_abbreviation(species: str) -> str:
"""Get 3-letter abbreviation for species."""
species_map = {
"human": "Hum",
"porcine": "Por",
"bovine": "Bov",
"ovine": "Ovi",
"equine": "Equ",
"murine": "Mur",
"rat": "Rat",
"chicken": "Chi",
"fish": "Fis",
}
sp = species_map.get(species.lower() if species else "", None)
if sp:
return sp
# Fallback: capitalize first 3 chars
return species[:3].capitalize() if species and len(species) >= 3 else species.upper() if species else "Unk"
def get_tissue_abbreviation(tissue: str) -> str:
"""Get 3-letter abbreviation for tissue."""
tissue_map = {
"mammary": "Mam",
"dermis": "Der",
"myocardium": "Myo",
"skeletal_muscle": "Ske",
"tendon": "Ten",
"cartilage": "Car",
"bone": "Bon",
"liver": "Liv",
"kidney": "Kid",
"lung": "Lun",
"intestine": "Int",
"bladder": "Bla",
"brain": "Bra",
"spinal_cord": "Spi",
"adipose": "Adi",
"placenta": "Pla",
"umbilical_cord": "Umb",
}
tis = tissue_map.get(tissue.lower() if tissue else "", None)
if tis:
return tis
# Fallback
return tissue[:3].capitalize() if tissue and len(tissue) >= 3 else tissue.upper() if tissue else "Unk"
# ============================================================================
# CODEBOOK STRUCTURE (for backward compatibility)
# ============================================================================
def get_codebook_dict() -> Dict[str, List[str]]:
"""
Return codebook-style dictionary for backward compatibility.
This replaces loading from CSV.
"""
return {
"family": ECM_FAMILIES,
"species": SPECIES,
"tissues": TISSUES,
"protein_assay_method": PROTEIN_ASSAY_METHODS,
"probe_type": PROBE_TYPES,
"failure_mode": FAILURE_MODES,
"cell_line": CELL_LINES,
"fluorescent_reporter": FLUORESCENT_REPORTERS,
"seeding_method": SEEDING_METHODS,
"base_media": BASE_MEDIA,
"sera_supplement": SERA_SUPPLEMENTS,
"growth_factor": GROWTH_FACTORS,
"extra_addition": EXTRA_ADDITIONS,
"structure_type": STRUCTURE_TYPES,
"lumen_morphology": LUMEN_MORPHOLOGIES,
"branching_level": BRANCHING_LEVELS,
"cell_shape": CELL_SHAPES,
"differentiation_state": DIFFERENTIATION_STATES,
"monolayer_integrity": MONOLAYER_INTEGRITY,
"imaging_modality": IMAGING_MODALITIES,
"expression_level": EXPRESSION_LEVELS,
"localization": LOCALIZATIONS,
}
# ============================================================================
# CONSISTENCY CHECKS
# ============================================================================
def verify_parameter_consistency() -> List[str]:
"""
Verify that parameters are consistent across all modules.
Returns list of warnings if inconsistencies found.
"""
warnings = []
# Check for duplicates in lists
for name, items in [
("ECM_FAMILIES", ECM_FAMILIES),
("SPECIES", SPECIES),
("TISSUES", TISSUES),
("CELL_LINES", CELL_LINES),
]:
if len(items) != len(set(items)):
warnings.append(f"Duplicate values found in {name}")
# Check for empty strings in critical lists
for name, items in [
("ECM_FAMILIES", ECM_FAMILIES),
("CELL_LINES", CELL_LINES),
]:
if "" in items:
warnings.append(f"Empty string found in {name}")
return warnings
# ============================================================================
# EXPORT FOR USE IN OTHER MODULES
# ============================================================================
# All exports available for import
__all__ = [
# ECM/Hydrogel
"ECM_FAMILIES",
"SPECIES",
"TISSUES",
"PROTEIN_ASSAY_METHODS",
"PROBE_TYPES",
"FAILURE_MODES",
"COMMERCIAL_PRODUCTS",
"RANGES",
# Cell Culture
"CELL_LINES",
"FLUORESCENT_REPORTERS",
"SEEDING_METHODS",
"BASE_MEDIA",
"SERA_SUPPLEMENTS",
"GROWTH_FACTORS",
"EXTRA_ADDITIONS",
"CELL_ASSAYS",
"CELL_RANGES",
# Morphology
"STRUCTURE_TYPES",
"LUMEN_MORPHOLOGIES",
"BRANCHING_LEVELS",
"CELL_SHAPES",
"DIFFERENTIATION_STATES",
"MONOLAYER_INTEGRITY",
"IMAGING_MODALITIES",
"EXPRESSION_LEVELS",
"LOCALIZATIONS",
"COMMON_MARKERS",
"MORPHOLOGY_SCORES",
"SIZE_RANGES",
# Protocols
"PROCESSING_STEP_TYPES",
"GELATION_STEP_TYPES",
"DECELL_METHODS",
"DIGESTION_ENZYMES",
# Units
"CONCENTRATION_UNITS",
"ALL_CONCENTRATION_UNITS",
"TEMPERATURE_UNITS",
"TIME_UNITS",
"VOLUME_UNITS",
"PH_RANGE",
# Functions
"validate_range",
"validate_in_list",
"get_family_abbreviation",
"get_species_abbreviation",
"get_tissue_abbreviation",
"get_codebook_dict",
"verify_parameter_consistency",
]
"""
GelPredict Shared Parameters
- Single source of truth for all dropdowns, ranges, and validation rules
- Ensures consistency across LAB and LITERATURE GUIs
- Used by: Hydrogels, Cell Growth, Morphology modules
"""
from typing import Dict, List, Tuple, Any
# ============================================================================
# ECM & HYDROGEL PARAMETERS
# ============================================================================
# ECM Families
ECM_FAMILIES = [
"collagen",
"decECM",
"fibrin",
"alginate",
"gelMA",
"hyaluronan",
"PEG_DA",
"composite",
"other"
]
# Species (Source organisms)
SPECIES = [
"human",
"porcine",
"bovine",
"ovine",
"equine",
"murine",
"rat",
"chicken",
"fish",
"other"
]
# Tissues/Organs
TISSUES = [
"mammary",
"dermis",
"myocardium",
"skeletal_muscle",
"tendon",
"cartilage",
"bone",
"liver",
"kidney",
"lung",
"intestine",
"bladder",
"brain",
"spinal_cord",
"adipose",
"placenta",
"umbilical_cord",
"whole_organ",
"mixed_tissue",
"other"
]
# Protein Assay Methods
PROTEIN_ASSAY_METHODS = [
"",
"BCA",
"Bradford",
"Lowry",
"DC_assay",
"A280",
"Biuret",
"other"
]
# ============================================================================
# CHEMISTRY & REAGENT OPTIONS (For consistency across all GUIs)
# ============================================================================
# Common Buffers & Solutions
COMMON_BUFFERS = [
"PBS",
"DPBS",
"HBSS",
"Tris-HCl",
"HEPES",
"MOPS",
"Bicarbonate buffer",
"Phosphate buffer",
"Acetate buffer",
"Citrate buffer",
"Glycine buffer",
"DI water",
"Distilled water",
"Ultrapure water",
"Other"
]
# Common Bases (for pH adjustment)