### Install Genedom using Pip Source: https://github.com/edinburgh-genome-foundry/genedom/blob/master/README.rst Provides the command-line instruction to install the Genedom Python package using pip, the standard package installer for Python. ```shell pip install genedom ``` -------------------------------- ### Install Genedom using pip Source: https://github.com/edinburgh-genome-foundry/genedom/blob/master/docs/index.md Provides the command-line instruction to install the Genedom library using pip. Note that the command shown installs 'geneblocks', implying a potential package name change or that geneblocks is a prerequisite/related package. ```shell sudo pip install geneblocks ``` -------------------------------- ### Batch Domestication with PDF Report in Python Source: https://github.com/edinburgh-genome-foundry/genedom/blob/master/README.rst Illustrates batch domestication of multiple genetic parts with Genedom, including the option to generate barcodes and a comprehensive report. It loads records from file paths, creates a barcode collection, and performs batch domestication using a specified standard (EMMA in this example). ```python from genedom import BUILTIN_STANDARDS, load_record, batch_domestication records = [ load_record(filepath, name=filename) for filepath in records_filepaths ] barcodes_collection = BarcodesCollection.from_specs(n_barcodes=10) batch_domestication(records, 'domestication_report.zip', barcodes=barcodes, # optional standard=BUILTIN_STANDARDS.EMMA) ``` -------------------------------- ### Loading Sequences from Various File Formats (Python) Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Demonstrates how to load DNA sequences from different file formats (GenBank, FASTA, SnapGene .dna) into `genedom` objects. It covers loading single records, multiple records from a single file, and records from a list of files. Uses functions like `load_record` and `load_records`. ```python from genedom import load_record, load_records, GoldenGateDomesticator, write_record # Load single record from GenBank genbank_record = load_record("part.gb", name="my_part") # Load from FASTA fasta_record = load_record("part.fa", name="my_part") # Load from SnapGene file snapgene_record = load_record("part.dna", name="my_part") # Load multiple records from a multi-sequence file all_records = load_records("parts.gb") # Load from multiple files records = load_records(["part1.gb", "part2.fa", "part3.dna"]) ``` -------------------------------- ### Simple Part Domestication in Python Source: https://github.com/edinburgh-genome-foundry/genedom/blob/master/README.rst Demonstrates basic domestication of a single genetic part using Genedom. It generates a random DNA sequence, defines a domesticator with specific enzyme sites, performs the domestication, and prints a summary report. The domesticated record is then written to a Genbank file. ```python from genedom import ( GoldenGateDomesticator, random_dna_sequence, write_record ) sequence = random_dna_sequence(2000, seed=123) domesticator = GoldenGateDomesticator("ATTC", "ATCG", enzyme='BsmBI') domestication_results = domesticator.domesticate(sequence, edit=True) print (domestication_results.summary()) write_record(domestication_results.record_after, 'domesticated.gb') ``` -------------------------------- ### Domesticate a Single DNA Part with Golden Gate Assembly Source: https://github.com/edinburgh-genome-foundry/genedom/blob/master/docs/index.md Demonstrates the basic usage of Genedom to domesticate a single DNA sequence for Golden Gate assembly. It involves creating a domesticator object with specified overhangs and enzyme, then applying it to a random DNA sequence. The results include a summary and a saved GenBank record. ```python from genedom import ( GoldenGateDomesticator, random_dna_sequence, write_record) sequence = random_dna_sequence(2000, seed=123) domesticator = GoldenGateDomesticator("ATTC", "ATCG", enzyme='BsmBI') domestication_results = domesticator.domesticate(sequence, edit=True) print (domestication_results.summary()) write_record(domestication_results.record_after, 'domesticated.gb') ``` -------------------------------- ### Generate Barcode Collection in Python Source: https://github.com/edinburgh-genome-foundry/genedom/blob/master/README.rst Shows how to generate a collection of random DNA barcodes of a specified length and quantity using Genedom. It allows exclusion of specific enzymes to ensure compatibility with certain restriction digests. The generated barcodes are saved to a FASTA file. ```python from genedom import BarcodesCollection barcodes_collection = BarcodesCollection.from_specs( n_barcodes=96, barcode_length=20, forbidden_enzymes=('BsaI', 'BsmBI', 'BbsI')) barcodes_collection.to_fasta('example_barcodes_collection.fa') ``` -------------------------------- ### Batch Domestication with PDF Report (Python) Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Processes multiple DNA parts for Golden Gate assembly, generates domesticated GenBank files, ordering files, and a comprehensive PDF report. It supports optional barcode generation for sample tracking and allows edits during domestication. Dependencies include 'genedom' and standard Python libraries. ```python import os from genedom import BUILTIN_STANDARDS, load_record, batch_domestication, BarcodesCollection # Load multiple sequence files records = [ load_record(os.path.join("parts", filename), name=filename) for filename in ["promoter.gb", "cds.gb", "terminator.gb"] ] # Optional: Generate barcodes for sample tracking barcodes = BarcodesCollection.from_specs( n_barcodes=len(records), barcode_length=20, forbidden_enzymes=("BsaI", "BsmBI") ) # Batch domesticate using built-in EMMA standard n_failures, zip_data = batch_domestication( records=records, target='domestication_report.zip', standard=BUILTIN_STANDARDS.EMMA, allow_edits=True, barcodes=barcodes, barcode_spacer="AA", include_optimization_reports=True, include_original_records=True, domesticated_suffix="_dom" ) print(f"Domestication complete! {n_failures} failures out of {len(records)} parts") # Output: Domestication complete! 0 failures out of 3 parts # The zip file contains: # - domesticated_genbanks/: GenBank files of all domesticated parts # - sequences_to_order/: FASTA and Excel files ready for DNA synthesis # - original/: Original input sequences for traceability # - error_reports/: Detailed reports for any failed domestications # - Report.pdf: Summary report with visual sequence icons # - order_ids.csv: Mapping of original names to sanitized order IDs ``` -------------------------------- ### Generate Random DNA Sequences with Controlled Composition Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Provides functionality to generate random DNA sequences of a specified length. Users can control nucleotide composition using custom probability dictionaries or default to equal probabilities. Includes options for setting a random seed for reproducibility and demonstrates GC-rich and AT-rich sequence generation. ```python from genedom import random_dna_sequence # Generate random sequence with equal probabilities random_seq = random_dna_sequence(1000, seed=42) print(f"Random sequence: {random_seq[:50]}...") # Generate with custom nucleotide probabilities (GC-rich) gc_rich_seq = random_dna_sequence( length=2000, probas={"A": 0.15, "T": 0.15, "G": 0.35, "C": 0.35}, seed=123 ) # Calculate GC content gc_count = gc_rich_seq.count("G") + gc_rich_seq.count("C") gc_content = gc_count / len(gc_rich_seq) print(f"GC content: {gc_content:.2%}") # Generate AT-rich sequence at_rich_seq = random_dna_sequence( length=1500, probas={"A": 0.4, "T": 0.4, "G": 0.1, "C": 0.1}, seed=789 ) # Use for testing domesticator from genedom import GoldenGateDomesticator domesticator = GoldenGateDomesticator("AATG", "GCTT") result = domesticator.domesticate(random_seq, edit=True) print(f"Test domestication: {result.success}") ``` -------------------------------- ### Generate Compatible Barcode Collection Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Creates a collection of molecular barcodes with specified constraints for sample identification. Ensures compatibility and unique identification for each sample. ```APIDOC ## Generate Compatible Barcode Collection ### Description Creates a collection of molecular barcodes with specified constraints for sample identification. Ensures compatibility and unique identification for each sample. ### Method `BarcodesCollection.from_specs(...)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **n_barcodes** (int) - The number of unique barcodes to generate. - **barcode_length** (int) - The length of each barcode sequence. - **spacer** (str) - The spacer sequence to be used. - **forbidden_enzymes** (tuple) - A tuple of enzyme names that should not be present in the barcodes. - **barcode_tmin** (int) - Minimum melting temperature for barcodes. - **barcode_tmax** (int) - Maximum melting temperature for barcodes. - **heterodim_tmax** (int) - Maximum melting temperature for heterodimers. - **max_homology_length** (int) - Maximum allowed homology length between barcodes. - **include_spacers** (bool) - Whether to include spacers in the generated barcodes. - **names_template** (str) - A template for naming the barcodes (e.g., "BC_%03d"). ### Request Example ```python from genedom import BarcodesCollection barcodes_collection = BarcodesCollection.from_specs( n_barcodes=96, barcode_length=20, spacer="AA", forbidden_enzymes=("BsaI", "BsmBI", "BbsI"), barcode_tmin=55, barcode_tmax=70, heterodim_tmax=5, max_homology_length=10, include_spacers=True, names_template="BC_%03d" ) barcodes_collection.to_fasta("barcodes.fa") print(f"First barcode: {barcodes_collection['BC_001']}") records = barcodes_collection.to_records(path="barcodes_genbank/") barcode_sequences = barcodes_collection.to_sequences_list() print(f"Generated {len(barcode_sequences)} compatible barcodes") ``` ### Response #### Success Response (200) - **barcodes_collection** (object) - A collection object containing the generated barcodes, with methods to export and access them. #### Response Example ```json { "barcodes_collection": { "BC_001": "GCTAGCTAGCTAGCTAGCAA", "BC_002": "ATGCATGCATGCATGCATGC", ... }, "fasta_file": "barcodes.fa", "genbank_records_path": "barcodes_genbank/" } ``` ``` -------------------------------- ### Custom PartDomesticator with Constraints (Python) Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Defines a `PartDomesticator` with custom sequence constraints (e.g., avoiding specific patterns, enforcing GC content) and objectives using DnaChisel. This allows for fine-tuned sequence optimization during domestication. Dependencies include 'genedom' and 'dnachisel'. ```python from genedom import PartDomesticator, random_dna_sequence, write_record from dnachisel import AvoidPattern, EnforceGCContent, Location # Define custom constraints def my_constraints(sequence): seq_length = len(sequence) return [ AvoidPattern("AAAAA"), # Avoid poly-A runs AvoidPattern("TTTT"), # Avoid poly-T runs EnforceGCContent( mini=0.4, maxi=0.6, location=Location(0, seq_length) ) ] # Create custom domesticator custom_domesticator = PartDomesticator( name="custom_domesticator", description="Domesticator with GC content control", left_flank="GAATTCGCGGCCGCTTCTAGAG", right_flank="ACTGCAGCTCGAG", constraints=[my_constraints], minimize_edits=True, simultaneous_mutations=2 ) # Generate test sequence sequence = random_dna_sequence(3000, seed=456) # Domesticate result = custom_domesticator.domesticate( dna_sequence=sequence, edit=True, report_target="optimization_report/" ) if result.success: print(f"Domestication successful!") print(f"Original length: {len(result.sequence_before)}bp") print(f"Final length: {len(result.record_after)}bp") print(f"Edits made: {result.number_of_edits()}bp") write_record(result.record_after, "custom_domesticated.gb") else: print(f"Failed: {result.message}") # Output: # Domestication successful! # Original length: 3000bp # Final length: 3045bp # Edits made: 23bp ``` -------------------------------- ### Domesticate and Save DNA Records Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Demonstrates the process of domesticating a GenBank record using GoldenGateDomesticator and saving the modified record in GenBank and FASTA formats. This involves initializing the domesticator with specific enzyme sites and then applying the domestication process to a given record. ```python from genedom import GoldenGateDomesticator from Bio.SeqIO import parse as read_record # Assuming genbank_record is loaded genbank_record = next(read_record("input.gb", "genbank")) domesticator = GoldenGateDomesticator("GGAG", "CGCT", enzyme="BsaI") result = domesticator.domesticate(genbank_record, edit=True) # Save in different formats from genedom import write_record write_record(result.record_after, "output.gb", fmt="genbank") write_record(result.record_after, "output.fa", fmt="fasta") # Example of printing processed sequence count (assuming all_records is defined elsewhere) # print(f"Loaded and domesticated {len(all_records)} sequences") ``` -------------------------------- ### Custom Golden Gate Standard from Spreadsheet (Python) Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Creates a custom Golden Gate assembly standard by parsing a spreadsheet (CSV) containing part specifications like overhangs, enzymes, and slot names. This custom standard can then be used with the `batch_domestication` function. Requires 'genedom' and 'pandas'. ```python from genedom import GoldenGateDomesticator, batch_domestication, load_records import pandas as pd # Create a custom standard spreadsheet standard_data = pd.DataFrame({ 'slot_name': ['Promoter', 'CDS', 'Terminator'], 'left_overhang': ['GGAG', 'TACT', 'GCTT'], 'right_overhang': ['TACT', 'GCTT', 'CGCT'], 'left_addition': ['', '', ''], 'right_addition': ['', '', ''], 'enzyme': ['BsaI', 'BsaI', 'BsaI'], 'extra_avoided_sites': ['BsmBI', 'BsmBI', 'BsmBI'], 'description': ['Promoter slot', 'CDS slot', 'Terminator slot'], 'is_cds': ['no', 'yes', 'no'] }) # Save to CSV standard_data.to_csv('my_standard.csv', index=False) # Load the standard my_standard = GoldenGateDomesticator.standard_from_spreadsheet( path='my_standard.csv', name_prefix='MyStd_' ) # Use with batch domestication records = load_records('parts/*.gb') batch_domestication( records=records, target='my_domestication.zip', standard=my_standard, allow_edits=True ) ``` -------------------------------- ### Generate Compatible Barcode Collection Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Creates a collection of unique molecular barcodes with specified compatibility constraints for sample identification. This function generates a set of barcodes with defined lengths, spacers, forbidden enzymes, and melting temperature ranges to ensure compatibility. It outputs the collection to a FASTA file, GenBank records, or a list of sequences. Requires the BarcodesCollection class. ```python from genedom import BarcodesCollection # Generate 96 unique barcodes with compatibility constraints barcodes_collection = BarcodesCollection.from_specs( n_barcodes=96, barcode_length=20, spacer="AA", forbidden_enzymes=("BsaI", "BsmBI", "BbsI"), barcode_tmin=55, # Minimum melting temperature barcode_tmax=70, # Maximum melting temperature heterodim_tmax=5, # Max heterodimer melting temp max_homology_length=10, # Max homology between barcodes include_spacers=True, names_template="BC_%03d" ) # Export to FASTA file barcodes_collection.to_fasta("barcodes.fa") # Access individual barcodes print(f"First barcode: {barcodes_collection['BC_001']}") # Output: First barcode: GCTAGCTAGCTAGCTAGCAA # Convert to GenBank records records = barcodes_collection.to_records(path="barcodes_genbank/") # Get as list of sequences barcode_sequences = barcodes_collection.to_sequences_list() print(f"Generated {len(barcode_sequences)} compatible barcodes") # Output: Generated 96 compatible barcodes ``` -------------------------------- ### Protein Sequence Domestication with Codon Optimization Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Domesticates a protein-coding sequence with species-specific codon optimization. This is useful for ensuring efficient protein expression in a target organism. ```APIDOC ## Protein Sequence Domestication with Codon Optimization ### Description Domesticates a protein-coding sequence with species-specific codon optimization. This is useful for ensuring efficient protein expression in a target organism. ### Method `GoldenGateDomesticator.domesticate(protein_sequence, codon_optimization, edit=True)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **protein_sequence** (str) - The protein sequence to domesticate. - **codon_optimization** (str) - The target organism for codon optimization (e.g., 'e_coli'). - **edit** (bool) - If True, allows sequence modifications. Defaults to False. ### Request Example ```python from genedom import GoldenGateDomesticator, write_record protein_sequence = "MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKQHDFFKSAMPEGYVQERTIFFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYIMADKQKNGIKVNFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK" domesticator = GoldenGateDomesticator( left_overhang="GGAG", right_overhang="CGCT", enzyme='BsaI' ) domestication_results = domesticator.domesticate( protein_sequence=protein_sequence, codon_optimization='e_coli', edit=True ) if domestication_results.success: print(f"Successfully domesticated {len(domestication_results.record_after)}bp sequence") print(f"Made {domestication_results.number_of_edits()} synonymous mutations") write_record(domestication_results.record_after, "gfp_domesticated.gb") else: print(f"Domestication failed: {domestication_results.message}") ``` ### Response #### Success Response (200) - **domestication_results** (object) - An object containing the results of the domestication process, including success status, message, and sequence records. #### Response Example ```json { "success": true, "message": "Domestication successful.", "record_after": "[GenBank record object]", "number_of_edits": 142 } ``` ``` -------------------------------- ### Domesticate Protein Sequence with Codon Optimization using GoldenGateDomesticator Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Domesticates a protein-coding sequence with species-specific codon optimization. This function takes a protein sequence and a target organism for codon optimization as input. It returns a domestication results object, indicating success, the number of synonymous mutations, and the domesticated sequence in GenBank format. Requires the GoldenGateDomesticator class, specifying overhangs and enzyme. ```python from genedom import GoldenGateDomesticator, write_record # Example protein sequence protein_sequence = "MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKQHDFFKSAMPEGYVQERTIFFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYIMADKQKNGIKVNFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK" # Create domesticator domesticator = GoldenGateDomesticator( left_overhang="GGAG", right_overhang="CGCT", enzyme='BsaI' ) # Domesticate with codon optimization for E. coli # is_cds is automatically set to True when protein_sequence is provided domestication_results = domesticator.domesticate( protein_sequence=protein_sequence, codon_optimization='e_coli', edit=True ) if domestication_results.success: print(f"Successfully domesticated {len(domestication_results.record_after)}bp sequence") print(f"Made {domestication_results.number_of_edits()} synonymous mutations") write_record(domestication_results.record_after, "gfp_domesticated.gb") else: print(f"Domestication failed: {domestication_results.message}") # Output: # Successfully domesticated 750bp sequence # Made 142 synonymous mutations ``` -------------------------------- ### Domesticate Single DNA Sequence with GoldenGateDomesticator Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Domesticates a single DNA sequence by adding Golden Gate assembly overhangs and removing specified restriction sites. This function takes a DNA sequence as input and returns a domestication results object containing the modified sequence, a summary of changes, and a record of edits. It utilizes the GoldenGateDomesticator class, which requires overhang sequences and optionally an enzyme type. ```python from genedom import GoldenGateDomesticator, random_dna_sequence, write_record # Generate a random DNA sequence for demonstration sequence = random_dna_sequence(5000, seed=123) # Create a Golden Gate domesticator with specific overhangs # Enzyme defaults to BsmBI if not specified domesticator = GoldenGateDomesticator( left_overhang="ATTC", right_overhang="ATCG", enzyme='BsmBI' ) # Domesticate the sequence (edit=True allows sequence modifications) domestication_results = domesticator.domesticate(sequence, edit=True) # Print summary of changes made print(domestication_results.summary()) # Output: # SUCCESS - Constraints evaluations: 2, Optimizations: 1 # BEFORE: Length: 5000bp, Forbidden sites: 3 # AFTER: Length: 5030bp, Forbidden sites: 0, Edits: 6 bp changed # Write the domesticated sequence to GenBank file write_record(domestication_results.record_after, "domesticated.gb") # Write a GenBank file showing only the edits made write_record(domestication_results.edits_record, "edits.gb") ``` -------------------------------- ### Simple Part Domestication with GoldenGateDomesticator Source: https://context7.com/edinburgh-genome-foundry/genedom/llms.txt Domesticates a single DNA sequence by adding Golden Gate assembly overhangs and removing restriction sites. This method allows for direct sequence modification. ```APIDOC ## Simple Part Domestication with GoldenGateDomesticator ### Description Domesticates a single DNA sequence by adding Golden Gate assembly overhangs and removing restriction sites. This method allows for direct sequence modification. ### Method `GoldenGateDomesticator.domesticate(sequence, edit=True)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **sequence** (str) - The DNA sequence to domesticate. - **edit** (bool) - If True, allows sequence modifications. Defaults to False. ### Request Example ```python from genedom import GoldenGateDomesticator, random_dna_sequence, write_record sequence = random_dna_sequence(5000, seed=123) domesticator = GoldenGateDomesticator( left_overhang="ATTC", right_overhang="ATCG", enzyme='BsmBI' ) domestication_results = domesticator.domesticate(sequence, edit=True) print(domestication_results.summary()) write_record(domestication_results.record_after, "domesticated.gb") ``` ### Response #### Success Response (200) - **domestication_results** (object) - An object containing the results of the domestication process, including summary, sequence before/after, and edits. #### Response Example ```json { "summary": "SUCCESS - Constraints evaluations: 2, Optimizations: 1\nBEFORE: Length: 5000bp, Forbidden sites: 3\nAFTER: Length: 5030bp, Forbidden sites: 0, Edits: 6 bp changed", "record_after": "[GenBank record object]", "edits_record": "[GenBank record object for edits]" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.