teemi 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. teemi/__init__.py +9 -0
  2. teemi/_version.py +21 -0
  3. teemi/build/PCR.py +644 -0
  4. teemi/build/__init__.py +4 -0
  5. teemi/build/containers_wells_picklists.py +13 -0
  6. teemi/build/robot_assembly.py +13 -0
  7. teemi/build/transformation.py +498 -0
  8. teemi/design/__init__.py +4 -0
  9. teemi/design/cloning.py +618 -0
  10. teemi/design/combinatorial/__init__.py +126 -0
  11. teemi/design/combinatorial/design.py +1861 -0
  12. teemi/design/combinatorial/export.py +605 -0
  13. teemi/design/combinatorial/flow.py +528 -0
  14. teemi/design/combinatorial/report.py +1499 -0
  15. teemi/design/combinatorial/simulate.py +262 -0
  16. teemi/design/combinatorial/sources.py +256 -0
  17. teemi/design/combinatorial/spec.py +599 -0
  18. teemi/design/combinatorial/tm.py +585 -0
  19. teemi/design/combinatorial_design.py +575 -0
  20. teemi/design/crispr_best.py +199 -0
  21. teemi/design/crispr_cas.py +824 -0
  22. teemi/design/crispri.py +258 -0
  23. teemi/design/fetch_sequences.py +250 -0
  24. teemi/design/gibson_cloning.py +427 -0
  25. teemi/design/retrieve_gene_homologs.py +283 -0
  26. teemi/design/sequence_finder.py +95 -0
  27. teemi/design/teselagen_helpers.py +203 -0
  28. teemi/learn/__init__.py +4 -0
  29. teemi/learn/auto_ml.py +145 -0
  30. teemi/learn/plotting.py +829 -0
  31. teemi/legacy/__init__.py +1 -0
  32. teemi/legacy/build/__init__.py +1 -0
  33. teemi/legacy/build/containers_wells_picklists.py +855 -0
  34. teemi/legacy/build/robot_assembly.py +332 -0
  35. teemi/legacy/lims/__init__.py +1 -0
  36. teemi/legacy/lims/benchling_api.py +243 -0
  37. teemi/legacy/lims/csv_database.py +469 -0
  38. teemi/lims/__init__.py +4 -0
  39. teemi/lims/benchling_api.py +12 -0
  40. teemi/lims/csv_database.py +12 -0
  41. teemi/test/__init__.py +4 -0
  42. teemi/test/data_wrangling.py +163 -0
  43. teemi/test/genotyping.py +129 -0
  44. teemi/utils.py +293 -0
  45. teemi-1.1.0.dist-info/METADATA +892 -0
  46. teemi-1.1.0.dist-info/RECORD +50 -0
  47. teemi-1.1.0.dist-info/WHEEL +5 -0
  48. teemi-1.1.0.dist-info/licenses/AUTHORS.rst +22 -0
  49. teemi-1.1.0.dist-info/licenses/LICENSE +21 -0
  50. teemi-1.1.0.dist-info/top_level.txt +1 -0
teemi/__init__.py ADDED
@@ -0,0 +1,9 @@
1
+ """Top-level package for teemi."""
2
+
3
+ __author__ = """Lucas Levassor"""
4
+ __email__ = "luclev@biosustain.dtu.dk"
5
+ __version__ = "0.1.0"
6
+
7
+ from . import _version
8
+
9
+ __version__ = _version.get_versions()["version"]
teemi/_version.py ADDED
@@ -0,0 +1,21 @@
1
+
2
+ # This file was generated by 'versioneer.py' (0.22) from
3
+ # revision-control system data, or from the parent directory name of an
4
+ # unpacked source archive. Distribution tarballs contain a pre-generated copy
5
+ # of this file.
6
+
7
+ import json
8
+
9
+ version_json = '''
10
+ {
11
+ "date": "2026-10-30T15:58:22+0100",
12
+ "dirty": false,
13
+ "error": null,
14
+ "full-revisionid": "eca62532d8e639002da901f34905dcb4d3d3b91f",
15
+ "version": "1.1.0"
16
+ }
17
+ ''' # END VERSION_JSON
18
+
19
+
20
+ def get_versions():
21
+ return json.loads(version_json)
teemi/build/PCR.py ADDED
@@ -0,0 +1,644 @@
1
+ #!/usr/bin/env python
2
+ # MIT License
3
+ # Copyright (c) 2024, Technical University of Denmark (DTU)
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+
15
+ """ This part of the lab module is used for simulating and calculating PCR reactions."""
16
+
17
+ # standard libraries
18
+ import textwrap as _textwrap
19
+ import math
20
+ import csv
21
+ import json
22
+
23
+ # Extra
24
+ import pandas as pd
25
+ from pydna._pretty import pretty_str as _pretty_str
26
+ import requests
27
+ try:
28
+ from Bio.SeqUtils import MeltingTemp as _MeltingTemp
29
+ except ImportError: # pragma: no cover - Bio is present in normal runtime/test envs
30
+ _MeltingTemp = None
31
+
32
+
33
+ def _fallback_primer_tm(primer):
34
+ """Estimate primer Tm locally when the NEB API is unavailable."""
35
+ primer = str(primer)
36
+
37
+ if _MeltingTemp is not None:
38
+ return round(_MeltingTemp.Tm_NN(primer), 1)
39
+
40
+ at = sum(1 for base in primer.upper() if base in "AT")
41
+ gc = sum(1 for base in primer.upper() if base in "GC")
42
+ return float(2 * at + 4 * gc)
43
+
44
+
45
+ def _post_neb_tm_api(payload):
46
+ """Return decoded NEB API JSON or ``None`` when the API is unavailable."""
47
+ url = "https://tmapi.neb.com/tm/batch"
48
+ headers = {"content-type": "application/json"}
49
+
50
+ try:
51
+ res = requests.post(url, data=json.dumps(payload), headers=headers, timeout=15)
52
+ res.raise_for_status()
53
+ return res.json()
54
+ except (requests.RequestException, ValueError, json.JSONDecodeError):
55
+ return None
56
+
57
+
58
+ def primer_tm_neb(primer, conc=0.5, prodcode="q5-0"):
59
+ """Calculates a single primers melting temp from NEB.
60
+
61
+ Parameters
62
+ ----------
63
+ primer1 : str
64
+ conc : float
65
+ prodcode : str
66
+ find product codes on nebswebsite: https://tmapi.neb.com/docs/productcodes
67
+
68
+ Returns
69
+ -------
70
+ tm : int
71
+ primer melting temperature
72
+
73
+ """
74
+ seqpairs = [[primer]]
75
+ payload = {"seqpairs": seqpairs, "conc": conc, "prodcode": prodcode}
76
+ response = _post_neb_tm_api(payload)
77
+
78
+ if response and response.get("success"):
79
+ for row in response["data"]:
80
+ return row["tm1"]
81
+
82
+ return _fallback_primer_tm(primer)
83
+
84
+
85
+ def primer_ta_neb(primer1, primer2, conc=0.5, prodcode="q5-0"):
86
+ """Calculates primer pair melting temp TA, from NEB.
87
+
88
+ Parameters
89
+ ----------
90
+ primer1 : str
91
+ first primer to be used for finding the optimal ta
92
+ primer2 : str
93
+ second primer to be used for finding the optimal ta
94
+ conc : float
95
+ prodcode : str
96
+ find product codes on nebswebsite: https://tmapi.neb.com/docs/productcodes
97
+
98
+ Returns
99
+ -------
100
+ ta : int
101
+ primer pair annealing temp
102
+
103
+ """
104
+ seqpairs = [[primer1, primer2]]
105
+ payload = {"seqpairs": seqpairs, "conc": conc, "prodcode": prodcode}
106
+ response = _post_neb_tm_api(payload)
107
+
108
+ if response and response.get("success"):
109
+ for row in response["data"]:
110
+ return row["ta"]
111
+
112
+ return round(min(_fallback_primer_tm(primer1), _fallback_primer_tm(primer2)))
113
+
114
+
115
+ def grouper(iterable, max_diff):
116
+ """Groups objects into distinct groups based on differences"""
117
+ prev = None
118
+ group = []
119
+ for item in iterable:
120
+ if not prev or item - prev <= max_diff:
121
+ group.append(item)
122
+ else:
123
+ yield group
124
+ group = [item]
125
+ prev = item
126
+ if group:
127
+ yield group
128
+
129
+
130
+ def calculate_volumes(vol_p_reac=0, no_of_reactions=1, standard_reagents=[], standard_volumes=[]):
131
+ """
132
+ Makes a reaction scheme for PCR master mixes.
133
+
134
+ Parameters
135
+ ----------
136
+ vol_p_reac : int, optional
137
+ Volume per reaction. Default is 0.
138
+ no_of_reactions : int, optional
139
+ Number of reactions. Default is 1.
140
+ standard_reagents : list
141
+ List of standard reagents.
142
+ standard_volumes : list
143
+ List of volumes for standard reagents.
144
+
145
+ Returns
146
+ -------
147
+ volumes_df : pd.DataFrame
148
+ DataFrame containing volume information.
149
+
150
+ Examples
151
+ --------
152
+ .. code-block:: python
153
+
154
+ calculate_volumes(
155
+ vol_p_reac = 10,
156
+ no_of_reactions = 6,
157
+ standard_reagents = ["DNA","Buffer, Cutsmart","H20","Enz, USER"],
158
+ standard_volumes = [1,1,7,1]
159
+ )
160
+
161
+
162
+ .. code-block:: none
163
+
164
+ The following reaction scheme will be made:
165
+
166
+ vol_p_reac vol_p_x_reac
167
+ DNA 1.0 6.0
168
+ Buffer, Cutsmart 1.0 6.0
169
+ H20 7.0 42.0
170
+ Enz, USER 1.0 6.0
171
+ Total 10.0 60.0
172
+
173
+ """
174
+
175
+ standard_total_volume = sum(standard_volumes)
176
+ volumes_p_x = [val / standard_total_volume * vol_p_reac for val in standard_volumes]
177
+ volumes_p_x_p_y_reactions = [val * no_of_reactions for val in volumes_p_x]
178
+
179
+ volumes_p_x_plus_total = volumes_p_x + [sum(volumes_p_x)]
180
+ volumes_p_x_p_y_reactions_plus_total = volumes_p_x_p_y_reactions + [
181
+ sum(volumes_p_x_p_y_reactions)
182
+ ]
183
+ reagents_plus_total = standard_reagents + ["Total"]
184
+
185
+ volumes_df = pd.DataFrame(
186
+ data={
187
+ "vol_p_reac": volumes_p_x_plus_total,
188
+ "vol_p_"
189
+ + str(no_of_reactions)
190
+ + "_reac": volumes_p_x_p_y_reactions_plus_total,
191
+ },
192
+ index=reagents_plus_total,
193
+ )
194
+ return volumes_df
195
+
196
+
197
+ def calculate_processing_speed(amplicon):
198
+ """Determines process speed based on the
199
+ which polymerase is used.
200
+
201
+ Parameters
202
+ ----------
203
+ amplicon : pydna.amplicon
204
+
205
+ Returns
206
+ -------
207
+ amplicon : pydna.amplicon
208
+ Adds annotations to the amplicon object dependent
209
+ on which polymerase was used
210
+
211
+ Notes
212
+ -----
213
+ The amplicon needs to have the following dict incorporated:
214
+ amplicon.annotations["polymerase"]
215
+ """
216
+
217
+ if "proc_speed" in amplicon.forward_primer.annotations:
218
+ print("proc_speed already set")
219
+ return amplicon
220
+
221
+ # proc_speed units are seconds/kb
222
+ if amplicon.annotations["polymerase"] == "OneTaq Hot Start":
223
+ proc_speed = 60
224
+ elif amplicon.annotations["polymerase"] == "Q5 Hot Start":
225
+ proc_speed = 30
226
+ elif amplicon.annotations["polymerase"] == "Phusion":
227
+ proc_speed = 30
228
+ else:
229
+ raise ValueError(
230
+ f"Unknown polymerase {amplicon.annotations['polymerase']!r}; "
231
+ "expected 'OneTaq Hot Start', 'Q5 Hot Start' or 'Phusion'"
232
+ )
233
+
234
+ amplicon.annotations["proc_speed"] = proc_speed
235
+
236
+ return amplicon
237
+
238
+
239
+ def calculate_elongation_time(amplicon):
240
+ """Determines elongation time for an amplicon
241
+ and add the elongation time to the amplicon annotations.
242
+
243
+ Parameters
244
+ ----------
245
+ amplicon : pydna.amplicon
246
+
247
+ Returns
248
+ -------
249
+ Adds the elongation time to the amplicon annotations
250
+
251
+ Notes
252
+ -----
253
+ The amplicon needs to have a dict called proc_speed shown as follows:
254
+ amplicon.annotations["proc_speed"]
255
+ This dict within the annotations can be made with the function proc_speed.
256
+
257
+ """
258
+
259
+ if "elongation_time" in amplicon.forward_primer.annotations:
260
+ print("elongation_time already set")
261
+ return amplicon
262
+
263
+ # elongation_time units are seconds
264
+ elongation_time = amplicon.annotations["proc_speed"] * len(amplicon) / 1000
265
+ amplicon.annotations["elongation_time"] = math.ceil(elongation_time)
266
+
267
+ return amplicon
268
+
269
+
270
+ def calculate_required_thermal_cyclers(
271
+ amplicons: list, polymerase: str, elong_time_max_diff=15
272
+ ):
273
+ """Determines the number of thermalcyclers that is needed
274
+ based on elongation time differences
275
+
276
+ Parameters
277
+ ----------
278
+ amplicons : list
279
+ of pydna.amplicon objects
280
+ polymerase : str
281
+
282
+ Returns
283
+ -------
284
+ pd.DataFrame
285
+ dataframe of grouped amplicons
286
+
287
+ """
288
+
289
+ amp_names = [amplicon.name for amplicon in amplicons]
290
+ elong_times = [amplicon.annotations["elongation_time"] for amplicon in amplicons]
291
+ tas = [amplicon.annotations["ta " + polymerase] for amplicon in amplicons]
292
+ order = list(range(0, len(amplicons)))
293
+
294
+ list_of_tuples = list(zip(amp_names, tas, elong_times, order))
295
+
296
+ list_of_tuples.sort()
297
+
298
+ groups = dict(enumerate(grouper(elong_times, elong_time_max_diff), 1))
299
+
300
+ list_of_lists = [list(elem) for elem in list_of_tuples]
301
+
302
+ for gNo, gTimes in groups.items():
303
+ # print(gNo, gTimes)
304
+ for idx, lst in enumerate(list_of_lists):
305
+ if lst[2] in gTimes:
306
+ list_of_lists[idx][2] = max(gTimes)
307
+
308
+ thermal_cyclers = pd.DataFrame(
309
+ list_of_lists, columns=["amplicons", "tas", "elong_times", "order"]
310
+ )
311
+ thermal_cyclers = thermal_cyclers.sort_values(["order"])
312
+ thermal_cyclers = (
313
+ thermal_cyclers.groupby(["tas", "elong_times"])["amplicons"]
314
+ .apply(", ".join)
315
+ .reset_index()
316
+ )
317
+
318
+ return thermal_cyclers
319
+
320
+
321
+ def pcr_locations(amplicons: list):
322
+ """Obtain annotation information for amplicons.
323
+
324
+ Parameters
325
+ ----------
326
+ amplicons : list
327
+ List of amplicon objects from `pydna.amplicon()`
328
+
329
+ Returns
330
+ -------
331
+ pd.DataFrame
332
+ Pandas DataFrame with amplicon locations
333
+ """
334
+ # initialization
335
+ product_loc = []
336
+ product_names = []
337
+ template_loc = []
338
+ fw_loc = []
339
+ rv_loc = []
340
+
341
+ for i in range(0, len(amplicons)):
342
+ product_names.append(amplicons[i].name)
343
+
344
+ # Test if batches is present
345
+ if (
346
+ "batches" in amplicons[i].template.annotations.keys()
347
+ and len(amplicons[i].template.annotations["batches"]) != 0
348
+ ):
349
+ product_loc.append(
350
+ amplicons[i].template.annotations["batches"][0]["location"]
351
+ )
352
+ template_loc.append(
353
+ amplicons[i].template.annotations["batches"][0]["location"]
354
+ )
355
+ elif (
356
+ "batches" in amplicons[i].annotations.keys()
357
+ and len(amplicons[i].annotations["batches"]) != 0
358
+ ):
359
+ product_loc.append(amplicons[i].annotations["batches"][0]["location"])
360
+ template_loc.append(amplicons[i].annotations["batches"][0]["location"])
361
+ else:
362
+ product_loc.append("Empty")
363
+ template_loc.append("Empty")
364
+ print(
365
+ "No batches were found for "
366
+ + str(amplicons[i].name)
367
+ + ". Please check the object."
368
+ )
369
+
370
+ # Save primer locations
371
+ if (
372
+ "batches" in amplicons[i].forward_primer.annotations.keys()
373
+ and len(amplicons[i].forward_primer.annotations["batches"]) != 0
374
+ ):
375
+ fw_loc.append(
376
+ amplicons[i].forward_primer.annotations["batches"][0]["location"]
377
+ )
378
+ else:
379
+ fw_loc.append("Empty")
380
+ print(str(amplicons[i].name) + ": Foward primer location was not found")
381
+ if (
382
+ "batches" in amplicons[i].reverse_primer.annotations.keys()
383
+ and len(amplicons[i].reverse_primer.annotations["batches"]) != 0
384
+ ):
385
+ rv_loc.append(
386
+ amplicons[i].reverse_primer.annotations["batches"][0]["location"]
387
+ )
388
+ else:
389
+ rv_loc.append("Empty")
390
+ print(str(amplicons[i].name) + ": Reverse primer location was not found")
391
+
392
+ # Save information as dataframe
393
+ df_pcr = pd.DataFrame(
394
+ list(zip(product_loc, product_names, template_loc, fw_loc, rv_loc)),
395
+ columns=["location", "name", "template", "fw", "rv"],
396
+ )
397
+
398
+ return df_pcr
399
+
400
+
401
+ def nanophotometer_concentrations(path=""):
402
+ """Reads a CSV file with nanophotometer concentraions
403
+ and returns the concentrations in a list.
404
+
405
+ Parameters
406
+ ----------
407
+ path : str
408
+ path to file
409
+
410
+ Returns
411
+ -------
412
+ concentrations : list
413
+ list of concentrations from the file as floats
414
+ """
415
+ concentrations = []
416
+ with open(path, encoding="Latin1") as tsvfile:
417
+ reader = csv.reader(tsvfile, delimiter="\t")
418
+ next(reader)[4]
419
+ for row in reader:
420
+ conc = float(row[4].replace(",", "."))
421
+ concentrations.append(conc)
422
+
423
+ return concentrations
424
+
425
+
426
+ def amplicon_by_name(name: str, amplicons_lst: list):
427
+ """Returns amplicon with specified name.
428
+
429
+ Parameters
430
+ ----------
431
+ name : str
432
+ amplicons_lst : list
433
+
434
+ Returns
435
+ -------
436
+ amplicon : pydna.amplicon
437
+
438
+ """
439
+ for amplicon in amplicons_lst:
440
+ if amplicon.name == name:
441
+ return amplicon
442
+
443
+
444
+ def Q5_NEB_PCR_program(amplicon):
445
+ """Simple PCR program designed to give a quick visual representation
446
+ of a PCR reaction.
447
+
448
+ Parameters
449
+ ----------
450
+ amplicon : pydna.amplicon
451
+ pydna amplicon object
452
+
453
+ Returns
454
+ -------
455
+ str
456
+ schematic representation of a Q5 program
457
+ """
458
+ # Determine process speed and elongation time (which needs the speed).
459
+ amplicon = calculate_processing_speed(amplicon)
460
+ amplicon = calculate_elongation_time(amplicon)
461
+
462
+ # ta
463
+ amplicon.annotations["ta Q5 Hot Start"] = primer_ta_neb(
464
+ str(amplicon.forward_primer.seq), str(amplicon.reverse_primer.seq)
465
+ )
466
+
467
+ # tm forward and reverse
468
+ amplicon.forward_primer.annotations["tm Q5 Hot Start"] = primer_tm_neb(
469
+ str(amplicon.forward_primer.seq)
470
+ )
471
+ amplicon.reverse_primer.annotations["tm Q5 Hot Start"] = primer_tm_neb(
472
+ str(amplicon.reverse_primer.seq)
473
+ )
474
+
475
+ r"""Returns a string containing a text representation of a suggested
476
+ PCR program using Taq or similar polymerase.
477
+ ::
478
+ |98°C|98°C | |tmf:59.5
479
+ |____|_____ 72°C|72°C|tmr:59.7
480
+ |30s |10s \ 59.1°C _____|____|30s/kb
481
+ | | \______/ 0:32|5min|GC 51%
482
+ | | 30s | |1051bp
483
+ """
484
+
485
+ formated = _textwrap.dedent(
486
+ r"""
487
+ |98°C|98°C | |tmf:{tmf:.1f}
488
+ |____|_____ 72°C|72°C|tmr:{tmr:.1f}
489
+ |30 s|10s \ {ta:.1f}°C _____|____|{rate}s/kb
490
+ | | \______/{0:2}:{1:2}|2min|GC {GC_prod}%
491
+ | | 20s | |{size}bp
492
+ """[
493
+ 1:-1
494
+ ].format(
495
+ rate=amplicon.annotations["proc_speed"],
496
+ size=len(amplicon.seq),
497
+ ta=amplicon.annotations["ta Q5 Hot Start"],
498
+ tmf=amplicon.forward_primer.annotations["tm Q5 Hot Start"],
499
+ tmr=amplicon.reverse_primer.annotations["tm Q5 Hot Start"],
500
+ GC_prod=round(amplicon.gc() * 100, 2),
501
+ *map(int, divmod(amplicon.annotations["elongation_time"], 60)),
502
+ )
503
+ )
504
+
505
+ return _pretty_str(formated)
506
+
507
+
508
+ def set_plate_locations(amplicons: list):
509
+ """Makes a dataframe from amplicons.
510
+
511
+ Parameters
512
+ ----------
513
+
514
+ amplicons : list
515
+ list of pydna.amplicon objects
516
+
517
+ Returns
518
+ -------
519
+ pd.DataFrame
520
+ with overview of plate locations"""
521
+
522
+ plate_locations = []
523
+ for amplicon in amplicons:
524
+ plate_locations.append(
525
+ [
526
+ amplicon.name,
527
+ amplicon.annotations["batches"][0]["location"],
528
+ amplicon.annotations["template_name"],
529
+ amplicon.template.annotations["batches"][0]["location"],
530
+ amplicon.forward_primer.id,
531
+ amplicon.forward_primer.annotations["batches"][0]["location"],
532
+ amplicon.reverse_primer.id,
533
+ amplicon.reverse_primer.annotations["batches"][0]["location"],
534
+ ]
535
+ )
536
+ amplicon_df = pd.DataFrame(
537
+ plate_locations,
538
+ columns=[
539
+ "name",
540
+ "location",
541
+ "template_name",
542
+ "template_location",
543
+ "fw_name",
544
+ "fw_location",
545
+ "rv_name",
546
+ "rv_location",
547
+ ],
548
+ )
549
+ amplicon_df = amplicon_df.set_index("name")
550
+
551
+ return amplicon_df
552
+
553
+
554
+ def update_amplicon_annotations(
555
+ amplicon_names: list,
556
+ amplicons: list,
557
+ locations: list,
558
+ concentrations: list,
559
+ volumes: list,
560
+ ) -> None:
561
+ """Updates the annotations of amplicons in the amplicon list.
562
+
563
+ Parameters
564
+ ----------
565
+ amplicon_names : list
566
+ List of amplicon names.
567
+ locations : list
568
+ List of locations for each amplicon.
569
+ concentrations : list
570
+ List of concentrations for each amplicon.
571
+ volumes : list
572
+ List of volumes for each amplicon.
573
+
574
+ Returns
575
+ -------
576
+ None
577
+ """
578
+ for i in range(len(amplicon_names)):
579
+ amplicon_by_name(amplicon_names[i], amplicons).annotations["batches"][0][
580
+ "location"
581
+ ] = locations[i]
582
+ amplicon_by_name(amplicon_names[i], amplicons).annotations["batches"][0][
583
+ "concentration"
584
+ ] = concentrations[i]
585
+ amplicon_by_name(amplicon_names[i], amplicons).annotations["batches"][0][
586
+ "volume"
587
+ ] = volumes[i]
588
+
589
+
590
+ def get_amplicons_by_row(row, amplicon_df, amplicons):
591
+ """Returns a list of amplicons in a given gel row.
592
+
593
+ Parameters
594
+ ----------
595
+ row : str
596
+ Name of the gel row.
597
+ amplicon_df : pandas DataFrame
598
+ DataFrame with amplicon information, including the column 'prow' indicating the gel row.
599
+ amplicons : list of Amplicon
600
+ List of Amplicon objects.
601
+
602
+ Returns
603
+ -------
604
+ list of Amplicon
605
+ List of Amplicon objects in the given gel row.
606
+ """
607
+ row_names = amplicon_df[amplicon_df['prow']==row][['name']]['name'].tolist()
608
+
609
+ row_amplicons = []
610
+ for name in row_names:
611
+ for amplicon in amplicons:
612
+ if amplicon.name == name:
613
+ row_amplicons.append([amplicon])
614
+
615
+ return(row_amplicons)
616
+
617
+
618
+ def get_amplicons_by_column(col, amplicon_df, amplicons):
619
+ """
620
+ Returns a list of amplicons in a given gel column.
621
+
622
+ Parameters
623
+ ----------
624
+ col : str
625
+ Name of the gel column.
626
+ amplicon_df : pandas DataFrame
627
+ DataFrame with amplicon information, including the column 'pcol' indicating the gel column.
628
+ amplicons : list of Amplicon
629
+ List of Amplicon objects.
630
+
631
+ Returns
632
+ -------
633
+ list of Amplicon
634
+ List of Amplicon objects in the given gel column.
635
+ """
636
+ col_names = amplicon_df[amplicon_df['pcol']==col][['name']]['name'].tolist()
637
+
638
+ col_amplicons = []
639
+ for name in col_names:
640
+ for amplicon in amplicons:
641
+ if amplicon.name == name:
642
+ col_amplicons.append([amplicon])
643
+
644
+ return(col_amplicons)
@@ -0,0 +1,4 @@
1
+ """Top-level package for teemi."""
2
+
3
+ __author__ = """Lucas Levassor"""
4
+ __email__ = "luclev@biosustain.dtu.dk"
@@ -0,0 +1,13 @@
1
+ """Deprecated compatibility wrapper for legacy picklist helpers."""
2
+
3
+ from warnings import warn
4
+
5
+ warn(
6
+ "teemi.build.containers_wells_picklists is legacy and will move out of the "
7
+ "main build API in a future release. Import from "
8
+ "teemi.legacy.build.containers_wells_picklists instead.",
9
+ DeprecationWarning,
10
+ stacklevel=2,
11
+ )
12
+
13
+ from teemi.legacy.build.containers_wells_picklists import * # noqa: F401,F403
@@ -0,0 +1,13 @@
1
+ """Deprecated compatibility wrapper for legacy robot assembly helpers."""
2
+
3
+ from warnings import warn
4
+
5
+ warn(
6
+ "teemi.build.robot_assembly is legacy and will move out of the main build "
7
+ "API in a future release. Import from teemi.legacy.build.robot_assembly "
8
+ "instead.",
9
+ DeprecationWarning,
10
+ stacklevel=2,
11
+ )
12
+
13
+ from teemi.legacy.build.robot_assembly import * # noqa: F401,F403