fasta_lake.annotation#
fasta_lake.annotation
#
Optional exact-sequence annotation and explicitly defined unknown proteins.
eggNOG assigns annotations through orthology. An absent KO/EC assignment is an annotation gap, not proof of a novel protein. ESM-C embeddings are separate representations and never overwrite functional assignments.
Upstream: https://github.com/eggnogdb/eggnog-mapper. Cantalapiedra et al. (2021), https://doi.org/10.1093/molbev/msab293. FastaLake invokes the mapper and checks exact input/output identity; it does not implement orthology assignment.
prepare_annotation_targets
#
Deduplicate a selected FASTA by exact sequence; retain every input alias.
Return query ID -> sequence, plus the original FASTA hash. Query IDs contain the full sequence SHA-256, so annotation cannot depend on accession spelling. Protein I/L variants remain distinct. This function expects a new directory; the count guard prevents accidentally annotating a worldwide catalogue.
Source code in fasta_lake/annotation.py
read_eggnog_annotations
#
Read v2 eggNOG output and retain no-hit and hit-without-function queries.
Unknown means no value in any declared field (KO or EC by default). Seed hits, GO terms, descriptions and all raw eggNOG fields remain available. Unknown query IDs, duplicate rows and malformed tables fail explicitly. Return normalized rows in query order and the exact unknown query roster.
Source code in fasta_lake/annotation.py
annotate_fasta
#
annotate_fasta(fasta, output, *, emapper, data_dir, threads=2, emapper_python=None, sensitivity='sensitive', tax_scope='auto', max_proteins=100000, unknown_fields=('KEGG_ko', 'EC'))
Run eggNOG-mapper 2.1.12 on exact unique selected sequences.
The annotation database stays on disk (no --dbmem). DIAMOND uses block size 0.5; threads are explicit. Automatic taxonomic scope retains mixed-domain inputs instead of silently restricting the whole microbiome to bacteria. Database files, tool, queries and results are hashed. A failed command keeps its logs and never writes COMPLETE.json. External databases are not downloaded.
Source code in fasta_lake/annotation.py
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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
read_annotation_settings
#
Validate optional annotation settings; resolve local paths beside the JSON file.
The configuration is deliberately separate from search settings. It contains local resources and annotation choices, never URLs to download during a run.
Source code in fasta_lake/annotation.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
annotate_study
#
Annotate the exact representatives exported by a completed study grouping.
Representative annotations are not automatically propagated to all possible group members. Embedding is optional and uses the same recorded unknown rule.