Is there a working Bulk Submission script?

Mostly correct. Notes:

  1. I just checked, and applet.get_targets()[0].secstruct will get the target structure as defined by the puzzle, not whatever the user’s defined target is
  2. Instead of calling applet.fold, you might consider get_native_structure or get_full_structure (which handles oligos) - this will return the MFE structure of whatever the current sequence is. Depends on your use case.
  3. energy_of_structure is generally correct for getting energy, and yes for different reasons, neither nupack nor EFT can reliably give you an energy for a pseudoknotted structure.
  4. As we’ve discussed in the past, structure constraints are heavily dependent on the energy model/version. Our version of vienna only supports “soft” structure constraints and afaik it’s not something nupack or eternafold (or derivatives) support

There aren’t APIs to set a target or submit a design currently, but I’m open to adding them.

@LFP6 Thanks. APIs to get/set a user defined target and submit a design would be very useful.

In the meantime I’m busy trying to transcribe some of my python3/arnie code into JavaScript for “ArcKnot”. It’s the weekend and my wife is still at the hospital watching over my sister-in-law so I have some time to fill.

Having to switch my brain and the code from python to JavaScript/EternaScript is proving to be a challenge. (UGH. Just spent an hour finding a leftover “else:”)

@LFP6 Regarding applet.fold(seq) versus get_native_structure(). Do both use the current energy model? I’m not sure whether or not the sequence I am folding is always the current sequence to be honest.

@jandersonlee I’m pretty excited about the ArcKnot tool. Let me know when it’s ready for testing.

Yes, in both cases it uses the current model (which can be retrieved with applet.current_folder and set with applet.select_folder)

@LFP6 I’m not having any luck with ap.get_native_structure but ap.fold(seq) seems to do what I want:

> seq = ap.get_sequence_string()
<
‘GGGAACGACUCGAGUAGAGUCGAAAAGGCGUGUAGCAAUGUUAGUGAUAACCCACAGCUUAACUGUGGACGUGCGGGCGAUACGCGCAGACUGCAGUACUGAAGGAGAGACUAGAAAUGCAGGUGCGAUUAUAUUAAAAUUCGUUUUAAUAUAAUCAAAAGAAACAACAACAACAAC’
> ap.fold(seq)
< ‘…((((((…))))))…(((.((…((((((…))))))…{{{.)).)))}}}(((…(((((…((…((…))))…))))).)))(((((((((((((…)))))))))))))…’
> ap.get_native_structure()
< ‘’
> ap.get_native_structure(0)
< ‘’
> ap.get_native_structure(seq)
PoseEditMode.ts:1229 Uncaught TypeError: Cannot read properties of undefined (reading ‘getPairs’)
at HTMLDivElement.get_native_structure (PoseEditMode.ts:1229:58)
at :1:4

Looks like there’s currently a bug with get_native_structure in PK puzzles. It’s not a hard fix but don’t have the time to deal with it at the moment - calling fold is a perfectly valid workaround for now though.

FYI APIs for getting the target structure and submitting (as well as a fix for get_native_structure with pknots) are currently WIP, plan to release early next week (hopefully Monday).

For solution submission, I had to think through how that’d work a bit - here’s what I’ve settled on. The call signature will look like:

submit_solution(
  details: { title?: string, description?: string } | 'prompt' = 'prompt',
  options?: { validate?: boolean = true, notifyOnError?: boolean = true }
): Promise<boolean>
  • Details can either be 'prompt' (the default) to show the submission dialog to ask for a title and description, or you can pass an object with the title and description (if either title or description are not specified, the default will be used like if you left the fields blank in the dialog)
  • The second parameter is an optional object to allow for further configuration of how the submission process is handled
    • validate controls whether optional validation is performed - that is, the validation where a player can normally choose to bypass in a dialog, ie whether non-required constraints are satisfied and validating that all pairs are valid in the context of a custom structure. By deafult, validation is enabled
    • notifyOnError controls whether errors in the submission process are shown to the user. If true (the default), the user will be shown the normal dialogs that allow for either continuing or canceling submission for optional validation (if enabled) as well as being shown notification dialogs in the situation of other errors (eg, the backend returns an error because the barcode is unique or the user hasn’t unlocked the lab, or other required validation fails)
  • Because this function runs asynchronously (both due to the network request being asynchronous and the potential for users to be prompted), this function returns a Promise.
    • The promise will reject if required validation fails or some other unhandled error is encountered
    • The promise will resolve to false if optional validation failed (with validate set to true) and either notifyOnError is false or the user opted to cancel submission in the dialog
    • The promise will resolve to true if the solution was submitted successfully.

More details in the PR if interested

1 Like

One additional note: If an error is encountered with notifyOnError enabled, the promise will reject only after the user has dismissed the notification dialog

Also coming:

set_target_structure(index: number, structure: string, startAt: number = 0): void

This will work just like the “paste target structure” feature in the game (index refers to the 0-based index of the state, like other commands)

1 Like

New APIs are available now on web, mobile release in a day or two

@jandersonlee I got an error when submitting with the Mutation booster that I thought I should pass on in case it is helpful. I had marked four bases.

It looks like it got an unexpected result from the submission attempt. The server is getting slammed right now and may have hiccoughed. I don’t do great error detection or recovery in that script and usually it runs just fine. I should probably switch to the new applet hook method for submission, but it’s probably too late to do it for this lab.

@jandersonlee Would it be possible to switch to the new submit_solution API for round 2? It would be really helpful to have the structures saved in the game database. @LFP6 can help with the implementation.

OK. @LFP6 So submit_solution(details,options) is not specifying the sequence or target structure. I’m guessing it uses the current values for both of them then? (Getting ready to update the bulk submit script.)

Correct - if you want to set a sequence use set_sequence_string, and to set a custom target structure use set_target_structure

OK. I have a v3.7 alpha02 version of the bulk submission booster up which accepts an optional 4th field with a target shape and uses the MFE from the current energy model if none is supplied.

  • seq,title,desc[,target][,boolean]

https://eternagame.org/web/script/11865367/

A trailing ,true/,false field is required if you plan to use the Like/Unlike/Prune features. It will distinguish that from the target as a valid target has only ([{.)]} characters.

It seems to work with limited testing so far. It is not as informative as the old script on why submissions fail and it does not run any faster, but it does record the target shape as the MFE shape if none was provided, or as a fourth .csv field if provided. If the target shape is exactly 100 characters long it will pad it with the lab tail structure.

@jandersonlee Can you make a few submissions using the 4th field for Jonathan to verify the database is saving properly? I don’t have any .csv handy for testing. I can test tomorrow when I have time.

@LFP6 Can you verify the MFE structure was stored for
Eterna - Invent Medicine. and
Eterna - Invent Medicine.
that I just submitted using this new booster version?

I have 4 submissions in this round. All were submitted with the new booster. Two had the fourth field specified.

https://eternagame.org/game/browse/11836497/?filter1=Id&filter1_arg1=11870608&filter1_arg2=11870608
https://eternagame.org/game/browse/11836497/?filter1=Id&filter1_arg1=11870655&filter1_arg2=11870655

Two omitted the fourth field and used the MFE as the user target:

https://eternagame.org/game/browse/11836497/?filter1=Id&filter1_arg1=11870793&filter1_arg2=11870793
https://eternagame.org/game/browse/11836497/?filter1=Id&filter1_arg1=11870801&filter1_arg2=11870801

Note the booster is tailored to the 100nt puzzles at the moment. I will try and generalize it so that it can be used for the 240nt lab shortly.

Jeff

The 240-base lab will not be high-throughput. Players will be searching papers and experimentally-validated secondary structures for possible pseudoknots. Methods higher confidence than scanning with EfoldThresh. Total slots for synthesis will be around 300.

If you could update your mutation/submission booster for the new submit_solution API, that would be fantastic to have for OpenKnot round 2. (I’m not as concerned about the target structure being stored since most players have not been setting a target structure.)