Sheffield-iGEM / syn-zeug

A modern toolbox for synthetic biology
https://sheffield-igem.github.io/syn-zeug/
GNU Affero General Public License v3.0
6 stars 3 forks source link

Implement New Tool: "Mutate Sequence" #8

Open TheLostLambda opened 2 years ago

TheLostLambda commented 2 years ago

What should this tool do? Take a sequence of some sort and randomly "mutate" bases or residues.

Is there an existing reference implementation? Here is an implementation of a similar tool – we probably don't need to bother with the protection of the first and last 3 bases.

What are the tool's inputs? A sequence (DNA, RNA, or Protein) and the number of point mutations to make (a usize)

What is the tool's output? A mutated sequence of the same type

Other Implementation Details All positions of the sequence should have the same chance of being selected for mutation – it's fine if mutations occur several times in the same site. For working with randomness, you'll need to use the rand crate documented here.

TheLostLambda commented 2 years ago

Testing this will be a bit tricky, so just check that length remains the same and that the hamming distance is less than the number of mutations to make. Unfortunately, the number could be 0 for even numbers of mutations, so we should check using an odd number of mutations in a loop (making sure things are never 0).

It also might actually be worth adding an argument / different version of this function that does a similar thing but without ever mutating the same position twice.

For now though, just pick the position randomly each time and ensure that mutating a base changes things to a random, different base – no silly A → A mutations here.