Coverage for src/instawell/core/data_models.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-07 15:47 -0600

1""" 

2Data models for InstaWell experiments. 

3 

4This module defines the core Pydantic models used throughout the package 

5for representing experimental conditions and replicates. 

6""" 

7 

8from typing import List 

9 

10from pydantic import BaseModel, Field 

11 

12 

13class Replicate(BaseModel): 

14 """ 

15 Represents a single replicate well in an experiment. 

16 

17 Attributes: 

18 well_row: The row identifier (e.g., 'A', 'B', 'C') 

19 well_column: The column identifier (e.g., '1', '2', '3') 

20 well_name: Combined well identifier (e.g., 'A1', 'B2') 

21 """ 

22 

23 well_row: str 

24 well_column: str 

25 well_name: str 

26 

27 

28class UniqueCondition(BaseModel): 

29 """ 

30 Represents a unique experimental condition with its replicates. 

31 

32 A condition is defined by the combination of concentration, ligand, 

33 protein, and buffer. Multiple wells (replicates) can share the same 

34 condition. 

35 

36 Attributes: 

37 full_name: Full condition string (e.g., '500uM_ATP_Protein1_Buffer1') 

38 concentration: Concentration value with units (e.g., '500uM') 

39 ligand_name: Name of the ligand being tested 

40 protein_name: Name of the target protein 

41 buffer_condition: Buffer composition identifier 

42 replicates: List of Replicate objects for this condition 

43 

44 Example: 

45 >>> condition = UniqueCondition( 

46 ... full_name="500uM_ATP_Protein1_Buffer1", 

47 ... concentration="500uM", 

48 ... ligand_name="ATP", 

49 ... protein_name="Protein1", 

50 ... buffer_condition="Buffer1", 

51 ... ) 

52 """ 

53 

54 full_name: str = "" 

55 concentration: str = "" 

56 ligand_name: str = "" 

57 protein_name: str = "" 

58 buffer_condition: str = "" 

59 replicates: List[Replicate] = Field(default_factory=list)