-
Notifications
You must be signed in to change notification settings - Fork 10
Use pydna classes for external imports and oligonucleotide hybridization #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #378 +/- ##
==========================================
+ Coverage 96.83% 97.29% +0.45%
==========================================
Files 28 29 +1
Lines 1642 1698 +56
==========================================
+ Hits 1590 1652 +62
+ Misses 52 46 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors external sequence imports and oligonucleotide hybridization functionality to use pydna classes, improving code organization and type safety. The changes centralize external repository handling through catalog-based lookups and delegate hybridization logic to pydna's native implementations.
Key changes:
- Introduced catalog system for external plasmid repositories (SEVA, SnapGene, iGEM2024, OpenDNA Collections)
- Refactored external import endpoints to use pydna's
RepositoryIdSourceand other source models - Replaced custom oligonucleotide hybridization with pydna's
oligonucleotide_hybridizationfunction - Updated pydna dependency and opencloning-linkml schema version
- Improved error handling with consistent use of FastAPI's
HTTPException
Reviewed changes
Copilot reviewed 29 out of 31 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/opencloning/catalogs/init.py | New catalog module for loading plasmid repository mappings from YAML/TSV files |
| src/opencloning/catalogs/*.yaml | New catalog data files for SnapGene, SEVA, iGEM2024, and OpenDNA collections |
| src/opencloning/dna_functions.py | Refactored repository functions to return Dseqrecord with pydna source models |
| src/opencloning/ncbi_requests.py | Added genome annotation querying and region extraction with pydna source integration |
| src/opencloning/endpoints/external_import.py | Simplified endpoint handlers using centralized error handling and pydna models |
| src/opencloning/endpoints/no_input.py | Replaced custom hybridization with pydna's implementation |
| src/opencloning/endpoints/endpoint_utils.py | Updated format_products to accept source_id and handle pydna sources |
| scripts/update_catalogs.py | New script for automated catalog updates from upstream sources |
| tests/* | Updated tests to reflect API changes and new error messages |
| pyproject.toml | Updated pydna and opencloning-linkml dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/opencloning/catalogs/__init__.py
Outdated
| return yaml.load(f, Loader=yaml.FullLoader) | ||
|
|
||
|
|
||
| def get_openDNA_collections_catalog(): | ||
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | ||
| with open(catalog_path, 'r') as f: | ||
| return yaml.load(f, Loader=yaml.FullLoader) | ||
|
|
||
|
|
||
| def get_iGEM2024_catalog(): | ||
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | ||
| with open(catalog_path, 'r') as f: | ||
| return yaml.load(f, Loader=yaml.FullLoader) |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.
| return yaml.load(f, Loader=yaml.FullLoader) | |
| def get_openDNA_collections_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.load(f, Loader=yaml.FullLoader) | |
| def get_iGEM2024_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.load(f, Loader=yaml.FullLoader) | |
| return yaml.safe_load(f) | |
| def get_openDNA_collections_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.safe_load(f) | |
| def get_iGEM2024_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.safe_load(f) |
scripts/update_catalogs.py
Outdated
| response = await client.get( | ||
| 'https://raw.githubusercontent.com/manulera/SnapGene_crawler/refs/heads/master/index.yaml' | ||
| ) | ||
| data = yaml.load(response.text, Loader=yaml.FullLoader) |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.
| data = yaml.load(response.text, Loader=yaml.FullLoader) | |
| data = yaml.safe_load(response.text) |
src/opencloning/catalogs/__init__.py
Outdated
| return yaml.load(f, Loader=yaml.FullLoader) | ||
|
|
||
|
|
||
| def get_openDNA_collections_catalog(): | ||
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | ||
| with open(catalog_path, 'r') as f: | ||
| return yaml.load(f, Loader=yaml.FullLoader) | ||
|
|
||
|
|
||
| def get_iGEM2024_catalog(): | ||
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | ||
| with open(catalog_path, 'r') as f: | ||
| return yaml.load(f, Loader=yaml.FullLoader) |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.
| return yaml.load(f, Loader=yaml.FullLoader) | |
| def get_openDNA_collections_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.load(f, Loader=yaml.FullLoader) | |
| def get_iGEM2024_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.load(f, Loader=yaml.FullLoader) | |
| return yaml.safe_load(f) | |
| def get_openDNA_collections_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.safe_load(f) | |
| def get_iGEM2024_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.safe_load(f) |
src/opencloning/catalogs/__init__.py
Outdated
| return yaml.load(f, Loader=yaml.FullLoader) | ||
|
|
||
|
|
||
| def get_openDNA_collections_catalog(): | ||
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | ||
| with open(catalog_path, 'r') as f: | ||
| return yaml.load(f, Loader=yaml.FullLoader) | ||
|
|
||
|
|
||
| def get_iGEM2024_catalog(): | ||
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | ||
| with open(catalog_path, 'r') as f: | ||
| return yaml.load(f, Loader=yaml.FullLoader) |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use yaml.safe_load() instead of yaml.load() with FullLoader. The yaml.load() function with FullLoader can execute arbitrary Python code and poses a security risk. yaml.safe_load() is the recommended secure alternative for loading YAML files.
| return yaml.load(f, Loader=yaml.FullLoader) | |
| def get_openDNA_collections_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.load(f, Loader=yaml.FullLoader) | |
| def get_iGEM2024_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.load(f, Loader=yaml.FullLoader) | |
| return yaml.safe_load(f) | |
| def get_openDNA_collections_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'openDNA_collections.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.safe_load(f) | |
| def get_iGEM2024_catalog(): | |
| catalog_path = os.path.join(os.path.dirname(__file__), 'igem2024.yaml') | |
| with open(catalog_path, 'r') as f: | |
| return yaml.safe_load(f) |
No description provided.