text:
ÁªÏµ·½Ê½

• QQ£º99515681
• ÓÊÏä£º99515681@qq.com
• ¹¤×÷Ê±¼ä£º8:00-23:00
• Î¢ÐÅ£ºcodinghelp2

Äúµ±Ç°Î»ÖÃ£ºÊ×Ò³ >> CS×÷ÒµCS×÷Òµ

ÈÕÆÚ£º2021-02-16 11:35

THE UNIVERSITY OF AUCKLAND

SECOND SEMESTER, 2020

Campus: City

COMPUTER SCIENCE

An Introduction to Practical Computing

(Time Allowed: TWO hours)

NOTE:

Calculators are NOT permitted.

There is space at the back for answers that overflow the allotted space.

Surname Model

Preferred Name

Student ID

Question Mark Out Of

1 - 10 Short Answers 30

11 Programming using Python 15

13 HTML5/CSS 20

14 LaTeX 20

TOTAL 100

ID ¡¡¡.¡¡¡¡

Page 2 of 21

Answer all questions in this section in the space provided. If you run out of space, please use

the Overflow Sheet and indicate in the allotted space that you have used the Overflow Sheet.

1. Artificial Intelligence (3 marks)

What argument is Searle making in his Chinese Room discussion about the nature of

intelligence and how it applies to Artificial Intelligence programs?

Searle is making the argument that simple symbol manipulation, e.g.

looking up a symbol in a table and copying over its entry, such as is

done in the Chinese Room discussion, does not represent understanding

the meaning of the symbol. Searle¡¯s argument is that this is what AI

programs do. The crux of the argument is to counter Turing¡¯s position

that if that we need to look at the entity as a black box and if its

performance seems intelligent, that for our purposes, we can call it

intelligent. However, Searle is saying that we cannot simply go by its

performance, we have to go inside the black box and see if its

performance goes beyond mere syntactic symbol manipulation.

(3 marks)

2. Software Licences (3 marks)

What is the main difference between software that is freeware and open source software?

The main difference between freeware and open source software is

that freeware¡¯s source code is proprietary and not publicly available

whereas open source software¡¯s source code is publicly available and

can be used to create new software.

(3 marks)

ID ¡¡¡.¡¡¡¡

Page 3 of 21

3. Digital Games (3 marks)

Give an example of a stochastic board game and of a non-stochastic board game, and

discuss how they exemplify their type of board game.

An example of a stochastic board game is stratego and an example of a

non-stochastic board game is chess. In non-stochastic board games, all

board information is known by both players and the immediate result

of an action can be correctly predicted by both players. In stochastic

board games, some board information is not known by both players and

this usually means that the immediate result of an action cannot be

correctly predicted by both players.

In stratego, there is some board information that is only known by one

player, e.g., the identity of his pieces when they have not attacked or

been attacked, while there is also information that is known to both,

e.g., the location and ownership of pieces. This means that an attacker

does not always know what the outcome of an attack will be before he

executes the attack.

In chess, all board information is known by both players, so each player

knows exactly the immediate result of their action, e.g., if they move a

piece to a specific location containing an enemy piece, then they

capture that piece.

3 marks)

4. Computer Hardware (3 marks)

Which component within a computer (desktop or laptop) are almost all of the computer¡¯s

other components connected to? Describe this component¡¯s purpose.

The Motherboard. It provides communication between the computer¡¯s

components.

(3 marks)

ID ¡¡¡.¡¡¡¡

Page 4 of 21

5. History of Computing (3 marks)

Describe the roles of the four people involved in preparing scientific tables before the

Two computers who do the calculations, one comparator who checks

their results agree and a printer who prints the results.

(3 marks)

6. Computer Networks (3 marks)

Describe the difference between circuit switching and packet switching on a network.

In circuit switching the nodes/computers are directly connected endto-end,

and data is sent along this connection. In packet switching, the

data is broken into packets that are routed independently across the

network.

(3 marks)

ID ¡¡¡.¡¡¡¡

Page 5 of 21

7. WWW (3 marks)

On the WWW, what is the difference between the HTTP and HTTPS protocols?

HTTPS encrypts an HTTP connection using TLS (Transport Layer

Security). HTTP is unecrypted.

(3 marks)

8. Malware (3 marks)

What is the difference between a computer virus and a computer worm?

A virus needs a host program to spread it. A worm can spread itself.

(3 marks)

ID ¡¡¡.¡¡¡¡

Page 6 of 21

9. Bits and Bytes (3 marks)

How much memory would be required to represent 248 different values?

1 byte (8 bits)

(3 marks)

10. Digital Images (3 marks)

How much memory would be required to store a 32-colour bitmap image that is 100

pixels wide and is 16 pixels high? Show all your working.

32 colours requires 5 bits per pixel (2 ^ 5 = 32)

Number of pixels = 100 * 16

= 1600 pixels

Number of bits required = 5 * 1600

= 8000 bits ( 1000 bytes)

(3 marks)

ID ¡¡¡.¡¡¡¡

Page 7 of 21

SECTION B

Answer all questions in this section in the space provided. If you run out of space, please use

the Overflow Sheet and indicate in the allotted space that you have used the Overflow Sheet.

11. Programming Using Python (15 marks)

(a) The following exponential function can be used to predict the spread of flu-like

diseases:

???????????????????????? ???????? ???????????????????? = 2(?????1)

where d is the day number. The value for Day 0 is defined to be 1.

Write a Python program that calculates and displays the number of flu infections after

a certain number of days. The number of days to predict is entered by the user. You

can assume that the user will always enter an integer value greater than or equal to 1.

Here are two examples of the program running with different values entered by the user.

User input is indicated in the examples with bold and italicized font.

Example 1:

Enter the number of days to predict: 5

The number of cases at day 1 is 1

The number of cases at day 2 is 2

The number of cases at day 3 is 4

The number of cases at day 4 is 8

The number of cases at day 5 is 16

Example 2:

Enter the number of days to predict: 1

The number of cases at day 1 is 1

days = int(input("Enter the number of days to predict: "))

day = 1

while day <= days:

cases = 2 ** (day - 1)

print("The number of cases at day ", day, "is", cases)

day = day + 1

(5 marks)

ID ¡¡¡.¡¡¡¡

Page 8 of 21

(b) Write a piece of code that prints the visibility rating for the visibility distance entered

by the user at the prompt "Enter the Visibility Distance: ". Use the table

below to determine the visibility rating. You can assume that the user will always

enter a floating-point number (i.e. a float). Two examples are given below.

Visibility Rating Visibility Distance

Good > 6

Fair 3 ¨C 6 (including 3 and 6)

Poor 1 ¨C 3 (including 1 but not 3)

Fog < 1

Example 1:

Enter the Visibility Distance: 0.2

Example 2:

Enter the Visibility Distance: 6.0

distance = float(input("Enter the Visibility Distance: "))

if distance > 6:

visibility = "Good"

elif distance >= 3:

visibility = "Fair"

elif distance >= 1:

visibility = "Poor"

else:

visibility = "Fog"

(5 marks)

ID ¡¡¡.¡¡¡¡

Page 9 of 21

(c) In the box below, complete the code that will make the following picture. Assume

that the turtle begins in the middle of the window facing right and that the window is

approximately 500 steps wide. NOTE: You must use a while loop.

import turtle

steps = 100

angle1 = 45

angle2 = 90

number_of_repetitions = 10

step_increment = 10

repeat_number = 0

while repeat_number < number_of_repetitions:

turtle.forward(steps)

turtle.left(angle1)

turtle.forward(steps)

turtle.left(angle1)

turtle.forward(steps)

turtle.left(angle2)

repeat_number = repeat_number + 1

steps = steps + step_increment

(5 marks)

ID ¡¡¡.¡¡¡¡

Page 10 of 21

week.

(a) Columns C to G of Rows 4 to 10 contain information about the lunch that the person

had on the day specified in Column B. What is the best formula to use in Cell E4 to

find the total number of calories the person consumed for lunch on the day specified

in Cell B4? The calorie table is located in Cells C17 : D23. Your answer must use a

VLOOKUP function.

Note: Your formula must be able to be filled down from E4 to E10 correctly.

=VLOOKUP(C4,$C$17:$D$23,2,FALSE)*D4

(6 marks)

ID ¡¡¡.¡¡¡¡

Page 11 of 21

(b) Cell G4 indicates the number of calories consumed for lunch on the day specified in

Cell B4 that are under or over the goal number of calories specified in Cell E14.

What is the best formula to use in Cell G4?

Note: Your formula must be able to be filled down from G4 to G10 correctly.

= E4 - $E$14

(2 marks)

(c) Cell E11 shows the total number of calories consumed for lunch for the week. What

is the best formula to use in Cell E11?

= SUM(E4:E10)

(2 marks)

(d) Cell E13 shows the average (mean) number of calories consumed for lunch each day.

What is the best formula to use in Cell E13?

= AVERAGE(E4:E10)

(2 marks)

(e) Cell G13 indicates whether the average number of calories in Cell E13 is under or

over the goal number of calories specified in Cell E14. If the average is less than the

goal value, G13 should show ¡°Under¡±. If the average is higher than the goal, then

Cell G13 should show ¡°Over¡±. If the average is equal to the goal then Cell G13 is left

blank. What is the best formula to use in Cell G13?

Note: Your formula must use an IF function.

=IF(E13<E14,"Under",IF(E13>E14,"Over",""))

(3 marks)

ID ¡¡¡.¡¡¡¡

Page 12 of 21

Question 13. HTML5 and CSS (20 marks)

The following screenshot shows the body of a web page created using HTML5 and CSS:

Complete the HTML5 code on the following pages so that it produces the output shown

above.

You must use the styles defined in the internal style sheet in the head section on the

following page, and must not define any new styles.

Note:

(1) The URL for the University of Auckland Online Learning Resources is:

¡°https://www.online.auckland.ac.nz/¡±.

(2) The image is stored in a file called "AucklandOnlineImage.png" in the same

folder as the HTML file.

(3) There are two sections (the ¡°Statistics¡± section and the ¡°Slang Glossary¡± section).

ID ¡¡¡.¡¡¡¡

Page 13 of 21

<!DOCTYPE html>

<html lang="en">

<meta charset="UTF-8">

<title>HTML/CSS Exam Question</title>

<style>

body {background-color: pink;

font-family: "Arial", "Calibri", Sans-Serif}

h1 {background-color:rgb(0,0,0); color:#E6FFE6;

text-transform:uppercase; text-align:center}

h2 {background-color:rgb(0,0,0); color:#E6FFE6;

font-variant:small-caps}

table, tr, td { border: 2px solid black;}

#emphasis{font-size:large; color:red}

#center {text-align:center}

font-weight:bold; text-align:center}

.glossary{font-style:italic; font-weight:bold}

.stat{text-align:right; font-weight:bold}

</style>

<body>

(1 mark)

<!-- Image -->

(2 marks)

<!-- First Paragraph -->

(2 marks)

ID ¡¡¡.¡¡¡¡

Page 14 of 21

<!-- "Student Statistics" Section -->

(7 marks)

ID ¡¡¡.¡¡¡¡

Page 15 of 21

<!-- "Slang Glossary" Section -->

(8 marks)

</body>

</html>

ID ¡¡¡.¡¡¡¡

Page 16 of 21

14. LaTeX (20 marks)

On the following pages, complete the LaTeX code that will produce the output below:

The image is stored in a file called Covid.png and is in the same folder as the LaTeX

code. When inserted into the document, the image should be centred and 6 cm wide.

The following LaTeX commands have been included as a reference. You will not need to

use all of these commands.

ID ¡¡¡.¡¡¡¡

Page 17 of 21

Normal commands Environments Math mode commands

\usepackage{graphicx}

\section{}

\subsection{}

\title{}

\author{}

\date{}

\maketitle

\item

\textbf{}

\emph{}

\includegraphics{}

\footnote{}

itemize

enumerate

verbatim

flushright

center

quote

displaymath

equation

quotation

\$

\sqrt{}

\frac{}{}

\leq

\sum_{}^{}

\infty

\sigma

^

_

\left(

\right)

(20 marks)

\documentclass[a4paper]{article}

\begin{document}

ID ¡¡¡.¡¡¡¡

Page 18 of 21

- Overflow Sheet 1 -

Write the question number and letter next to your answer. You must ALSO indicate in

the allotted space that you have used the overflow sheet.

ID ¡¡¡.¡¡¡¡

Page 19 of 21

- Overflow Sheet 2 -

Write the question number and letter next to your answer. You must ALSO indicate in

the allotted space that you have used the overflow sheet.

ID ¡¡¡.¡¡¡¡

Page 20 of 21

ID ¡¡¡.¡¡¡¡

Page 21 of 21

________________________________________


text:
Calculate the resistance per meter

by looi76
Tags: meter, resistance
 P: 81 1. The problem statement, all variables and given/known data Calculate the resistance per meter at room temperature of a constant wire if diameter $$1.25mm$$. The resistivity of constant a at room temperature is $$5x10^-7\Omega{m}$$ 2. Relevant equations I'm not sure, but I think this is the right formula: $$R = \frac{Pl}{A}$$ 3. The attempt at a solution $$Area = \pi \times \left(\frac{1.25 \times 10^{-3}}{2}\right)^2$$ $$A = 1.2 \times 10^{-6} m^2$$ What is Pl?
 P: 13 P is the resistivity and L is the length of the wire, so you are really solving for R/L

 Related Discussions General Physics 9 Introductory Physics Homework 1 Engineering, Comp Sci, & Technology Homework 4 Classical Physics 1 Electrical Engineering 20

format: plain


text:
# 14.1 Mutual inductance

 Page 1 / 5
By the end of this section, you will be able to:
• Correlate two nearby circuits that carry time-varying currents with the emf induced in each circuit
• Describe examples in which mutual inductance may or may not be desirable

Inductance is the property of a device that tells us how effectively it induces an emf in another device. In other words, it is a physical quantity that expresses the effectiveness of a given device.

When two circuits carrying time-varying currents are close to one another, the magnetic flux through each circuit varies because of the changing current I in the other circuit. Consequently, an emf is induced in each circuit by the changing current in the other. This type of emf is therefore called a mutually induced emf , and the phenomenon that occurs is known as mutual inductance ( M ) . As an example, let’s consider two tightly wound coils ( [link] ). Coils 1 and 2 have ${N}_{1}$ and ${N}_{2}$ turns and carry currents ${I}_{1}$ and ${I}_{2},$ respectively. The flux through a single turn of coil 2 produced by the magnetic field of the current in coil 1 is ${\text{Φ}}_{21},$ whereas the flux through a single turn of coil 1 due to the magnetic field of ${I}_{2}$ is ${\text{Φ}}_{12}.$

The mutual inductance ${M}_{21}$ of coil 2 with respect to coil 1 is the ratio of the flux through the ${N}_{2}$ turns of coil 2 produced by the magnetic field of the current in coil 1, divided by that current, that is,

${M}_{21}=\frac{{N}_{2}{\text{Φ}}_{21}}{{I}_{1}}.$

Similarly, the mutual inductance of coil 1 with respect to coil 2 is

${M}_{12}=\frac{{N}_{1}{\text{Φ}}_{12}}{{I}_{2}}.$

Like capacitance, mutual inductance is a geometric quantity. It depends on the shapes and relative positions of the two coils, and it is independent of the currents in the coils. The SI unit for mutual inductance M is called the henry (H)    in honor of Joseph Henry (1799–1878), an American scientist who discovered induced emf independently of Faraday. Thus, we have $1\phantom{\rule{0.2em}{0ex}}\text{H}=1\phantom{\rule{0.2em}{0ex}}\text{V}·\text{s/A}$ . From [link] and [link] , we can show that ${M}_{21}={M}_{12},$ so we usually drop the subscripts associated with mutual inductance and write

$M=\frac{{N}_{2}{\text{Φ}}_{21}}{{I}_{1}}=\frac{{N}_{1}{\text{Φ}}_{12}}{{I}_{2}}.$

The emf developed in either coil is found by combining Faraday’s law    and the definition of mutual inductance. Since ${N}_{2}{\text{Φ}}_{21}$ is the total flux through coil 2 due to ${I}_{1}$ , we obtain

${\epsilon }_{2}=-\frac{d}{dt}\left({N}_{2}{\text{Φ}}_{21}\right)=-\frac{d}{dt}\left(M{I}_{1}\right)=\text{−}M\frac{d{I}_{1}}{dt}$

where we have used the fact that M is a time-independent constant because the geometry is time-independent. Similarly, we have

${\epsilon }_{1}=\text{−}M\frac{d{I}_{2}}{dt}.$

In [link] , we can see the significance of the earlier description of mutual inductance ( M ) as a geometric quantity. The value of M neatly encapsulates the physical properties of circuit elements and allows us to separate the physical layout of the circuit from the dynamic quantities, such as the emf and the current. [link] defines the mutual inductance in terms of properties in the circuit, whereas the previous definition of mutual inductance in [link] is defined in terms of the magnetic flux experienced, regardless of circuit elements. You should be careful when using [link] and [link] because ${\epsilon }_{1}\phantom{\rule{0.2em}{0ex}}\text{and}\phantom{\rule{0.2em}{0ex}}{\epsilon }_{2}$ do not necessarily represent the total emfs in the respective coils. Each coil can also have an emf induced in it because of its self-inductance (self-inductance will be discussed in more detail in a later section).

#### Questions & Answers

The properties of a system during a reversible constant pressure non-flow process at P= 1.6bar, changes from constant volume of 0.3m³/kg at 20°C to a volume of 0.55m³/kg at 260°C. its constant pressure process is 3.205KJ/kg°C Determine: 1. Heat added, Work done, Change in Internal Energy and Change in Enthalpy
Opeyemi Reply
please how do dey get 5/9 in the conversion of Celsius and Fahrenheit
Gwam Reply
what is copper loss
timileyin Reply
this is the energy dissipated(usually in the form of heat energy) in conductors such as wires and coils due to the flow of current against the resistance of the material used in winding the coil.
Henry
it is the work done in moving a charge to a point from infinity against electric field
Ashok Reply
what is the weight of the earth in space
peterpaul Reply
As w=mg where m is mass and g is gravitational force... Now if we consider the earth is in gravitational pull of sun we have to use the value of "g" of sun, so we can find the weight of eaeth in sun with reference to sun...
Prince
g is not gravitacional forcé, is acceleration of gravity of earth and is assumed constante. the "sun g" can not be constant and you should use Newton gravity forcé. by the way its not the "weight" the physical quantity that matters, is the mass
Jorge
Yeah got it... Earth and moon have specific value of g... But in case of sun ☀ it is just a huge sphere of gas...
Prince
Thats why it can't have a constant value of g ....
Prince
not true. you must know Newton gravity Law . even a cloud of gas it has mass thats al matters. and the distsnce from the center of mass of the cloud and the center of the mass of the earth
Jorge
please why is the first law of thermodynamics greater than the second
Ifeoma Reply
define electric image.obtain expression for electric intensity at any point on earthed conducting infinite plane due to a point charge Q placed at a distance D from it.
Mateshwar Reply
explain the lack of symmetry in the field of the parallel capacitor
Phoebe Reply
pls. explain the lack of symmetry in the field of the parallel capacitor
Phoebe
does your app come with video lessons?
Ahmed Reply
What is vector
Ajibola Reply
Vector is a quantity having a direction as well as magnitude
Damilare
tell me about charging and discharging of capacitors
Ahemen Reply
a big and a small metal spheres are connected by a wire, which of this has the maximum electric potential on the surface.
Bundi Reply
3 capacitors 2nf,3nf,4nf are connected in parallel... what is the equivalent capacitance...and what is the potential difference across each capacitor if the EMF is 500v
Prince Reply
equivalent capacitance is 9nf nd pd across each capacitor is 500v
santanu
four effect of heat on substances
Prince Reply
why we can find a electric mirror image only in a infinite conducting....why not in finite conducting plate..?
Rima Reply
because you can't fit the boundary conditions.
Jorge
what is the dimensions for VISCOUNSITY (U)
Branda

### Read also:

#### Get the best University physics vol... course in your pocket!

Source:  OpenStax, University physics volume 2. OpenStax CNX. Oct 06, 2016 Download for free at http://cnx.org/content/col12074/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'University physics volume 2' conversation and receive update notifications?

 By By


text:
# Mathematische Nachrichten

## Low dimensional instability for quasilinear problems of weighted exponential nonlinearity

### Abstract

We prove a sharp Liouville type theorem for stable ${W}_{loc}^{1,p}$ solutions of equation

on the entire Euclidean space ${\mathbb{R}}^{N}$, where $p>2$ and f is a continuous and nonnegative function in ${\mathbb{R}}^{N}\setminus \left\{0\right\}$ such that $f\left(x\right)\ge {a|x|}^{q}$ as $|x|\ge {R}_{0}>0$, where $q>-p$ and $a>0$. Our theorem holds true for $2\le N<\frac{{p}^{2}\phantom{\rule{0.16em}{0ex}}+\phantom{\rule{0.16em}{0ex}}3p\phantom{\rule{0.16em}{0ex}}+\phantom{\rule{0.16em}{0ex}}4q}{p\phantom{\rule{0.16em}{0ex}}-\phantom{\rule{0.16em}{0ex}}1}$ and is sharp in the case $f\left(x\right)={a|x|}^{q}$.

View all

View all


text:
# Math Help - Integral with partial fractions

1. ## Integral with partial fractions

Hello, couild someone explain me how to integrate this ? i tried but i never get the result from wolfram alpha

$\int \frac {5+x^2} {4x^2+x^3}$

2. $\frac{5+x^{2}}{4x^{2}+x^{3}}=\frac{5}{x^{2}(x+4)}+ \frac{1}{x+4},$ and $\frac{1}{x^{2}(x+4)}=\frac{1}{16}\cdot \frac{x^{2}-(x+4)(x-4)}{x^{2}(x+4)}=\frac{1}{16}\left( \frac{1}{x+4}-\frac{1}{x}+\frac{4}{x^{2}} \right),$ so i think you can take it from there.


text:
## Introduction

Tyrosine-type site-specific recombinases (Y-SSRs) are widely used genome engineering tools. They are capable of exchanging DNA strands between their target DNA sequences, which can facilitate controlled excision, inversion, insertion or exchange of DNA. Because this process is very precise and not reliant on DNA repair mechanisms, it offers seamless manipulation of genomic DNA without side effects (reviewed in Meinke et al.1). These features distinguish Y-SSRs from nuclease-based genome engineering methods, such as CRISPR-Cas systems. All nuclease-based genome editing tools rely on the DNA repair pathways of the host cell, which can ultimately lead to unintended editing results (reviewed in Anzalone et al.2). However, the advantage of the widely used CRISPR-Cas9 system is the speed and efficiency with which it can be programmed to specifically edit novel target sites. In this regard, Y-SSRs are lagging behind and currently require substantial time and effort to be generated with tailored specificity. This bottleneck represents a considerable hurdle to harness the full potential of designer-recombinases as a versatile genome editing tool.

Current approaches to adapt site-specific recombinases to novel target sequences use directed molecular evolution. One powerful approach to evolve designer Y-SSRs utilizes a plasmid-based bacterial application called substrate-linked directed evolution3,4,5,6,7 (SLiDE). SLiDE allows libraries of recombinases to be progressively evolved by screening random mutations in conjunction with a selection scheme for activity on new, stepwise altered target sequences. Several recombinases have already been developed this way4,6,7,8,9, demonstrating the applicability of SLiDE. Improvements of the approach have also been reported7, but the generation of a new designer Y-SSR still requires substantial time and resource investments. The evolution of some of these recombinases took over 150 cycles, an equivalent of 6–12 months of work. Therefore, while SLiDE is effective, it remains expensive in terms of time and labor.

These disadvantages are a direct consequence of the randomized way new generations of recombinases are created when using SLiDE. At the start of a new project, it is not known which sequence modifications will lead to a protein variant that shows recombination activity on the predefined target sequence. There has been some success to introduce improvements based on protein model analysis on designer-recombinases with activity on a defined target site10. However, due to the complex nature of the whole enzymatic reaction, which includes DNA binding, DNA bending and catalysis (reviewed in Meinke et al.1), it has so far not been possible to rationally design recombinases with activity at a new target sequence. Hence, a method that predicts amino acid changes that will cause recombination activity at a desired target site has the potential to accelerate the generation of novel designer-recombinases.

One way to predict necessary changes within Y-SSRs to achieve altered selectivity could be direct coupling analysis (DCA). DCA models employ probabilistic models to capture co-evolutionary relationships between residues in the protein. Prominent types of algorithms used for DCA are Potts models11 or Boltzmann machines12. They were originally developed for protein residue contact prediction, but they have also been adapted to generate protein sequences13 and to predict the fitness of a protein14. While DCA models are inferred with first- and second-order statistics, they are able to recapitulate third-order statistics13. However, there is no obvious way to adapt these models to generate protein sequences conditional for a DNA sequence. Additionally, DCA models can be computationally expensive12, which could be negatively affected by the added complexity of generating sequences for a DNA target site.

A more recent and more effective approach may be provided by generative deep learning models. These types of algorithms are capable of representing protein sequences as a multivariate distribution whose parameters are learned during training of a deep neural network (reviewed in Wu et al.15). Consequently, they can be used for predicting novel proteins by sampling from this distribution. The algorithms that are most commonly used for protein sequence generation are Generative Adversarial Networks (GANs)16,17,18 and Variational Autoencoders (VAEs)19,20,21,22,23,24,25. In addition to these two, there are also deep learning algorithms mostly employed for natural language processing (NLP) that have been adapted for protein sequence generation. In particular, LSTMs26 and Autoregressive models have been used extensively27,28,29,30,31,32. More recently, transformers have been getting a lot of attention, since they have produced remarkable results in NLP33 and have also shown great promise in protein sequence generation34,35,36. The multitude of publications on protein sequence generation in recent years clearly indicates the potential of the approach to become a standard for protein development.

Beyond mere generation of new protein sequences, the goal is often to generate variants with improved properties23,27,28,29,30,37. These improvements usually involve quantifiable aspects, such as thermostability or luminescence. In contrast, the present task requires the generation of recombinase variants with altered properties with respect to a complex categorical condition, their activity on a new DNA target site. To achieve this previously untapped mode of protein sequence generation, we decided to use Conditional Variational Autoencoders (CVAE)38 to generate models capable of predicting recombinase sequences based on a specific target sequence.

Here we show that the resulting algorithm (RecGen), which we trained with 89 evolved recombinase libraries and their respective target sites, captures the affinities between the recombinase sequences and their respective DNA binding sequences. Through the learned affinities RecGen is capable of constructing recombinase sequences for defined target sites by providing the DNA sequence as a condition. To verify predictions of RecGen, we generated designer recombinases for novel DNA target sites with the algorithm and tested their activity experimentally.

## Results

### Evolved recombinase libraries are highly diverse

An essential part for machine learning is the collection of a large amount of data to train the models. We gathered the training data by sequencing the full gene fragments of evolved recombinase libraries with PacBio HiFi sequencing, a long read sequencing technology that provides highly accurate sequences39 (Fig. 1a, Supplementary Fig. 1). In total we sequenced 89 recombinase libraries, each evolved for a different target site (loxA-1 to loxX-6; Supplementary Data 1), covering all four bases on each position of the target sequence half-site at least twice (Fig. 1b). All of these libraries were derived from Cre-based recombinases. For each library, we extracted and translated ~1000 to ~34,000 of the 343 amino acid long recombinase coding sequences, which resulted in a total of over 1.1 million full length reads (Supplementary Fig. 1c).

We first wanted to get an understanding of the data obtained from sequencing the different libraries and assess the quality of the data. We used Pacbio HiFi sequencing to sequence the evolved recombinases, which yielded full length reads with >99.997% accuracy and high reproducibility (Supplementary Fig. 1d, e). Interestingly, the sequenced recombinases showed very high diversity within the libraries, with multiple occurrences of identical clones being rare (Supplementary Figs. 2a, 4b). In all sequenced libraries, mutations found in recombinases were distributed across 206 residue positions (frequency threshold of 10% per library), indicating that 60% of the 343 amino acids were subject to positive selection in at least one evolutionary campaign. Hot spot mutations in the positions 7-15, 30-44, 77, 86-93, 108, 175, 244-249, 258-268, 317-320 had been described previously for individual evolutions of designer-recombinases, providing additional evidence that these regions are important to change target-site selectivity (Fig. 1c; Supplementary Data 2)1,4,7,8,9,40,41. The large amount of sequencing data allowed us to nominate additional mutations that contribute to survival of the selection pressure and potentially to target site selectivity. For instance, we identified positions 5, 23, 57, and 166 as frequently mutated to different residues (Fig. 1c, marked in red), indicating that these residues play important roles in adapting designer-recombinases to a new target site. Hence, specifically targeting these residues in future evolution campaigns could be helpful to generate novel designer-recombinases. Notably, to adapt to activity on a new target site some recombinases acquired up to 75 amino acid substitutions (~22% of the protein sequence) compared to Cre (Fig. 1d, Supplementary Fig. 3), highlighting the adaptability of the protein during evolution. Importantly, we identified residues under positive selection throughout the recombinase coding sequence (Fig. 1c), confirming that virtually the complete sequence contributed to adaptations to new target sites. These results highlight the complex nature of changing target site recognition for this class of enzymes, indicating that simple correlative analyses might not be sufficient to predict new designer-recombinases with custom target site specificity.

Next, we were interested in the composition of the libraries. To get an overview of the distribution of the libraries, we used the dimensionality reduction method t-SNE to visualize the recombinase sequence relationships (Fig. 1d, Supplementary Fig. 2b). We found that many of the evolved libraries form independent clusters, indicating that common changes in the protein led to the ability of the recombinases to recombine the presented target site. However, in some cases multiple clusters were observed for one library, hinting that diverging sets of mutations evolved in the library with activity on the required target site (Fig. 1d, Supplementary Fig. 2c). The complex relationships of the amino acid mutations in regard to the different libraries and therefore the target site selectivity suggested that advanced machine learning might be a way forward to solve the task of recombinase prediction.

### CVAE model architecture for recombinase prediction

The complexity of the data in combination with the requirement of predicting for a target sequence made us disregard the option of using a DCA model. Instead, we turned to deep learning approaches to try and predict recombinases selective for new target sites. There were three requirements we wanted our algorithm to cover. (I) The algorithm needed to be generative, i.e. it should have the ability to predict multiple sequences, so that it can be used in future applications for library generation and so that it would give us a higher chance of finding functional recombinases. (II) For a deep learning application, the data we have is limited, therefore we were looking for an approach that can be stably trained with the data at hand. (III) Trained models should be capable of receiving the target sequences as input and predict full recombinase sequences as output. Since Generative Adversarial Networks are known to be unstable and difficult to train42, we decided that requirements (I) and (II) are better fulfilled by Variational Autoencoders (VAEs). More specifically, we found Conditional Variational Autoencoders (CVAE)38 to be the most suitable method to also fulfill criterion (III), as they are capable of predicting outputs conditioned on a set target sequence.

The CVAE architecture consists of two parts, the encoder and the decoder (Fig. 2a). Our encoder receives the recombinase sequences together with the target sequences in one-hot encoding and learns to represent the given input into a compressed latent space. The latent space is designed to resemble a multivariate normal distribution. Therefore, for each latent space dimension mean (μ) and standard deviation (σ) are learned for normal distribution sampling (Fig. 2a). In combination with the conditional input of the one-hot encoded target sequence the sampled latent space is delivered to the decoder, which aims to reconstruct the recombinase sequences. During training, the difference between reconstructed and true recombinase sequences are computed via the binary cross entropy loss function. This loss is then backpropagated using the so-called “reparameterization trick”24. Additionally, the loss function contains a term that forces all encodings to resemble a multivariate normal distribution (KLD loss, Fig. 2a). Finally, sampling from the controlled latent space in combination with the desired target sequence enables the generation of recombinase sequences through the decoder (Fig. 2b).

### Predictions result in high similarity to known targets

To confirm that the chosen CVAE architecture is capable of predicting functional recombinases, we first compared the model output with existing sequencing data. To this end, we decided to use leave-one-out cross-validation (LOOCV), i.e. excluding one target recombinase library (TRL) from the training set and using the resulting model to generate predictions for that one TRL target sequence (Fig. 2c). This procedure was then repeated for each recombinase library.

Assuming that all the sequences in the TRL are capable of recombining the TRL target site, we argued that any predicted recombinase that has a high similarity to any TRL shall be counted as a success. Therefore, to assess the prediction quality, we chose to calculate the hamming distance (i.e. the number of amino acids two sequences differ by) between the predicted recombinase library (PRL) sequences and their closest match in the TRL. In other words, this metric assesses the likelihood that the predicted sequences contain the necessary mutations to enable recombination on the given TRL target site.

Ideally, the model infers the PRL sequences from the mutations it observed from the recombinase libraries in the training dataset with similar target sites. However, there is a chance that it lacks the depth of information to infer a viable sequence, which could lead to ‘memorized’ sequences from the training data. For this reason, we decided to also measure the distance of the closest recombinase libraries (CRL) in terms of target site distance to the TRL. Hence, if the measured PRL distance is lower than the CRL distance, it indicates that the model was capable of predicting a combination of amino acids with an increased likelihood of working for the desired target site than the amino acid combinations observed in the CRL (i.e. the best otherwise available evolution starting point).

The results obtained confirmed the validity of our proposed approach. More specifically, we calculated the LOOCV PRL hamming distances for all recombinase libraries and found the predicted sequences to be closer to the TRL by a median of four amino acids compared to the CRL (Fig. 2d). In 74 cases the PRL led to median improvements in the distance to the TRL, with only three cases where the median distance of the PRL was worse than in the CRL (Fig. 2e, f; Supplementary Fig. 4a). The highest median improvement was a hamming distance of 20 while in the worst case the distance of the PRL was only four further away from the TRL than the CRL (Fig. 2f). This difference in the distance to the TRL, a known solution to the recombination of the required target site, poses a substantial improvement of the predicted recombinases in comparison to the CRL. This suggests that PRLs are more likely to function at the desired target site compared to CRLs and that PRL sequences need to acquire fewer mutations in directed evolution to recombine efficiently at the desired target site.

### LOOCV predictions generate highly active recombinases

The LOOCV testing indicated that the model was capable of predicting approximations of the TRL sequences, but most of the predictions were still several amino acids different to the actual TRL sequences. We wanted to test some of the LOOCV predicted recombinases to investigate if they are genuinely recombining the respective target sites. In order to assess recombination activity, we used a previously published reporter plasmid4,7 that can be used in two different assays: a plasmid-based recombination assay (Fig. 3a, b) and a PCR-based recombination assay (Fig. 3c). The plasmid-based assay provides results that can be used to quantify the recombination rate of the recombinases, while the PCR-based assay allows for detection of rare recombination events.

We used the assays to test if the similarity of the predicted sequences to the TRL is an indication of a successful prediction. The predicted sequences for loxA-1 and loxD-1 were very similar to the sequences found in their TRLs (Fig. 2e). This similarity made it likely that these libraries would be functional. Additionally, we investigated how the predicted sequences compared to the TRLs and the CRLs. We tested the most prominent sequence of both predicted recombinase libraries (PRL single clone; Supplementary Data 3) and found them to have similar recombination efficiencies to the TRLs and the CRLs (Fig. 3d, e). Next, we decided to validate the predictions for loxE-3 and loxI-1, these were more distant to the TRL than the predictions for loxA-1 and loxD-1. However, the dH(PRL) was still much lower than the dH(CRL) (Fig. 2d), suggesting that the predictions might perform better than the CRL if any activity could be observed at all. We found the activity of the most commonly observed prediction (PRL single clone; Supplementary Data 3) for loxE-3 to be higher than the TRL and both CRLs (34% versus 13%, 2% and 7%, respectively, Fig. 3f). On the loxI-1 target site the TRL had an activity of 30%. While both, the PRL and CRL, did not reveal recombination activity in the plasmid assay, recombination could be confirmed with the PCR assay for the PRL, but not the CRL. In summary, for every LOOCV prediction tested, we were able to detect recombination in all predicted recombinases and the recombination efficiency was often comparable or better compared to the CRL, indicating that RecGen is capable of predicting functional and effective recombinases for known target sites.

### Predicted recombinases excise novel target sites

Ultimately, we wanted to be able to predict recombinase sequences with activity on novel target sites, for which no functional recombinase sequences are known. To test whether RecGen can achieve this goal, we decided to generate predictions for 14 artificially constructed target sites for evaluation in a bacterial assay (Supplementary Data 3). We selected target sites from four of our evolved libraries (loxC-7, loxD-7, loxF-1, loxG-1) and changed 3 bp in the half-sites, resulting in loss of activity of most libraries on the modified target sites (Fig. 4). For the changes we focused on the half-site positions 7-12 because these strongly affect the activity of recombinases when they are changed43. We also included one novel target site containing modifications in position 3, 5 and 6, because these positions were underrepresented in our training dataset. This way, we constructed 14 target sites for which we generated recombinases with models trained on all recombinase libraries available, thereby setting up controlled test cases to study the performance of RecGen.

For each target site we predicted 10,000 recombinase protein sequences, from which we selected the most prevalent sequence for each target site. Using the recombination assays described earlier we tested the predictions and the CRLs on the respective novel target sites. We investigated putative recombination with the PCR assay and found that most of the CRLs had no activity on the selected novel target sites, indicating that additional sub-sites would be required to start SLiDE for these target sites. In contrast, we detected recombination activity at several target sites of the predicted recombinases. From the 14 novel target sites we found that eight predictions resulted in genuine recombination products which could be confirmed by sequencing (Fig. 4, Supplementary Fig. 5a). In four of the functional predictions no activity could be observed with the CRL, indicating an advantage in using RecGen over the classical method. In addition to testing the predictions on the specified target sites, we also tested their activity on the target site of their CRL. Several of the functional predictions had no activity on their CRL target site (novelC-2, novelD-2, novelF-4; Supplementary Fig. 5b). This is remarkable, because RecGen was developed to predict recombinase activity on a target site, but was not trained to restrict recombination to this site. We concluded that RecGen is capable of predicting recombinases active on defined target sites, making it the first algorithm that can predict functional recombinases for an entirely new target site.

## Discussion

So far, the development of designer-recombinases for novel target sites has been accomplished by applying directed molecular evolution4,5,6,7,9,40,41,44,45,46,47,48, an effective but laborious and time consuming process. A more direct and faster approach could be the intelligent design of Y-SSRs for predefined target sequences. However, Y-SSRs are complex and the understanding of the necessary modifications for a change in target site specificity has been elusive thus far. To tackle this challenge, we gathered over one million recombinase sequences from libraries evolved for 89 different target sites. Consistent with a complex recombination reaction that is hard-wired into the protein sequence, we found that many residues were mutated and positively selected for in the different libraries. Evolutionary enriched residues are not necessarily important for their target site selectivity. However, the fact that these changes have been found in several independent evolutionary experiments, performed in different laboratories, is strong evidence that they are important for this trait (Supplementary Data 2)1,4,6,8,9,40,41.

With the extensive sequencing of recombinase libraries we nominate several additional mutational hotspots that seem to influence target site selectivity. Interestingly, a number of mutations selected for were found in the N-terminus, a region which is dispensable for recombination in Cre49,50. The fact that residues in the N-terminus were clearly under positive selection indicates that the N-terminus fulfills an important role in evolved recombinases51.

On the library level, we found that some libraries consisted of multiple distinct clusters of sequences, while most others form one uniform cluster. This finding indicates that directed molecular evolution sometimes led to diverging sets of mutations that were capable of recombining the required target site, while other libraries evolved to contain very similar mutations. This trait has been found in other directed molecular evolutions where multiple sets of mutations were dominant until one set took over the whole population52. It is therefore possible that for libraries with two clusters additional rounds of SLiDE would be necessary to eventually lead to a single cluster. Overall, sequencing of the evolved recombinases provided us with valuable information that further cemented the complexity of the recombinase target site selectivity.

We decided to approach the non-trivial task of adapting the activity of designer-recombinases to new target sites using a generative deep learning algorithm. With the described neural network we managed to predict sequences with high similarity to known recombinases specific for the predicted target sites. Through comparing the predictions to the closest recombinase libraries, we could show that these predictions are not merely “memorizations” of sequences with similar target sites. Overall, we found the predicted sequences to be closer to recombinases that are known to work by four amino acids, confirming the validity of our approach.

We did see variance in how closely the predicted sequences resemble recombinases that work and in how much the predictions were improved over the closest recombinase library. We know that the amount of information available for the target site compositions varied and therefore contributed to a difference in the ability of the model to predict the TRL. This could be observed when predictions were performed by leaving out more information related to the TRL (Supplementary Fig. 4c). Additionally, the residues contained in the most closely related libraries could be different even though they fulfill the same purpose. Diverging solutions for the same problem are known to happen in evolution and have also been described in directed evolution53. Even though the performance of the models varied in regard to the target site, in over 80% of the tested target sites the predicted recombinases showed an improvement over the libraries evolved for the most similar target site. This result suggests that the predicted recombinases are generally the better starting point for further directed evolution.

We assumed that the LOOCV predictions closer to the TRL sequences are more likely to be active on the TRL target site. To test this, we validated three LOOCV predictions experimentally. Two predictions that were very similar to TRL sequences were indeed active. However, we found that the two more distant predictions we picked for testing were also able to recombine their target sites. In one of these cases, it turned out that the prediction was even more effective than the library that was evolved for this task. We suspect that part of the sequence difference between the PRL and TRL is made up from rare mutations that the model omitted. Many of these rare mutations have a neglectable effect on protein function and are therefore neither enriched nor removed. Because these mutations are so rare their influence on the training loss is very low, which is why RecGen was not optimized to learn these mutations. This led to the predictions being less variable (Supplementary Fig. 4b), but the important residues were most likely maintained. All in all, the tested LOOCV predictions of novel target sites were all functional, an indication that the predictions from this model are useful.

Ultimately, we wanted to know if the model is capable of fulfilling its intended purpose, the prediction of recombinases for novel target sites. We could confirm that 8 out of 14 predictions were active on the respective target sites. Importantly, most CRLs, which were the libraries we would usually start an evolution from, showed no activity. This means that if we wanted to get a library with activity on the defined target site, it would be necessary to first evolve a library that works on a subsite, so that we could then move on to the target site of interest. Using our approach, we can now start an evolution directly on the intended target site. In recent work6, evolving recombinases to adapt to a target site with one or two bases changed took 12 and more cycles. Because each cycle is a full working day, each target site switch takes >2 weeks of actual working time. Therefore, our predicted recombinases that have three bases changed in the target site would save at least 2 weeks of work.

The predicted recombinases were also tested for activity on the CRL target site, to probe for their specificity. Since the CRL is the library with the most similar target site in the training dataset, it is reasonable to assume that the model would implement protein sequence features from the CRL. This could result in the prediction being active on the CRL. Indeed, we found that some of the PRL are active on their CRL target site, while several successfully predicted recombinases did not recombine the CRL target site. The current version of RecGen only addresses activity on a specified target site. Hence, further directed evolution, or rational design on these recombinases would have to be performed to make these recombinases highly active and specific4,5,6,8,10,54.

One has to note that we only tested a single sequence of the PRLs, while we tested a full library for the CRL. The probability of finding a functional recombinase is much higher in a library of >100,000 variants than when testing only a single clone. Therefore, testing multiple predicted recombinases would probably yield an even higher success rate than just testing one sequence. Overall, the results we obtained here are encouraging and indicate that RecGen will be beneficial in cutting down the time and effort spent for the development of new designer-recombinases.

RecGen as it stands is already a valuable resource to shorten the development time of new designer-recombinases, but future iterations will likely further it’s capabilities to reliably predict Y-SSRs. Changing the encoding to amino acid properties or a learned representation for protein sequences27,55,56 would give RecGen additional information that could help to predict more reliably. Another way to adapt the network would be to change the fully connected neural network layers to convolutional or recurrent network layers, which could further improve the performance22,23. Recent publications demonstrated impressive results with transformer models34,35,36, indicating that this kind of model could also be useful for recombinase sequence data. Advances in protein structure prediction and generation could help filter the model predictions for proteins that are functionally viable. For example Ferruz et al.34, validated their predicted protein sequences with AlphaFold257 through structure probability scores and MD simulations. While improvements to the algorithm are important, the data used to train the model is likely to be even more critical.

The amount of data we gathered is considerable in terms of laboratory work performed, but the target sequence space where successful predictions can be done is still limited. So far, we could only confirm predictions for target sites that differ by three bases in the half-site to known target sites. This is why the collection of more data will be key in making RecGen more useful for future designer-recombinase development. This means that we need to collect sequences from recombinase libraries evolved for additional target sites. Ideally targeted evolutions specifically for the purpose of extending the available sequence space should be performed. In addition, quantitative data about individual recombinase sequences within the library should be helpful to improve RecGen. This information would be important for the model to understand which mutations are more relevant for recombination activity on the defined target site. Because directed evolution for new functionality could cause recombinases to become more “promiscuous”, i.e. less specific4,58, it would also be relevant to screen for their activity on off-targets. This would help the model to learn how “flexible” the proteins are in their target site selectivity. Generally, the more data available for the model, the better the possible outcome.

In conclusion, we show that RecGen is capable of predicting recombinases for defined target sites. To the best of our knowledge, the successful prediction of proteins selective for a defined DNA target site has not been accomplished before and is therefore an important achievement. Furthermore, we believe that RecGen will be a valuable tool to kick-start the evolution of future designer-recombinases, making the process faster and less laborious.

## Methods

### Deep Sequencing of evolved recombinase libraries

In order to deep sequence the recombinase libraries, 500 ng of pEVO plasmids (described in3,4,7) from the evolved recombinase libraries were digested with the restriction enzymes NdeI and AvrII (NEB catalog number R0111S and R0174S), which will only cut in non-recombined plasmids. The digested DNA was then desalted with a MF-Membrane and cultivated in E. coli XL-1 Blue (Agilent catalog number 200158). After growing the cells for 14–16 h in 100 ml LB in the presence of chloramphenicol (25 mg/ml), plasmid DNA was extracted using the GeneJet Plasmid Miniprep Kit (ThermoFisher catalog number K0502). The extracted DNA only contains recombined plasmids with functional recombinase genes. 5 ug of the extracted pEVO plasmid were then digested with the restriction enzymes BsrGI-HF and XbaI (NEB catalog number R3575S and R0145S) and the 1041 bp fragment harboring the recombinase gene was then enriched with custom SPRI-beads (described in dx.doi.org/10.17504/protocols.io.n7hdhj6), by binding the pEVO backbone to the beads two times followed by an Ampure XP (Beckman Coulter catalog number A63881) cleanup of the supernatant, a more detailed description can be found in the supplementary methods. The DNA was quantified with a Qubit dsDNA HS Assay Kit on a Qubit 2.0 Fluorometer (ThermoFisher catalog number Q33230) and sent to the DRESDEN-concept Genome Center, where it was sequenced with a Sequel System 6.0 using the Pacbio HiFi method.

Circular consensus sequence data was generated with PacBio’s ccs v3.4.1. Using ccs’s filtering criteria, only sequences of length 1034-1200 bp with a minimum predicted accuracy of 99.997% (Phred Score of ~25) were kept. After converting the data to FASTA format using SAMtools 1.11 the recombinase gene sequences were aligned and translated to amino acid using the protein2dna:bestfit alignment model of exonerate v2.3.0. Further filtering was done with GNU grep v3.7, GNU sed v4.8 and GNU awk v5.1.1 to ensure that the genes are 1032 bp long, start with a methionine, and do not contain any stop codons within the sequence.

### Recombinase sequence data analysis

Recombinase protein and target site sequences were processed using R version 4.1.1 with tidyverse packages v1.3.159,60. t-SNE dimensionality reduction was calculated with the Rtsne package v0.1.5 from hamming distances of the sequences acquired with the stringdist package v0.9.861,62.

### CVAE model training and prediction

Neural networks were trained using pytorch v1.10.1 on Python 3.9.663. Data pre- and post-processing was done with numpy v1.22.1 and pandas v1.4.064,65. To ensure equal distribution of the training data we used 1000 randomly chosen recombinase sequences per library (Supplementary Fig. 2a) plus the corresponding target half-site, which were one-hot encoded for training of the models.

One-hot encoding was generated by forming a binary matrix where the rows correspond to the recombinase sequences and the columns represent all possible combinations of amino acids and positions in the sequence. The sequence was then represented with ones in the places that correspond to the combinations found in the sequence and zeros for all other combinations. The target sequence and the recombinase sequence were concatenated and the possible letters allowed contained the naturally occuring 20 amino acids and one for the stop codon. The target sequence part was encoded in the same way, since the letters for the DNA are contained in the 20 amino acids.

The training dataset corresponded to 89 target sites from 23 evolution projects. CVAE architecture was constructed according to Sohn et al.38. The models were constructed with two fully connected layers in the encoder and decoder with 64 and 32 neurons (reversed in the decoder), while the latent space was defined with two neurons. Training was performed in 40 epochs with a batch size of 128, a dropout rate of 0.1, and a learning rate of 0.0001. The reconstruction loss was calculated with binary cross entropy and the KLD is multiplied with a factor of 0.1 to 2, linearly increasing with each epoch66.

Predictions with the trained models were done using the decoder part of the model by providing the one-hot encoded half-site target sequence with two random numbers generated from a normal distribution (Fig. 2b). The output of the model is then decoded from one-hot to amino acid. All predicted recombinase sequences can be found in Supplementary Data 3.

### LOOCV testing

Leave-one-out cross-validation was performed as illustrated in Fig. 2c. First the training set is reduced by removing the Target Recombinase Library (TRL). Model training and prediction with the reduced training dataset were then done as described above. We found that training with the same parameters results in slightly different outcomes. To mitigate the output variance we decided to use multiple models for prediction, because of the computational cost we trained 10 models per TRL for prediction. A total of 1000 recombinase sequences were generated and their hamming distances to the TRL sequences was calculated with only the smallest distance recorded. Additionally, the same process is done with the CRL sequences in place of the PRL sequences. The recorded distances were then processed with the tidyverse R packages v1.3.1 and plotted with ggplot2 v3.3.3 67.

The smallest hamming distance is defined in Eq. (1).

$${d}_{H}\left({x}_{i}\right)=\min \left(\varDelta \left({x}_{i},\{{y}_{1},...,{y}_{j}\}\right)\right)$$
(1)

Where x is the PRL or CRL sequences and y is the TRL sequences. Δ indicates the hamming distance function.

### Recombinase activity assays

pEVO vectors with the respective target sites and recombinase genes were cultivated in E. coli XL-1 Blue (Agilent catalog number 200158) for 14-16 h in 10 ml LB in the presence of chloramphenicol (25 mg/ml) and L-arabinose (10 µg/ml or 200 µg/ml). Plasmid DNA was extracted using the GeneJet Plasmid Miniprep Kit (ThermoFisher catalog number K0502). For the plasmid-based recombination assay 500 ng plasmid DNA was digested with XbaI and BsrgI-HF (NEB catalog number R3575S and R0145S) followed by agarose gel electrophoresis. The resulting bands indicate the fraction of recombined plasmid at ~4.2 kb and non-recombined plasmid at ~5 kb. The amount of recombined and non-recombined plasmid was measured from the band intensities using Fiji for image processing. The rate of recombination was calculated by dividing the amount of the recombined plasmid with the amount of both plasmids. A higher percentage of recombined plasmids indicates that the recombinase library or variant is more active on the defined target site. For the PCR-based recombination assay 500 ng of the plasmid DNA was digested with NdeI and AvrII (NEB catalog number R0111S and R0174S), which linearizes all non-recombined plasmids. The digested product is then subjected to PCR with the primers EVO-F and EVO-R (CGGCGTCACACTTTGCTATG, AAGGGAATAAGGGCGACACG), which will amplify if the product is circular, but will fail if the product is linearized. The expected product of ~1.7 kb is visualized with agarose gel electrophoresis.

### Validation of LOOCV predictions

The pEVO evolution and reporter vector for loxA-1, loxD-1, loxE-3, as well as the respective TRL and CRL genes were obtained from Sarkar et al., Karpinski et al. and Lansing et al.7,8,9. (Supplementary Data 1). The pEVO vector for loxI-1 and the TRL genes were produced for unpublished work by Martin Schneider in the same manner as the above-mentioned vectors. The loxI-1 CRL genes (loxB-1) were obtained from Sarkar et al.9. The PRL clones were ordered codon optimized for E. coli from Twist Bioscience. All recombinase genes were excised by XbaI and BsrGI digest followed by gel excision (Isolate II PCR and Gel Kit from Bioline, catalog number BIO-52058) for cloning into the respective pEVO vector. The cloned vectors were tested for recombination activity with the assays described above using a concentration of 10 µg/ml L-arabinose.

### Prediction for novel target sites and validation

As mentioned in the results section, novel target sites were generated by randomly mutating three bases of the half-site target sequence at positions 7–12 and selected for a distance to other known target sites of four or more. Additionally, we also produced one target site (novelF-5) with base changes in the positions 3,5, and 6, where the positions were changed to least frequently occurring bases in the training dataset (Fig. 1b). pEVOs with these 15 generated target sites were then constructed as described previously7. In short, primers containing the target site and an overlap with the pEVO plasmid were used to produce a PCR product from a pEVO plasmid. This fragment was then cloned into a BglII (NEB catalog number R0144S) digested pEVO plasmid using the Cold Fusion Cloning kit (System Biosciences catalog number MC010B-1). The CRL, which is also the library where the target sites were modified to make the novel target site, was tested for recombination activity (200 µg/ml L-arabinose, described above) on the novel target site pEVO. From the 15 target sites we found 10 to have no activity on their respective CRLs, which were then selected for testing predicted recombinase sequences. Additionally to those, a further four target sites were generated in the same manner, but without testing activity on their CRLs (novelC-2, novelD-2, novelF-4, novelF-5) and selected for prediction testing. For these 14 novel target sites recombinase sequences were predicted with 100 models trained on the full training data as described above. Each model was tasked to predict 100 recombinase sequences, which resulted in a total of 10,000 recombinase sequences per novel target site. The most prominent predicted recombinase sequences per target sites were then ordered and cloned as described above. Recombinase activity assays were also performed as described above with 200 µg/ml L-arabinose. Sequence verification was performed from gel excision products of the 1.7 kb fragments (Isolate II PCR and Gel Kit from Bioline, catalog number BIO-52058) with the Microsynth sanger sequencing services.

### Statistics and reproducibility

Statistical analysis was performed using R version 4.1.1. All boxplots are according to standard definition: median for the center line, upper and lower quartiles for the box limits, 1.5x interquartile range for the whiskers, and the points show outliers. Relevant details of the statistical test are provided in the figure legends. Representative gel pictures showing recombination activity were not replicated for recombination plasmid assays or recombination PCR assays. No statistical method was used to predetermine sample sizes. No data were excluded from the analysis. The experiments were not randomized.

### Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.