Design module

Cloning module

Module used for cloning of microbial strains.

constrain.design.cloning.CAS9_cutting(gRNA_record, background_record)[source]

Simulates double-stranded-break by CAS9 given a gRNA.

Parameters:
  • gRNA_record (pydna.dseqrecord.) – A 20 bp DNA sequence

  • background_record (pydna.dseqrecord.) – The sequence of interest for CRISPR mediated DSB

Returns:

  • 1.pydna.dseqrecord. – Sequence upstream of the DSB: pydna.dseqrecord.

  • 2. pydna.dseqrecord. – Sequence downstream of the DSB: pydna.dseqrecord.

constrain.design.cloning.CRIPSR_knockout(gRNA_record, insertion_site, repair_DNA)[source]
Simple version of casembler - Cuts the insertion site with

CAS9_cutting and assembles knockout with a repair template.

Parameters:
  • gRNA_record (pydna.dseqrecord.) – A 20 bp DNA sequence

  • insertion_site (pydna.dseqrecord.) – The site to knock out

  • repair_DNA (pydna.dseqrecord.) – Repair template. Typucally 90 bp or longer

Returns:

Of assembled contig after CRISPR-mediated KO

Return type:

pydna.dseqrecord.

constrain.design.cloning.UPandDW(strain, isite_name, path_to_gRNA_table='../data/raw/gRNAtable.csv')[source]

Finds upstream and downstream sequences based on genome and site name.

Parameters:
  • strain (str) – name of the strain eg. CENPK113-7d (you should specify path to the chromosome)

  • isite_name (str) – a string of the site chomosomal site you want to retrieve

Returns:

  • UP_sites (list) – list of pydna.dseqrecord or pydna.amplicon.Amplicon

  • DW_sites (list) – list of pydna.dseqrecord or pydna.amplicon.Amplicon

constrain.design.cloning.USER_enzyme(amplicon)[source]

Simulates digestion with USER enzyme.

Parameters:

amplicon (pydna.amplicon.Amplicon) – An pydna.amplicon.Amplicon to with Uracil integrated

Returns:

USER digested Dseqrecord with USER tails

Return type:

Dseqrecord

constrain.design.cloning.casembler(bg_strain, site_names=None, gRNAs=None, parts=None, assembly_limits=None, assembly_names=None, verbose=False, to_benchling=False)[source]

Simulate in vivo assembly and integration with the possibility of printing to gb files or send it directly to benchling.

Parameters:
  • bg_strain (GenBank) – strain of choice eg. genbank file

  • site_names (list) – list of names e.g. [X-3, XI-3]

  • gRNAs (Seqrecords) – list of 20 bp seqrecords e.g. [ATF1_gRNA, CroCPR_gRNA]

  • parts (list) – list of list of parts e.g. [[ATF1_repair_template],[CPR_repair_template]]

  • assembly_limits (list) – list of numbers of bp assembly limits e.g. [200,400]

  • assembly_names (list) – list of names of DNA post assembly e.g.[“X_3_tADH1_P2_pPGK1”, “XI_3_UP_DW”]

  • verbose (bool) – write DNA e.g. False

  • to_benchling (bool) – upload DNA to benchling e.g. False

Returns:

of assembled contig

Return type:

One dseqrecord

constrain.design.cloning.extract_gRNAs(template, name)[source]

Extracts gRNAs from a template.

Parameters:
  • template (pydna.dseqrecord or pydna.amplicon.Amplicon) – a plasmid or piece of DNA

  • name (str) – a string that would include the feature name for example: gRNA

Returns:

list of with the found features and their sequences

Return type:

list of pydna.dseqrecord or pydna.amplicon.Amplicon

constrain.design.cloning.extract_sites(annotations, templates, names)[source]

This function extracts the sequences from annotated sequences based on their names

Parameters:
  • annotations (list) – list of annotations for sequences that will be extracted

  • templates (list of Bio.SeqRecord.SeqRecord) – A list of Bio.SeqRecord.SeqRecord with SeqFeatures

  • names (str) – name of the sequence that will be extracted

Returns:

record – list of extracted sites

Return type:

list of Bio.SeqRecord.SeqRecord

constrain.design.cloning.extract_template_amplification_sites(templates, names, terminator)[source]

Extracts amplifications sites from a templates features

Parameters:
  • templates (list of Bio.SeqRecord.SeqRecord) – list of Bio.SeqRecord.SeqRecord objects with SeqFeatures

  • names (list of strings) – list of strings to be extracted

  • terminator (str) – a string with the name of upstream terminator

Returns:

record – list of extracted elements

Return type:

list of Bio.SeqRecord.SeqRecord

constrain.design.cloning.multiply_list(myList)[source]

Multiplies elements one by one.

Parameters:

myList (list) – list of integers to be multiplied

Returns:

result

Return type:

int

constrain.design.cloning.nicking_enzyme(vector)[source]

Nt.Bbc.CI (nicking enzyme, Nicks) a vector with the sequence ‘CGCGTG’ on watson and ‘CGCACG’ on crick strand. :param vector: digested Dseqrecord - usually with AsiSI or similar overhang :type vector: Dseq

Return type:

Dseq with nick - ready for USER cloning

constrain.design.cloning.plate_plot(df, value)[source]

Plots a 96 well plate as a pandas df.

Parameters:
  • df (pd.Dataframe) – A pandas dataframe with

  • value (pandas dataframe column name) – The name of the pandas dataframe coloumn that you want to display

Returns:

in a 96 well plate format of the chosen column

Return type:

pd.Dataframe

Example

1. Initialize: Amplicon_df = {

name location template_name fw_name fw_location rv_name rv_location prow pcol

29 PCR_G8H_01 l5_A03 VminG8H_tADH1 PR_G8H_01 op4_A10 PR_G8H_02 op4_A01 A 1 25 PCR_G8H_05 l5_A07 SmusG8H_tADH1 PR_G8H_01 op4_A10 PR_G8H_06 op4_A02 A 2 21 PCR_G8H_09 l5_B02 RsepG8H_tADH1 PR_G8H_01 op4_A10 PR_G8H_10 op4_A03 A 3 17 PCR_G8H_13 l5_B06 CacuG8H_tADH1 PR_G8H_01 op4_A10 PR_G8H_14 op4_A04 A 4 13 PCR_G8H_17 l5_C01 OpumG8H_tADH1 PR_G8H_01 op4_A10 PR_G8H_18 op4_A05 A 5 }

2. Call the function: # here we call the name coloumn plate_plot(amplicon_df, ‘name’)

<<Result: name pcol 1 2 3 4 5 6 7 8 9 10 11 12 prow A PCR_G8H_01 PCR_G8H_05 PCR_G8H_09 PCR_G8H_13 PCR_G8H_17 PCR_G8H_21 PCR_G8H_25 PCR_G8H_29 PCR_G8H_33 PCR_UP_tADH1_01 PCR_PRO_01 NaN1 B PCR_G8H_02 PCR_G8H_06 PCR_G8H_10 PCR_G8H_14 PCR_G8H_18 PCR_G8H_22 PCR_G8H_26 PCR_G8H_30 PCR_G8H_34 PCR_TRP1-DW_02 PCR_PRO_02 NaN2 C PCR_G8H_03 PCR_G8H_07 PCR_G8H_11 PCR_G8H_15 PCR_G8H_19 PCR_G8H_23 PCR_G8H_27 PCR_G8H_31 PCR_G8H_35 PCR_TRP1-DW_01 PCR_PRO_03 NaN3 D PCR_G8H_04 PCR_G8H_08 PCR_G8H_12 PCR_G8H_16 PCR_G8H_20 PCR_G8H_24 PCR_G8H_28 PCR_G8H_32 PCR_G8H_36 NaN4 PCR_PRO_04 NaN5 E PCR_CPR_01 PCR_CPR_10 PCR_CPR_03 PCR_CPR_09 PCR_CPR_02 PCR_CPR_06 PCR_CPR_07 PCR_CPR_08 PCR_CPR_04 PCR_CPR_05 PCR_PRO_05 NaN6 F PCR_CPR_11 PCR_CPR_20 PCR_CPR_13 PCR_CPR_19 PCR_CPR_12 PCR_CPR_16 PCR_CPR_17 PCR_CPR_18 PCR_CPR_14 PCR_CPR_15 PCR_PRO_06 NaN7 G PCR_CPR_21 PCR_CPR_30 PCR_CPR_23 PCR_CPR_29 PCR_CPR_22 PCR_CPR_26 PCR_CPR_27 PCR_CPR_28 PCR_CPR_24 PCR_CPR_25 PCR_PRO_07 NaN8 H PCR_CPR_31 PCR_CPR_40 PCR_CPR_33 PCR_CPR_39 PCR_CPR_32 PCR_CPR_36 PCR_CPR_37 PCR_CPR_38 PCR_CPR_34 PCR_CPR_35 PCR_PRO_08 NaN9

constrain.design.cloning.recs_no_duplicates(recs_with_duplicates: list) list[source]

Removes duplicate sequences from a list.

Parameters:

recs_with_duplicates (list) – list with duplicated elements

Returns:

without duplicates

Return type:

list

constrain.design.cloning.recs_no_duplicates_names(recs_with_duplicates)[source]

Removes duplicate names from a list

Parameters:

recs_with_duplicates (list) – list with duplicated elements

Returns:

without duplicates

Return type:

list

constrain.design.cloning.remove_features_with_negative_loc(record)[source]

Removes a SeqFeatures if negative.

Parameters:

record (pydna.amplicon.Amplicon.) – A amplicon with SeqFeature and locations

Returns:

record – With the negative features deleted

Return type:

pydna.amplicon.Amplicon.

constrain.design.cloning.remove_tuple_duplicates(lst: list) list[source]

Removes tuple duplicates

Parameters:

lst (list) – list with duplicated elements

Returns:

without duplicates

Return type:

list

constrain.design.cloning.seq_to_annotation(seqrec_from, seqrec_onto, aType)[source]

Anotate an amplicon object from another amplicon object.

Parameters:
  • seqrec_from (str) – annotation sequence that will be extracted

  • seqrec_onto (list of Bio.SeqRecord.SeqRecord) – A list of Bio.SeqRecord.SeqRecord with SeqFeatures

  • aType (str) – name of the sequence that will be extracted

Returns:

record – list of extracted sites

Return type:

list of Bio.SeqRecord.SeqRecord

Combinatorial library module

This part of the design module is used for making combinatorial libraries from DNA fragments.

class constrain.design.combinatorial_design.DesignAssembly(list_of_seqs: list, list_of_names: list, pad: str, position_of_pad: int, target_tm=56.0, limit=13, overlap=35)[source]

Bases: object

Class able to make a combinatorial library from DNA fragments.

Parameters:
  • list_of_seqs (list) – A list of list of a constructs of choice.

  • list_of_names (list) – A list of list of the names wanted for the construct of choice.

  • pad (pydna.Dseqrecord) – A nucleotide sequence to be incorporated into the primers (Max is 40 bp)

  • position_of_pad (int) – the position in the list of seqs where the pad is incorporated (zero indexed)

Returns:

A powerfull class and a lot of information can be retrieved. Such as: showing all the amplicons needed to construct a combinatorial library with the simple method –> PCR_list_to_dataframe or Primer_list_to_dataframe.

Return type:

constrain.design.combinatorial_design.DesignAssembly object

PCR_list()[source]

Returns a PCR_list

PCR_list_to_dataframe()[source]

Prints PCR_list into a pandas dataframe

ShowContigs()[source]

Returns a string of the contigs generated by the assembly

ShowVariantsLibDF()[source]

Returns a dataframe of all the variants

graphical_representation_of_assemblies()[source]

Takes in the assembly object and returns graphical report of the fragments assembled

primer_list()[source]

Return the list of transfers in human-readable format.

primer_list_to_dataframe()[source]

Return a pandas dataframe with list of primers.

print_PCR_list()[source]

Prints PCR_list

print_primer_list()[source]

Return the list of transfers in human-readable format.

constrain.design.combinatorial_design.assembly_maker(combinatorial_list_of_amplicons: list, overlap=35)[source]

Assembles Amplicons with pad and makes new overlapping primers. :param combinatorial_list_of_amplicons: the list of pydna.amplicon.Amplicon that you want generate

overlapping primers for.

Parameters:

overlap (int = 35) – How many basepair overlaps

Returns:

List_of_assemblies – amplicons that overlaps eachother with the specified overlap value.

Return type:

list[[pydna.amplicon.Amplicon]]

constrain.design.combinatorial_design.combinatorial_list_maker(listOflist_that_is_being_made_into_all_combinations: list) list[source]

Makes all possible combinations from a list of list.

Parameters:

listOflist_that_is_being_made_into_all_combinations (list[list[any_type]]) – can be of any type inside the list of lists

Returns:

combinations – all possible combinations of the list of lists

Return type:

list[tuple(any_type)]

constrain.design.combinatorial_design.count_unique_parts(df, max_combinations: int)[source]

Iterate through the list of predictions and save new encountered parts.

Parameters:
  • df (pd.DataFrame) – Dataframe containing predictions

  • Returns

  • --------

  • parts_encounteres (dict) – A dictionary containing the unique parts encountered in ‘G8H’,’pG8H’, ‘pCPR’, ‘CPR’ columns, total number of unique combinations encountered in ‘Sum of parts’ and total predictions encountered in ‘Predictions’

constrain.design.combinatorial_design.empty_list_maker(list_of_sequences: list)[source]

returns empty list in the length of seqs

Parameters:

list_of_sequences (list) – could be any list with any types

Returns:

EmptyList – an empty list with the same dimensions

Return type:

list

constrain.design.combinatorial_design.get_primers(List_of_assemblies: list, combinatorial_list_of_names: list, combinatorial_list_of_primer_tm: list)[source]

Returns a list of ALL primers from the combinatorial library, updates names and what they anneal to.

Parameters:
  • List_of_assemblies (list[list[pydna.amplicon.Amplicon]]) –

  • combinatorial_list_of_names (list[(str)]) –

  • combinatorial_list_of_primer_tm (list[(float, float),..)...]) –

Returns:

primers – All primers that have been made for all assemblies

Return type:

list[list[[pydna.primer.Primer, pydna.primer.Primer]]

constrain.design.combinatorial_design.making_assembled_contigs(list_of_assembly_objects: list)[source]

Assembles a list of assembly object into linear contigs.

Parameters:

list_of_assembly_objects (list[pydna.assembly.Assembly]) – these objects can be assembled into contigs

Returns:

list_of_assembly_objects – list_of_assembly_objects have been assembled into contigs

Return type:

list[]

constrain.design.combinatorial_design.making_assembly_objects(list_of_assemblies: list)[source]

Assembling amplicons into assembling class that shows fragments, limit,nodes and which algorithm that was used for assembling.

Parameters:

list_of_assemblies (list[[pydna.amplicon.Amplicon]]) – list of the combinatorial libarary with overlapping ends

Returns:

list_of_assembly_objects – shows which algorithm that was used, nodes, limit and fragments

Return type:

list[pydna.assembly.Assembly]

constrain.design.combinatorial_design.simple_amplicon_maker(list_of_seqs: list, list_of_names: list, target_tm=56.0, limit=13)[source]

Creates amplicons, updates their names

Parameters:
  • list_of_seqs (list[list[pydna.dseqrecord.Dseqrecord]]) – List of the pydna.dseqrecord import Dseqrecord elements u want to made into amplicons

  • list_of_names (list[list[str]]) – provide names for the sequences since pydna changes their names to amplicon

Returns:

  • list_of_amplicons (list[pydna.amplicon.Amplicon]) – list with the pydna.amplicon.Amplicon objects that have been made

  • list_of_amplicon_primers (list[list[(pydna.seq.Seq, pydna.seq.Seq)]]) – a list of all the generated primers in tuples where index0 = forward primer and index1=reverse primer. Both are pydna.seq.Seq objects

  • list_of_amplicon_primer_temps (list[list[(float, float)]]) – a list of melting temperatures in tuples where index0 = forward primer melting temp and index1=reverse primer melting temp.

constrain.design.combinatorial_design.systematic_names_function(List_of_list_parts: list) list[source]

Returns a list of list with systematic names i.e [1,1,1], [1,2,1]… etc

Parameters:

List_of_list_parts (list of list) – can have anny type withing the list[list[any_type]]

Returns:

list of tuples with the systematic names eg. [(1,1,1),(1,2,1)]

Return type:

combinatorial_list_of_indexes

constrain.design.combinatorial_design.unique_amplicons(list_of_assemblies: list)[source]

Finds Unique amplicons from a list of assemblies :param list_of_assemblies: list of the combinatorial libarary with overlapping ends :type list_of_assemblies: list[[pydna.amplicon.Amplicon]]

Returns:

unique_amplicons – returns a list of unique amplicons where relavant metrics are added to the objects.

Return type:

list[pydna.amplicon.Amplicon]

constrain.design.combinatorial_design.unique_primers(primers: list, list_of_assemblies)[source]

Finds unique primers from a list of assemblies :param primers: a list of all the primers made for the combinatorial library :type primers: list[list[[pydna.primer.Primer, pydna.primer.Primer]] :param list_of_assemblies: used here to update the names of the primers :type list_of_assemblies: list[[pydna.amplicon.Amplicon]]

Returns:

unique_primers – Relevant metrics for the unique primers of the combinatorial library.

Return type:

list[list(ID,Anneals_to,Sequence,Annealing_temp,Length,Price(DKK))]