Mangle
Modify assay CSV files to simulate poor formatting.
mangle_assays(assays_dir, persons, forced=None)
Create 'raw' assay files by mangling data of pristine files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
assays_dir
|
Path | str
|
Directory containing assay CSV files |
required |
persons
|
AllPersons
|
People who performed experiments |
required |
forced
|
list[str] | None
|
names of changes to apply (select randomly if None) |
None
|
Raises:
Type | Description |
---|---|
ValueError
|
If people data cannot be loaded |
Source code in src/snailz/mangle.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
_mangle_assay(filename, data, staff, forced)
Mangle a single assay file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
list[list[str]]
|
values from CSV file |
required |
staff
|
dict[str, Person]
|
people keyed by ID |
required |
forced
|
list[str] | None
|
optional list of specified manglings (for testing) |
required |
Returns:
Type | Description |
---|---|
list[list]
|
Modified copy of data. |
Source code in src/snailz/mangle.py
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 |
|
_mangle_id(data, staff)
Convert ID field to string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
list[list[str]]
|
values from CSV file |
required |
staff
|
dict[str, Person]
|
people keyed by ID |
required |
Returns:
Type | Description |
---|---|
list[list[str]]
|
Modified copy of data. |
Source code in src/snailz/mangle.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
_mangle_indent(data, staff)
Indent data portion.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
list[list[str]]
|
values from CSV file |
required |
staff
|
dict[str, Person]
|
people keyed by ID |
required |
Returns:
Type | Description |
---|---|
list[list[str]]
|
Modified copy of data. |
Source code in src/snailz/mangle.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
_mangle_missing(data, staff)
Remove machine name (alters length of header).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
list[list[str]]
|
values from CSV file |
required |
staff
|
dict[str, Person]
|
people keyed by ID |
required |
Returns:
Type | Description |
---|---|
list[list[str]]
|
Modified copy of data. |
Source code in src/snailz/mangle.py
104 105 106 107 108 109 110 111 112 113 114 |
|
_mangle_person(data, staff)
Replace person identifier with name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
list[list[str]]
|
values from CSV file |
required |
staff
|
dict[str, Person]
|
people keyed by ID |
required |
Returns:
Type | Description |
---|---|
list[list[str]]
|
Modified copy of data. |
Source code in src/snailz/mangle.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|