Cut and paste functionality

What I think would be very useful in design puzzles is a tool that would cut X nucleotides after position Y and insert them after position Z. This can be done right now by using an external text editor but it gets a bit tedious.

2 Likes

Hi @spvincent!

I wholeheartedly agree. I think you are wishing for the script Omei wrote. It is called Copy/Delete/Replace. @LFP6 updated the script so it could work after some game update:

Copy/Delete/Replace

It can be used for both copying out a sequence between specific bases, but also to paste in such a sequence. But usually I just use the sequence stamper for pasting in a sequence at a specific spot.

Ok, I see this script don’t have the functionality of cutting eg 100 bases. I agree this will be most useful.

I could see creating a booster script that uses a prompt to ask for 3 base offsets for first, last and after. To move to the beginning ypu would say after 0. Using marking of bases would be more complex as with wired cases for moving one base and it would not know if you were moving left or right and one of moving to the beginning would be impossible to mark.

Tx for the replies. A simple script where you could just enter the 3 numbers and hit go (no need to mess around with marked bases) would work well.

Try Clip and Flip v0.1. Eterna

Mark or prompts for 1-4 base offsets to form 2-5 regions.

Prompt mode assumes 1-based base indexing and base offsets must be separated by commas with no extra spaces. (e.g. “12,20”) If no bases are marked or more than 4 bases are marked it prompts for the base offsets of the begining of the segments.

Each marked base is the start of a segment. The first segment starts at the beginning of the sequence and goes to just before the first marked base. (If the first base is marked, the logical first segment is zero-length.) The second segment goes from the first marked base to just before the second marked base, and so on. The last segment goes from the last marked base to the end of the sequence.

If only one base is marked (or entered at the prompt), flip the two segments. If two bases are marked, exchange the second and final segments. If three bases are marked, exchange the second and third segments leaving the first and final segments alone. If four bases are marked, exchange the second and fourth segments, leaving the first, third and final segments alone.

To exchange the first part of the sequence with the another segment, mark the first base so that the “first segment” is length zero. Then if three bases are marked it will exchange the “second” and “third” segments leaving the “fourth” segment alone, but since the “first” segment is length zero, it is really exchanging the first non-zero length segment with the second non-zero length segment leaving the third non-zero length segment alone. Similarly with four marked bases when the first base is marked it will exchange the first non-zero length segment with the third non-zero length segment leaving the second and fourth non-zero length segments alone.

Exchanging the first and third of three non-zero length segments cannot be done in one step with marking, but it can be done using the prompting mode since one can specify the base “after” the last base as marked to create a zero-length final segment. As an example one can exchange the first and last bases of a 240-base sequence by specifying the offsets “1,2,240,241” when prompted.

This script has not been heavily tested as yet, so bug reports can come here.

@spvincent Clip and Flip can accomplish this sort of edit. To move X bases starting with base Y to just before base Z, mark or enter at the prompt “Y,Y+X,Z” if Y<Z or “Z,Y,Y+X” if Z<Y. Note you cannot use the +, you have to do the math yourself, so if you want to move 5 bases starting at 12 to just before base 20, you would mark bases 12, 17, and 20 or without marking run the booster and when it prompts, enter “12,17,20” (without the quotes).

Tx jandersonlee. That works well although I find the indexing system a little awkward. I’ll try and modify your script to my personal taste.

I’m finding this script very valuable: a great timesaver. Tx again.

1 Like