biolabcalc 0.2.0__tar.gz

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 (59) hide show
  1. biolabcalc-0.2.0/LICENSE +21 -0
  2. biolabcalc-0.2.0/MANIFEST.in +5 -0
  3. biolabcalc-0.2.0/PKG-INFO +610 -0
  4. biolabcalc-0.2.0/README.md +561 -0
  5. biolabcalc-0.2.0/pyproject.toml +55 -0
  6. biolabcalc-0.2.0/setup.cfg +4 -0
  7. biolabcalc-0.2.0/setup.py +3 -0
  8. biolabcalc-0.2.0/src/biolabcalc/__init__.py +285 -0
  9. biolabcalc-0.2.0/src/biolabcalc/buffers.py +912 -0
  10. biolabcalc-0.2.0/src/biolabcalc/cli.py +1161 -0
  11. biolabcalc-0.2.0/src/biolabcalc/cloning.py +461 -0
  12. biolabcalc-0.2.0/src/biolabcalc/easy.py +334 -0
  13. biolabcalc-0.2.0/src/biolabcalc/ecoli_growth.py +228 -0
  14. biolabcalc-0.2.0/src/biolabcalc/excel_extension.py +1048 -0
  15. biolabcalc-0.2.0/src/biolabcalc/fluorescence.py +175 -0
  16. biolabcalc-0.2.0/src/biolabcalc/gel_annotator.py +361 -0
  17. biolabcalc-0.2.0/src/biolabcalc/gels.py +144 -0
  18. biolabcalc-0.2.0/src/biolabcalc/interactive_gel.py +832 -0
  19. biolabcalc-0.2.0/src/biolabcalc/lab_report.py +526 -0
  20. biolabcalc-0.2.0/src/biolabcalc/molecular_weight.py +378 -0
  21. biolabcalc-0.2.0/src/biolabcalc/pcr.py +310 -0
  22. biolabcalc-0.2.0/src/biolabcalc/precipitation.py +214 -0
  23. biolabcalc-0.2.0/src/biolabcalc/primers.py +343 -0
  24. biolabcalc-0.2.0/src/biolabcalc/protein.py +266 -0
  25. biolabcalc-0.2.0/src/biolabcalc/protocols.py +1311 -0
  26. biolabcalc-0.2.0/src/biolabcalc/seq_utils.py +111 -0
  27. biolabcalc-0.2.0/src/biolabcalc/spectroscopy.py +378 -0
  28. biolabcalc-0.2.0/src/biolabcalc/transcription.py +602 -0
  29. biolabcalc-0.2.0/src/biolabcalc/units.py +178 -0
  30. biolabcalc-0.2.0/src/biolabcalc/western_blot.py +597 -0
  31. biolabcalc-0.2.0/src/biolabcalc.egg-info/PKG-INFO +610 -0
  32. biolabcalc-0.2.0/src/biolabcalc.egg-info/SOURCES.txt +57 -0
  33. biolabcalc-0.2.0/src/biolabcalc.egg-info/dependency_links.txt +1 -0
  34. biolabcalc-0.2.0/src/biolabcalc.egg-info/entry_points.txt +2 -0
  35. biolabcalc-0.2.0/src/biolabcalc.egg-info/requires.txt +7 -0
  36. biolabcalc-0.2.0/src/biolabcalc.egg-info/top_level.txt +1 -0
  37. biolabcalc-0.2.0/tests/__init__.py +0 -0
  38. biolabcalc-0.2.0/tests/test_advanced_features.py +195 -0
  39. biolabcalc-0.2.0/tests/test_buffers.py +151 -0
  40. biolabcalc-0.2.0/tests/test_cloning.py +39 -0
  41. biolabcalc-0.2.0/tests/test_custom_rna_sequence.py +126 -0
  42. biolabcalc-0.2.0/tests/test_ecoli_growth.py +28 -0
  43. biolabcalc-0.2.0/tests/test_enhancements.py +114 -0
  44. biolabcalc-0.2.0/tests/test_excel_extension.py +49 -0
  45. biolabcalc-0.2.0/tests/test_fluorescence.py +32 -0
  46. biolabcalc-0.2.0/tests/test_gel_annotator.py +72 -0
  47. biolabcalc-0.2.0/tests/test_gels.py +17 -0
  48. biolabcalc-0.2.0/tests/test_interactive_gel.py +51 -0
  49. biolabcalc-0.2.0/tests/test_lab_report.py +108 -0
  50. biolabcalc-0.2.0/tests/test_molecular_weight.py +41 -0
  51. biolabcalc-0.2.0/tests/test_pcr.py +30 -0
  52. biolabcalc-0.2.0/tests/test_precipitation.py +20 -0
  53. biolabcalc-0.2.0/tests/test_primers.py +25 -0
  54. biolabcalc-0.2.0/tests/test_protein.py +26 -0
  55. biolabcalc-0.2.0/tests/test_protocols.py +65 -0
  56. biolabcalc-0.2.0/tests/test_seq_utils.py +29 -0
  57. biolabcalc-0.2.0/tests/test_spectroscopy.py +40 -0
  58. biolabcalc-0.2.0/tests/test_transcription.py +75 -0
  59. biolabcalc-0.2.0/tests/test_western_blot.py +93 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BioLabCalc Contributors
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
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include src/biolabcalc *.py *.html
5
+ recursive-include tests *.py
@@ -0,0 +1,610 @@
1
+ Metadata-Version: 2.4
2
+ Name: biolabcalc
3
+ Version: 0.2.0
4
+ Summary: A multifaceted Python library and Excel extension for daily molecular biology research, PCR stoichiometry, IVT yields, protein quantification, and primer design.
5
+ Author: BioLabCalc Contributors
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 BioLabCalc Contributors
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Keywords: bioinformatics,molecular-biology,pcr,transcription,in-vitro-transcription,primer-design,protein-quantification,excel,openpyxl,stoichiometry
29
+ Classifier: Development Status :: 4 - Beta
30
+ Classifier: Intended Audience :: Science/Research
31
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.8
35
+ Classifier: Programming Language :: Python :: 3.9
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Requires-Python: >=3.8
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Requires-Dist: openpyxl>=3.0.0
43
+ Requires-Dist: matplotlib>=3.5.0
44
+ Requires-Dist: Pillow>=9.0.0
45
+ Provides-Extra: dev
46
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
47
+ Requires-Dist: flake8>=5.0.0; extra == "dev"
48
+ Dynamic: license-file
49
+
50
+ # BioLabCalc 🧬🔬
51
+
52
+ [![CI](https://github.com/your-username/biolabcalc/actions/workflows/ci.yml/badge.svg)](https://github.com/your-username/biolabcalc/actions)
53
+ [![Python Version](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://pypi.org/project/biolabcalc/)
54
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
55
+ [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
56
+
57
+ > A multifaceted Python library and built-in Excel extension for daily wet-lab molecular biology calculations, reaction optimization, in vitro transcription stoichiometry, PCR kinetics, protein quantification, thermodynamic primer design, fluorophore modifications, gel migration ladders, standardized solution recipes, and *E. coli* growth modeling.
58
+
59
+ ---
60
+
61
+ ## 📖 Table of Contents
62
+
63
+ - [Overview](#-overview)
64
+ - [Key Features](#-key-features)
65
+ - [Installation](#-installation)
66
+ - [Quick Start](#-quick-start)
67
+ - [Core Modules & API Reference](#-core-modules--api-reference)
68
+ - [1. Standardized Solution Prep & NanoDrop Predictor (`spectroscopy`)](#1-standardized-solution-prep--nanodrop-predictor)
69
+ - [2. Fluorophore Modifications & Degree of Labeling (`fluorescence`)](#2-fluorophore-modifications--degree-of-labeling-dol)
70
+ - [3. Gel Migration & Molecular Weight Ladders (`gels`)](#3-gel-migration--molecular-weight-ladders)
71
+ - [4. E. coli Growth & Plasmid/Protein Yields (`ecoli_growth`)](#4-e-coli-growth-kinetics--expression-optimization)
72
+ - [5. PCR Kinetics, Optimization & Master Mix (`pcr`)](#5-pcr-kinetics--protocol-optimization)
73
+ - [6. In Vitro Transcription Stoichiometry (`transcription`)](#6-in-vitro-transcription-ivt-stoichiometry)
74
+ - [7. Molecular Weight & Conversions (`molecular_weight`)](#7-molecular-weight--stoichiometry)
75
+ - [8. Protein Quantification (`protein`)](#8-protein-quantification--yield-analysis)
76
+ - [9. Primer Design & SantaLucia Thermodynamics (`primers`)](#9-primer-creator--thermodynamics)
77
+ - [10. Interactive Drag-and-Drop Gel Annotator & MW Calculator (`interactive_gel`)](#10-interactive-drag-and-drop-gel-annotator--mw-calculator)
78
+ - [11. Gel Labeling Add-on & Image Annotator (`gel_annotator`)](#11-gel-labeling-add-on--image-annotator)
79
+ - [12. Molecular Cloning, Digestion & Assembly (`cloning`)](#12-molecular-cloning-digestion--assembly)
80
+ - [13. Laboratory Buffer & Stock Recipes (`buffers`)](#13-laboratory-buffer--stock-recipes)
81
+ - [14. Nucleic Acid Precipitation & Desalting (`precipitation`)](#14-nucleic-acid-precipitation--desalting)
82
+ - [15. Built-in Excel Extension (`excel_extension`)](#15-built-in-excel-extension)
83
+ - [16. Standard Laboratory Protocols Compendium (`protocols`)](#16-standard-laboratory-protocols-compendium-protocols)
84
+ - [Command-Line Interface (CLI)](#-command-line-interface-cli)
85
+ - [Interactive Excel Workbook Structure](#-interactive-excel-workbook-structure)
86
+ - [Scientific Formulations](#-scientific-formulations)
87
+ - [Running Tests](#-running-tests)
88
+ - [Legal & Compliance Notice](#-legal--compliance-notice)
89
+ - [License](#-license)
90
+
91
+ ---
92
+
93
+ ## 🌟 Overview
94
+
95
+ Bench biologists and bioinformaticians constantly encounter repetitive yet critical quantitative tasks:
96
+ * **Preparing standardized solutions** (e.g., *"How do I make 4 µM ssRNA in 500 µL, and what exact ng/µL concentration and A260 absorbance should I see on the NanoDrop?"*).
97
+ * **Fluorophore labeling & modifications** (mass shifts, spectral parameters, and Degree of Labeling [DOL] efficiency for FAM, Cy3, Cy5, Alexa Fluor, ATTO dyes, and quenchers).
98
+ * **Gel electrophoresis simulation & ladder alignment** (mapping DNA/protein band sizes to 1 kb, 100 bp, or prestained protein ladders and calculating relative migration distances $R_f$).
99
+ * **E. coli expression scheduling & yield prediction** (calculating doubling times, hours from inoculation to induction OD₆₀₀, and theoretical plasmid or recombinant protein yields).
100
+ * **Reaction optimization & troubleshooting** (evaluating in vitro transcription NTP consumption, PCR dNTP limits, touchdown profiles, and Pace et al. $A_{280}$ extinction coefficients).
101
+
102
+ **BioLabCalc** combines a clean Python scientific API, an instant terminal CLI tool, and a built-in Excel extension (`openpyxl`) that generates publication-grade, interactive laboratory notebooks containing live formulas.
103
+
104
+ ---
105
+
106
+ ## 🚀 Key Features
107
+
108
+ <<<<<<< HEAD
109
+ * **Standardized Solution & NanoDrop Predictor**: Computes required mass (µg, ng) and moles (nmol, pmol) for target solutions (e.g., 4 µM in 500 µL), generates pipetting dilution recipes, and predicts exact NanoDrop readings ($A_{260}$, $A_{260}/A_{280}$, and ng/µL).
110
+ * **Fluorophore Modification & Degree of Labeling (DOL)**: Database of fluorophores (FAM, Cy3, Cy5, Alexa Fluor 488/546/594/647, Texas Red, TAMRA, ROX, ATTO 488/647N, BHQ quenchers) with exact MW additions, correction factors ($CF_{260}$, $CF_{280}$), and dye-to-biomolecule DOL calculations.
111
+ * **Gel Migration & Ladder Simulation**: Simulates band positions for 1 kb DNA, 100 bp DNA, low-range oligo, and prestained protein ladders using logarithmic relative mobility ($R_f = a - b \cdot \log_{10}(\text{size})$) with ASCII lane diagrams.
112
+ * **E. coli Growth & Yield Modeling**: Computes doubling times across LB, 2xYT, TB, and M9 media at 18–37°C, projects hours to reach induction OD₆₀₀ (0.6–0.8), and predicts theoretical plasmid DNA yields (pUC, pET, pBR322) and recombinant protein yields.
113
+ =======
114
+ * **Standardized Solution & NanoDrop Predictor**: Computes required mass (µg, ng) and moles (nmol, pmol) for target solutions (e.g., $4\,\mu ext{M}$ in $500\,\mu ext{L}$), generates pipetting dilution recipes, and predicts exact NanoDrop readings ($A_{260}$, $A_{260}/A_{280}$, and $ext{ng}/\mu ext{L}$).
115
+ * **Fluorophore Modification & Degree of Labeling (DOL)**: Database of fluorophores (FAM, Cy3, Cy5, Alexa Fluor 488/546/594/647, Texas Red, TAMRA, ROX, ATTO 488/647N, BHQ quenchers) with exact MW additions, correction factors ($CF_{260}, CF_{280}$), and dye-to-biomolecule DOL calculations.
116
+ * **Gel Migration & Ladder Simulation**: Simulates band positions for 1 kb DNA, 100 bp DNA, low-range oligo, and prestained protein ladders using logarithmic relative mobility \(R_f = a - b \log_{10}(\text{size})\) with ASCII lane diagrams.
117
+ * **E. coli Growth & Yield Modeling**: Computes doubling times across LB, 2xYT, TB, and M9 media at 18–37°C, projects hours to reach induction $OD_{600}$ (0.6–0.8), and predicts theoretical plasmid DNA yields (pUC, pET, pBR322) and recombinant protein yields.
118
+ >>>>>>> f7f5ae9e04728df3fb69686c2540d31b317c5da6
119
+ * **PCR Protocol Optimization**: Computes polymerase-specific annealing temperatures ($T_a$), elongation times (Taq vs. Q5/Phusion vs. Kapa), generates touchdown PCR schedules, and suggests GC enhancers (DMSO, Betaine) for difficult templates.
120
+ * **IVT Stoichiometry**: Tracks per-NTP usage, residual concentrations, incorporation efficiency, inorganic pyrophosphate ($PP_i$) precipitation risks, and transcript turnover ratios.
121
+ * **Exact Molecular Weights**: Sequence-level average and monoisotopic weights for ssDNA, dsDNA, circular plasmids, RNA (5'-ppp, 5'-P, 5'-OH), and polypeptides.
122
+ * **Built-in Excel Extension**: Generates formatted, 7-tab interactive workbooks (`.xlsx`) with live formulas for lab bench use.
123
+
124
+ ---
125
+
126
+ ## 📦 Installation
127
+
128
+ ### From PyPI (Recommended)
129
+ ```bash
130
+ pip install biolabcalc
131
+ ```
132
+
133
+ ### From GitHub (Source / Development)
134
+ ```bash
135
+ git clone https://github.com/your-username/biolabcalc.git
136
+ cd biolabcalc
137
+ pip install -e ".[dev]"
138
+ ```
139
+
140
+ ---
141
+
142
+ ## ⚡ Quick Start
143
+
144
+ ### ⏱️ 5-Minute Benchtop Cookbook (Everyday Lab Calculations)
145
+
146
+ BioLabCalc answers everyday wet-lab calculations via the command line, Python API, or the interactive wizard:
147
+
148
+ | Daily Laboratory Task | CLI Command / Python Code | Expected Output / Result |
149
+ | :--- | :--- | :--- |
150
+ | **Dilute Stock Solution** | `biolabcalc dilute -c1 "100 mM" -c2 "25 mM" -v2 "16 mL"` | Pipette 4.0 mL stock + 12.0 mL diluent |
151
+ | **Neutralize 100 mM NTPs (pH 7.5)** | `biolabcalc ntp-ph -v 4.0 -c 100 -V 16 -C 25 -f disodium_salt` | Add 108.5 µL of 5 M NaOH, QS to 16 mL |
152
+ | **Scale 10X PBS Recipe (500 mL)** | `biolabcalc buffer -b 10X_PBS -v 500` | 40.0 g NaCl, 1.0 g KCl, 7.2 g Na2HPO4, 1.2 g KH2PO4 |
153
+ | **Plan EcoRI + BamHI Double Digest** | `biolabcalc digest -m 1.0 -v 50 -e1 EcoRI -e2 BamHI -c 200` | 5 µL 10X rCutSmart, 5 µL DNA, 1 µL each enzyme, 38 µL water |
154
+ | **Check Overhang Compatibility** | `python -c "import biolabcalc as blc; print(blc.are_overhangs_compatible("BamHI", "BglII"))"` | Compatible cohesive ends (GATC) |
155
+ | **Precipitate Low-Yield RNA** | `biolabcalc precipitate -v 100 -t rna -a ethanol -s naoac` | Add 10 µL 3M NaOAc, 1 µL GlycoBlue, 300 µL 100% EtOH |
156
+ | **Interactive Guided Wizard** | `biolabcalc wizard` | Step-by-step prompted menu for bench calculations |
157
+ | **View Standard Wet-Lab Protocol** | `biolabcalc protocol -n t7_ivt_transcription` | Complete bench protocol with safety, tables, and troubleshooting |
158
+
159
+ ```python
160
+ import biolabcalc.easy as easy
161
+
162
+ # 1. Quick C1*V1 = C2*V2 dilution
163
+ res = easy.dilute(c1="100 mM", c2="25 mM", v2="16 mL")
164
+ print(f"Pipette {res[v1]/1000} mL stock + {res[diluent_needed]/1000} mL water")
165
+
166
+ # 2. Scale 10X PBS buffer to 500 mL
167
+ pbs = easy.buffer("10X_PBS", volume="500 mL")
168
+
169
+ # 3. Quick primer check
170
+ p_info = easy.primer("ATGCCGTCCAGGCTGCTG", primer_conc="400 nM")
171
+ print(f"Tm: {p_info.tm_celsius}°C, GC: {p_info.gc_percent}%")
172
+ ```
173
+
174
+
175
+ ```python
176
+ import biolabcalc as blc
177
+
178
+ # 1. Standardized Solution & NanoDrop Predictor: 4 µM ssRNA in 500 µL
179
+ sol = blc.prepare_standard_solution(
180
+ target_molarity_um=4.0,
181
+ target_volume_ul=500.0,
182
+ seq_type="rna",
183
+ rna_length_nt=36,
184
+ )
185
+ print(f"Required Mass: {sol.required_mass_ug:.2f} µg ({sol.required_moles_nmol:.2f} nmol)")
186
+ print(f"NanoDrop Expected Conc: {sol.expected_nanodrop_ng_ul:.2f} ng/µL")
187
+ print(f"NanoDrop Expected A260: {sol.expected_nanodrop_a260_1cm:.3f} AU (A260/A280 ~ {sol.expected_a260_a280_ratio})")
188
+
189
+ # 2. Fluorophore Modification & Degree of Labeling (DOL)
190
+ dna = blc.calculate_dna_mw("ATGCCGTCCAGGCTGCTGGTC")
191
+ labeled = blc.apply_fluorophore_modification(dna, ["FAM"])
192
+ print(f"FAM-labeled DNA MW: {labeled.total_modified_mw:,.2f} Da (+{labeled.total_added_mw} Da)")
193
+
194
+ dol = blc.calculate_degree_of_labeling(
195
+ absorbance_max_dye=0.75,
196
+ absorbance_280=1.10,
197
+ fluorophore_name="FAM",
198
+ protein_extinction_coeff=45000,
199
+ )
200
+ print(f"Degree of Labeling: {dol.degree_of_labeling:.2f} ({dol.interpretation})")
201
+
202
+ # 3. Gel Electrophoresis Migration Simulation
203
+ sim = blc.simulate_gel([750, 2200, 4500], ladder_key="1kb_dna")
204
+ print(sim.ascii_visualization)
205
+
206
+ # 4. E. coli Growth & Induction Scheduling
207
+ growth = blc.calculate_ecoli_growth(initial_od600=0.05, target_od600=0.65, temperature_celsius=37.0, media="LB")
208
+ print(f"Time to Induction OD: {growth.formatted_time} ({growth.num_doublings} doublings)")
209
+
210
+ # 5. Generate Multi-Tab Interactive Excel Lab Notebook
211
+ blc.generate_lab_notebook_template("BioLab_Interactive_Notebook.xlsx")
212
+ ```
213
+
214
+ ---
215
+
216
+ ## 🔬 Core Modules & API Reference
217
+
218
+ ### 1. Standardized Solution Prep & NanoDrop Predictor
219
+ ```python
220
+ from biolabcalc.spectroscopy import prepare_standard_solution
221
+
222
+ res = prepare_standard_solution(
223
+ target_molarity_um=4.0,
224
+ target_volume_ul=500.0,
225
+ seq_type="rna",
226
+ rna_length_nt=36,
227
+ stock_conc_ng_ul=500.0, # Optional: provides pipetting dilution recipe
228
+ )
229
+ ```
230
+ **Output Highlights:**
231
+ <<<<<<< HEAD
232
+ - `required_mass_ug`: Total mass needed: 23.02 µg.
233
+ - `required_moles_nmol`: Total moles: 2.000 nmol.
234
+ - `expected_nanodrop_ng_ul`: Target concentration reading: 46.03 ng/µL.
235
+ - `expected_nanodrop_a260_1cm`: Normalized $A_{260}$ reading: 1.151 AU.
236
+ - `expected_nanodrop_a260_1mm`: Physical pedestal reading: 0.1151 AU.
237
+ =======
238
+ - `required_mass_ug`: Total mass needed ($23.02\,\mu ext{g}$).
239
+ - `required_moles_nmol`: Total moles ($2.000 ext{ nmol}$).
240
+ - `expected_nanodrop_ng_ul`: Target concentration reading (\(46.03\,\text{ng}/\mu\text{L}\)).
241
+ - `expected_nanodrop_a260_1cm`: Normalized \(A_{260}\) reading (\(1.151\,\text{AU}\)).
242
+ - `expected_nanodrop_a260_1mm`: Physical pedestal reading (\(0.1151\,\text{AU}\)).
243
+ >>>>>>> f7f5ae9e04728df3fb69686c2540d31b317c5da6
244
+ - `preparation_instructions`: Exact pipetting instructions for bench technicians.
245
+
246
+ ### 2. Fluorophore Modifications & Degree of Labeling (DOL)
247
+ ```python
248
+ from biolabcalc.fluorescence import apply_fluorophore_modification, calculate_degree_of_labeling
249
+
250
+ # Add fluorophores/quenchers to DNA, RNA, or protein
251
+ mod_res = apply_fluorophore_modification(base_dna_mw, ["FAM", "BHQ1"])
252
+
253
+ # Quantify labeling efficiency from spectrophotometer readings
254
+ dol = calculate_degree_of_labeling(
255
+ absorbance_max_dye=0.65,
256
+ absorbance_260=1.25,
257
+ fluorophore_name="FAM",
258
+ oligo_extinction_coeff=360000,
259
+ )
260
+ ```
261
+
262
+ ### 3. Gel Migration & Molecular Weight Ladders
263
+ ```python
264
+ from biolabcalc.gels import simulate_gel
265
+
266
+ # LADDER OPTIONS: "1kb_dna", "100bp_dna", "low_range_ssdna", "protein_broad_range"
267
+ sim = simulate_gel(sample_sizes=[450, 1200, 3000], ladder_key="1kb_dna")
268
+ print(sim.ascii_visualization)
269
+ ```
270
+
271
+ ### 4. E. coli Growth Kinetics & Expression Optimization
272
+ ```python
273
+ from biolabcalc.ecoli_growth import calculate_ecoli_growth, estimate_plasmid_yield, optimize_protein_induction
274
+
275
+ # Time to induction OD600
276
+ growth = calculate_ecoli_growth(initial_od600=0.05, target_od600=0.65, temperature_celsius=37.0, media="LB")
277
+
278
+ # Estimate plasmid prep yield from culture
279
+ plasmid = estimate_plasmid_yield(culture_volume_ml=5.0, final_od600=3.0, plasmid_type="pUC")
280
+
281
+ # Recombinant protein yield and induction condition advisor
282
+ prot = optimize_protein_induction(protein_mw_da=45000, culture_volume_ml=1000.0, final_od600=4.0)
283
+ ```
284
+
285
+ ### 5. PCR Kinetics & Protocol Optimization
286
+ ```python
287
+ from biolabcalc.pcr import calculate_pcr_kinetics, optimize_pcr_protocol, build_master_mix
288
+
289
+ # Protocol optimization: annealing temp, extension time, touchdown schedule, additives
290
+ protocol = optimize_pcr_protocol(primer_fwd_tm=60.5, primer_rev_tm=60.0, amplicon_len_bp=800, polymerase="q5")
291
+
292
+ # Master mix pipetting table for N samples with 10% excess
293
+ master_mix = build_master_mix(num_reactions=24, excess_percent=10.0)
294
+ ```
295
+
296
+ ---
297
+
298
+ ### 16. Standard Laboratory Protocols Compendium (`protocols`)
299
+
300
+ BioLabCalc includes a built-in catalog of 10 fully verified, easy-to-understand wet-lab molecular biology and biochemistry protocols. Each protocol provides comprehensive reagent formulation tables, materials lists, safety warnings, pro tips, time/temperature parameters, troubleshooting matrices, and literature citations. The complete consolidated manual is compiled in [`PROTOCOLS.md`](PROTOCOLS.md).
301
+
302
+ #### Built-in Protocols:
303
+ 1. **`ntp_neutralization`**: 25 mM Neutralized NTP Mix Preparation (pH 7.5) with NaOH titration and logic checks.
304
+ 2. **`t7_ivt_transcription`**: High-Yield T7 In Vitro Transcription of RNA with DNase I degradation.
305
+ 3. **`ecoli_transformation`**: Heat-Shock Transformation of Chemically Competent *E. coli* (DH5α / BL21).
306
+ 4. **`alkaline_lysis_miniprep`**: Alkaline Lysis Plasmid DNA Miniprep with silica spin column binding.
307
+ 5. **`agarose_gel_electrophoresis`**: Submarine Agarose Gel Casting, Loading, and Imaging for DNA/RNA.
308
+ 6. **`denaturing_urea_page`**: 7–8 M Urea-PAGE for Single-Nucleotide Resolution of Small RNAs and Aptamers.
309
+ 7. **`ethanol_precipitation`**: Ethanol & Isopropanol Nucleic Acid Precipitation and Desalting.
310
+ 8. **`gibson_assembly`**: Gibson Isothermal Assembly for 2–3 Overlapping DNA Fragments.
311
+ 9. **`restriction_double_digest`**: Restriction Endonuclease Double Digest with rSAP Dephosphorylation.
312
+ 10. **`bradford_protein_assay`**: Bradford / BCA Colorimetric Protein Assay with BSA Standard Curve.
313
+
314
+ #### Python API:
315
+ ```python
316
+ from biolabcalc.protocols import list_protocols, get_protocol, export_all_protocols_markdown
317
+
318
+ # List all protocols or filter by category
319
+ protocols = list_protocols(category="RNA")
320
+
321
+ # Inspect a specific protocol
322
+ proto = get_protocol("t7_ivt_transcription")
323
+ print(f"{proto.title}: {proto.estimated_time}")
324
+
325
+ # Export consolidated markdown manual
326
+ export_all_protocols_markdown("PROTOCOLS.md")
327
+ ```
328
+
329
+ #### CLI:
330
+ ```bash
331
+ # List all protocols in the catalog
332
+ biolabcalc protocol --list
333
+
334
+ # Filter by category (e.g. RNA, Cloning, Electrophoresis)
335
+ biolabcalc protocol --category RNA
336
+
337
+ # Display full step-by-step instructions at the terminal
338
+ biolabcalc protocol -n ntp_neutralization
339
+
340
+ # Export complete PROTOCOLS.md manual
341
+ biolabcalc protocol --export PROTOCOLS.md
342
+ ```
343
+
344
+ ---
345
+
346
+ ## 💻 Command-Line Interface (CLI)
347
+
348
+ ```bash
349
+ # NanoDrop & Standardized Solution (e.g. 4 uM ssRNA in 500 uL)
350
+ biolabcalc nanodrop -u 4.0 -v 500 -t rna --length 36
351
+
352
+ # Fluorophore modification & spectral info
353
+ biolabcalc fluo -s ATGCCGTCCAGGCTGCTGGTC -d FAM
354
+
355
+ # Gel electrophoresis ladder simulation
356
+ biolabcalc gel -s 750 2200 4500 --ladder 1kb_dna
357
+
358
+ # PCR protocol optimization
359
+ biolabcalc pcr-opt --fwd-tm 60.5 --rev-tm 60.0 -l 800 -p q5 --gc 52.0
360
+
361
+ # E. coli growth & plasmid yield
362
+ biolabcalc ecoli --init-od 0.05 --target-od 0.65 --temp 37 --media LB --vol-ml 1000
363
+
364
+ # Annotate gel images, label lanes, and callout molecular weights
365
+ biolabcalc annotate-gel \
366
+ --lanes "Ladder,Ctrl,Clone1,Clone2,Digest" \
367
+ --ladder 1kb_dna \
368
+ --ladder-lane 1 \
369
+ --bands "3:850:Amplicon,4:850:Amplicon,5:3500:Vector" \
370
+ --title "Colony PCR Screening" \
371
+ --output "annotated_gel.png" \
372
+ --excel "Experiment_Report.xlsx"
373
+
374
+ # Restriction enzyme digestion setup
375
+ biolabcalc digest --dna-ug 2.0 -e1 EcoRI -e2 BamHI --dna-conc 250
376
+
377
+ # DNA ligation molar ratio calculator (3:1 insert:vector)
378
+ biolabcalc ligate --vec-bp 4500 --ins-bp 1200 --vec-ng 50 --ratio 3.0
379
+
380
+ # Gibson Assembly / NEBuilder HiFi calculator
381
+ biolabcalc gibson --vec-bp 5000 --ins-bp 850 1500 --vec-ng 100
382
+
383
+ # Buffer recipe calculator (500 mL of 50X TAE)
384
+ biolabcalc buffer -b 50X_TAE -v 500
385
+
386
+ # Ethanol precipitation of nucleic acids
387
+ biolabcalc precipitate -v 100 -t dna -a ethanol -s naoac
388
+
389
+ # Launch interactive drag-and-drop gel tool in web browser
390
+ biolabcalc interactive-gel --port 8501
391
+
392
+ # Save standalone HTML application to share with lab members
393
+ biolabcalc interactive-gel --save-html "Interactive_Gel_Tool.html"
394
+
395
+ # Generate full interactive Excel lab notebook
396
+ biolabcalc excel-template -o "BioLab_Calculator.xlsx"
397
+ ```
398
+
399
+ ---
400
+
401
+ ## 📊 Interactive Excel Workbook Structure
402
+
403
+ The generated workbook (`biolabcalc excel-template`) contains 7 specialized, styled sheets with live formulas:
404
+
405
+ 1. **`IVT_Stoichiometry`**: Live IVT yield, per-NTP consumption (ATP, CTP, GTP, UTP), residual concentrations, pyrophosphate byproduct, and transcript turnover.
406
+ 2. **`PCR_Optimization`**: Multi-sample master mix formulation table with dynamic excess multipliers and qPCR standard curve efficiency solver (`=10^(-1/slope)-1`).
407
+ 3. **`Protein_Quantification`**: Direct $A_{280}$ Beer-Lambert calculator and BCA/Bradford standard curve regression (`SLOPE()`, `INTERCEPT()`) with unknown sample interpolation.
408
+ 4. **`Primer_Design_Log`**: Formatted log for tracking primer names, sequences, $T_m$, GC%, 3' GC clamps, and amplicon lengths.
409
+ 5. **`Solution_Prep_NanoDrop`**: Input target molarity and volume; auto-calculates required mass/moles, stock dilution pipetting volumes, and predicted NanoDrop readings ($A_{260}$, $A_{260}/A_{280}$, $ ext{ng}/\mu ext{L}$).
410
+ 6. **`Fluorophore_Modifications`**: Spectral property lookup and live Degree of Labeling (DOL) calculator.
411
+ 7. **`Ecoli_Growth_Optimization`**: Inoculation-to-induction timeline calculator, doubling time tables, and plasmid/recombinant protein yield projections.
412
+
413
+
414
+
415
+ ---
416
+
417
+ <a name="scientific-formulations"></a>
418
+ ## 📐 Scientific Formulations
419
+
420
+ BioLabCalc implements standardized, peer-reviewed mathematical models and biophysical equations:
421
+
422
+ ### 1. Beer-Lambert Law & NanoDrop Spectrophotometry
423
+ Light absorbance across an optical pathlength is governed by the Beer-Lambert law:
424
+
425
+ $$
426
+ A = \epsilon \cdot c \cdot l
427
+ $$
428
+
429
+ Where:
430
+ * $A$: Absorbance (dimensionless Absorbance Units, AU)
431
+ * $\epsilon$: Molar extinction coefficient ($\text{L}\cdot\text{mol}^{-1}\cdot\text{cm}^{-1}$)
432
+ * $c$: Molar concentration ($\text{mol}\cdot\text{L}^{-1}$)
433
+ * $l$: Optical pathlength ($1.0\text{ cm}$ standard cuvette; $0.1\text{ cm} = 1.0\text{ mm}$ NanoDrop pedestal)
434
+
435
+ The mass concentration $c_{\text{mass}}$ ($\text{ng}/\mu\text{L} \equiv \mu\text{g}/\text{mL}$) is calculated from absorbance normalized to a $1.0\text{ cm}$ pathlength:
436
+
437
+ $$
438
+ c_{\text{mass}} = \frac{A_{260} \cdot 10^6}{\epsilon_{260}} \cdot MW
439
+ $$
440
+
441
+ Standard empirical conversion constants for nucleic acids ($1.0\text{ AU}$ at $260\text{ nm}$ across a $1.0\text{ cm}$ pathlength):
442
+ * **Double-stranded DNA (dsDNA)**: $50.0\text{ ng}/\mu\text{L}$ per $A_{260}$ unit
443
+ * **Single-stranded RNA (ssRNA)**: $40.0\text{ ng}/\mu\text{L}$ per $A_{260}$ unit
444
+ * **Single-stranded DNA (ssDNA)**: $33.0\text{ ng}/\mu\text{L}$ per $A_{260}$ unit
445
+
446
+ ### 2. Nucleic Acid Molecular Weights
447
+ Molecular weights are computed from sequence-level atomic composition:
448
+
449
+ * **Single-Stranded DNA (ssDNA, 5'-monophosphate)**:
450
+ $$
451
+ MW_{\text{ssDNA}} = (N_A \times 313.21) + (N_T \times 304.20) + (N_C \times 289.18) + (N_G \times 329.21) - 61.96
452
+ $$
453
+
454
+ * **Double-Stranded DNA (dsDNA)**:
455
+ $$
456
+ MW_{\text{dsDNA}} = (N_{\text{bp}} \times 607.4) + 157.9
457
+ $$
458
+
459
+ * **Single-Stranded RNA (5'-triphosphate, primary in vitro transcription product)**:
460
+ $$
461
+ MW_{\text{RNA, 5'-ppp}} = (N_A \times 329.21) + (N_U \times 306.17) + (N_C \times 305.18) + (N_G \times 345.21) + 159.0
462
+ $$
463
+
464
+ * **Single-Stranded RNA (5'-monophosphate, processed transcript)**:
465
+ $$
466
+ MW_{\text{RNA, 5'-p}} = MW_{\text{RNA, 5'-ppp}} - 79.98
467
+ $$
468
+
469
+ ### 3. SantaLucia (1998) Nearest-Neighbor Primer Thermodynamics
470
+ Primer melting temperatures ($T_m$) are calculated using unified nearest-neighbor thermodynamic parameters:
471
+
472
+ $$
473
+ \Delta H^\circ = \sum \Delta H^\circ_{\text{NN}} + \Delta H^\circ_{\text{init}}
474
+ $$
475
+
476
+ $$
477
+ \Delta S^\circ = \sum \Delta S^\circ_{\text{NN}} + \Delta S^\circ_{\text{init}}
478
+ $$
479
+
480
+ $$
481
+ T_m = \frac{\Delta H^\circ}{\Delta S^\circ + R \ln(C_T / 4)} - 273.15 + 16.6 \log_{10}[\text{Na}^+]
482
+ $$
483
+
484
+ Where:
485
+ * $\Delta H^\circ$: Enthalpy change ($\text{kcal}\cdot\text{mol}^{-1}$)
486
+ * $\Delta S^\circ$: Entropy change ($\text{cal}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}$)
487
+ * $R = 1.9872\text{ cal}\cdot\text{mol}^{-1}\cdot\text{K}^{-1}$: Universal gas constant
488
+ * $C_T$: Total primer concentration (typically $400\text{ nM} = 4.0 \times 10^{-7}\text{ M}$)
489
+ * $[\text{Na}^+]$: Effective monovalent cation concentration (typically $50\text{ mM} = 0.05\text{ M}$)
490
+
491
+ ### 4. Gel Electrophoresis Migration Mobility ($R_f$)
492
+ The relative migration distance ($R_f$) of linear nucleic acid or denatured protein fragments through sieving matrices is inversely proportional to the logarithm of molecular size:
493
+
494
+ $$
495
+ R_f = a - b \cdot \log_{10}(M)
496
+ $$
497
+
498
+ Where:
499
+ * $R_f = \frac{d_{\text{band}}}{d_{\text{dye}}}$: Relative mobility normalized to the dye front
500
+ * $M$: Molecular size (in base pairs, nucleotides, or kDa)
501
+ * $a, b$: Calibration constants determined by linear regression against reference ladder bands
502
+
503
+ ### 5. Bacterial Exponential Growth Kinetics (*E. coli*)
504
+ During exponential phase growth, cell density ($\text{OD}_{600}$) increases according to first-order kinetics:
505
+
506
+ $$
507
+ \text{OD}(t) = \text{OD}_0 \cdot 2^{t / g} = \text{OD}_0 \cdot e^{\mu t}
508
+ $$
509
+
510
+ Where:
511
+ * $\text{OD}_0$: Initial optical density at $600\text{ nm}$
512
+ * $g$: Generation (doubling) time in minutes ($g = \frac{\ln 2}{\mu}$)
513
+ * $\mu$: Specific growth rate ($\text{min}^{-1}$)
514
+ * The time $t$ to reach target induction optical density ($\text{OD}_{\text{target}}$, typically 0.6–0.8) is:
515
+ $$
516
+ t = g \cdot \frac{\log_{10}(\text{OD}_{\text{target}} / \text{OD}_0)}{\log_{10}(2)}
517
+ $$
518
+
519
+ ### 6. In Vitro Transcription (IVT) Stoichiometry
520
+ Enzymatic synthesis of RNA by T7 RNA polymerase consumes ribonucleotide triphosphates and generates inorganic pyrophosphate ($PP_i$) byproducts:
521
+
522
+ $$
523
+ \text{Molar Yield (mol)} = \frac{\text{Mass Yield (g)}}{MW_{\text{transcript}}\text{ (g/mol)}}
524
+ $$
525
+
526
+ For each nucleotide species $X \in \{A, U, C, G\}$:
527
+ $$
528
+ \text{Consumed } X\text{ (moles)} = \text{Molar Yield} \times N_X
529
+ $$
530
+
531
+ $$
532
+ \text{Pyrophosphate Generated } (PP_i)\text{ (moles)} = \text{Molar Yield} \times (L_{\text{transcript}} - 1)
533
+ $$
534
+
535
+ ### 7. Pace et al. (1995) Protein Extinction Coefficient ($\epsilon_{280}$)
536
+ The theoretical molar extinction coefficient of an unfolded or denatured protein at $280\text{ nm}$ is calculated from aromatic amino acid and disulfide bond counts:
537
+
538
+ $$
539
+ \epsilon_{280} = (N_{\text{Trp}} \times 5500) + (N_{\text{Tyr}} \times 1490) + (N_{\text{Cystine}} \times 125)
540
+ $$
541
+
542
+ Where $N_{\text{Cystine}} = \lfloor N_{\text{Cys}} / 2 \rfloor$ under non-reducing conditions, or $0$ under reducing conditions (DTT / $\beta$-ME).
543
+
544
+ ### 8. Fluorophore Degree of Labeling (DOL)
545
+ The molar ratio of fluorophore to biomolecule is quantified spectrophotometrically:
546
+
547
+ $$
548
+ \text{DOL} = \frac{A_{\text{max}} \cdot \epsilon_{\text{biomolecule}}}{(A_{280} - A_{\text{max}} \cdot CF_{280}) \cdot \epsilon_{\text{dye}}}
549
+ $$
550
+
551
+ Where:
552
+ * $A_{\text{max}}$: Absorbance at the dye excitation maximum wavelength
553
+ * $A_{280}$: Absorbance at $280\text{ nm}$ (or $A_{260}$ for oligonucleotides)
554
+ * $CF_{280}$: Spectral correction factor ($\frac{A_{280,\text{dye}}}{A_{\text{max},\text{dye}}}$)
555
+ * $\epsilon_{\text{biomolecule}}, \epsilon_{\text{dye}}$: Respective molar extinction coefficients
556
+
557
+ ### 9. qPCR Amplification Efficiency
558
+ From the slope of a linear standard curve ($C_q$ vs. $\log_{10}[\text{template dilution}]$):
559
+
560
+ $$
561
+ \text{Efficiency } (E) = 10^{-1 / \text{slope}} - 1
562
+ $$
563
+
564
+ $$
565
+ \text{Percentage Efficiency} = E \times 100\%
566
+ $$
567
+
568
+ *(An ideal slope of $-3.3219$ corresponds to $E = 1.00$, or $100\%$ amplification efficiency).*
569
+
570
+ ### 10. Tris Buffer Temperature-Dependent pH Shift
571
+ Tris solutions exhibit temperature sensitivity due to a negative ionization enthalpy:
572
+
573
+ $$
574
+ \Delta \text{pH} = \frac{d\text{p}K_a}{dT} \times (T_{\text{target}} - T_{\text{measured}})
575
+ $$
576
+
577
+ Where $\frac{d\text{p}K_a}{dT} \approx -0.028\text{ pH units}/^\circ\text{C}$.
578
+
579
+ ---
580
+
581
+ ## 🧪 Running Tests
582
+
583
+ ```bash
584
+ python -m unittest discover -s tests
585
+ ```
586
+
587
+ All 114 automated tests pass with 100% test coverage across core mathematical, physical, and biochemical modules.
588
+
589
+ ---
590
+
591
+ ## 🚀 PyPI Publishing & Distribution
592
+
593
+ BioLabCalc is configured for automated Continuous Delivery to [PyPI](https://pypi.org/project/biolabcalc/) using GitHub Actions and PyPI Trusted Publishing (OIDC).
594
+
595
+
596
+
597
+ ## ⚖️ Legal & Compliance Notice
598
+
599
+ BioLabCalc is developed for open scientific research. For full regulatory, export control, biosecurity, and dependency audit details, consult [LEGAL.md](LEGAL.md).
600
+
601
+ * **Research Use Only (RUO)**: BioLabCalc is designed solely for academic research and educational purposes. It is **not** certified, validated, or intended for human or animal clinical diagnostics, medical treatment, or therapeutic manufacturing.
602
+ * **Biosecurity & Export Control**: All algorithms are based on fundamental, publicly available scientific research (15 CFR § 734.7 & § 734.8; EAR99). The software contains no select agent design pipelines or dual-use biosecurity evasion mechanisms.
603
+ * **Permissive Dependencies**: All upstream dependencies (`openpyxl`, `matplotlib`, `Pillow`, `numpy`) use OSI-approved permissive licenses (MIT, PSF, HPND, BSD-3-Clause) with zero copyleft (GPL/AGPL) restrictions.
604
+ * **Trademark Notice**: All third-party registered trademarks (e.g. Gibson Assembly®, NanoDrop™, Coomassie®, Triton™, Tween®, Q5®, Phusion®) are the property of their respective owners and are referenced under nominative fair use without affiliation or endorsement.
605
+
606
+ ---
607
+
608
+ ## 📄 License
609
+
610
+ MIT License. See [LICENSE](LICENSE) for details.