Species
Details of snail species.
Species
dataclass
Bases: BaseMixin
A set of generated specimens.
Attributes:
| Name | Type | Description |
|---|---|---|
reference |
str
|
reference genome |
loci |
list[int]
|
locations within genome of possible mutations |
susc_locus |
int
|
locus of susceptibility mutation |
susc_base |
str
|
base at |
Source code in src/snailz/species.py
21 22 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 | |
make(params)
classmethod
Construct a list containing a single species. (The result
is returned in a list to be consistent with other classes'
make methods.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Parameters
|
Parameters object. |
required |
Returns:
| Type | Description |
|---|---|
list[Species]
|
List containin a single |
Source code in src/snailz/species.py
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 | |
save_csv(outdir, objects)
classmethod
Save species as CSV. objects must be passed in a list to be
consistent with other classes' save_csv methods. Scalar
properties of the species are saved in one file; mutation loci
values are pivoted to long form and saved in a separate file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outdir
|
Path | str
|
Output directory. |
required |
objects
|
list
|
List containing |
required |
Source code in src/snailz/species.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
save_db(db, objects)
classmethod
Save species to database. objects must be passed in a
list to be consistent with other classes' save_csv methods.
Scalar properties of the species are saved in one table;
mutation loci values are pivoted to long form and saved in a
separate table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db
|
Database
|
Database connector. |
required |
objects
|
list
|
List containing |
required |
Source code in src/snailz/species.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
table_name()
classmethod
Database table name.
Source code in src/snailz/species.py
110 111 112 113 114 | |
random_genome(params)
Make a random genome based on a reference genome.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Parameters
|
Parameters object. |
required |
Returns:
| Type | Description |
|---|---|
str
|
String of ACGT bases. |
Source code in src/snailz/species.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | |