Parsing parameters values that contain "$" sign.

Hello,

 

I developed a protocol for which I defined two parameters:

  1. An URLType parameter named 'Docked ligand library' and

    2. A StringType parameter named 'Multiconformer library'.

The idea of these two parameters is to load an .sd/.sdf file in the 'Docked ligand library'. Once the library is loaded, then to autofill the 'Multiconformer library'. Since, the value of 'Docked ligand library' parameter is as \\\$(UserDir)/shapescr/Ec_NBTIs_neg_con_sols.sd, I tried to parse it within the 'Multiconformer library' parameter Legal Values Script window:

if (Parameter('Docked ligand library') ne '') then
SetLegalValues(RSubst(RMatch(RSubst(Parameter('Docked ligand library'),'_sols.sd','_4D.sdf'),'/([^/]+)\\\$','g'),'/',''));
end if;

 So, the expected value for the 'Multiconformer library' should be: Ec_NBTIs_neg_con_4D.sdf

 

However, it seems that the dollar sign of \\\$(UserDir) is the major problem, so when I manually remove it, the needed output is obtained. How to get rid of "\\\$" sign to achieve what I described?

 

Although, my attempt resulting (at least conceptually) in a selection list for the 'Multiconformer library' parameter, ideally I would like to be just a single string value containing the name 'Ec_NBTIs_neg_con_4D.sdf' (parsed as described above).

 

Many thanks to all of you for providing a solution to this issue.

 

Cheers,

Nikola

Answers 4
AC
AC 2024-02-27

Hi @NM. This is an interesting problem. I did a quick test on my side, and I saw the same behaviour as you did. I then looked in the Pipeline Pilot client log and noticed that there was an error stating that  "the value of parameter 'Docked ligand library' contained a global token '$(UserDir)/...". I suspect that Pipeline Pilot does not allow this operation because these $() tokens can only be replaced with the value of the global with the same name when the protocol is initialized (run). Before you hit the start button, the value of that token is still $(UserDir), and I assume the developers put in a check to prevent the value being used in scripts that execute before the protocol is run. In newer versions of Pipeline Pilot (I think 2020 and later), the UserDir global and the need to use $(UserDir) has been replacaed by the token 'userdata:', so in order to point to a file in the user directory, a string like this would be used: 'userdata:/'. This string would allow your legal values script to execute successfully. 

I assume you're running an older version of Pipeline Pilot, so in that case, why not just move your legal values script to a Custom Manipulator component placed at the top of your protocol and create a global property that has the right value for the "Multiconformer library" and just use that further in the protocol. From what I understand from your description, the legal values script would only return one value, so the user doesn't HAVE to select it, your protocol could just use the value you extract from the source parameter without user input.

NM
NM 2024-02-28

Thanks Andrei for taking this issue under consideration. The solution you proposed utilizing Custom Manipulator component was one of the first I tried and considering that our PP is quite old (Accelrys Enetrprise Platform 2014, PP 9.2) it seems that this one is the only feasible solution. Anyhow, I will leave this question open in case someone will post a brillant (hack) solution to this.

NM
NM 2024-02-29

Related to our outdated DS/PP packages I would also like to ask about the possibility to (re)activate the maintenance (access to updates, which was ~1K euros/year) without buying the entire platform again (we are issuers of a perpetual license since 2014, which was not very cheap, around 50k euros). As an administrator of DS/PP at our institute, it would be perfect if you can address me to the right person(s) at Biovia for solving this, as well. Many thanks for all the help, Nikola

SB
SB 2024-02-28

Hi @NM ,  @AC  is correct in his analysis that the legal values script executes on the client side, so does not have the ability to evaluate global tokens within parameters.  However, the "Parameter()" function has an optional second argument that can be used to overcome this.  From the PilotScript help: 
```
String Parameter(String name, Number flags)

The argument "flags" is optional. It supports the following values:

0 - The Parameter() function returns the evaluated value of the parameter without translating the global tokens in the form $(globalName).
1 - The Parameter() function returns the evaluated value of the parameter. If there are global tokens, an error is raised. (This is the default if the "flags" argument is not specified.)
2 - The Parameter() function returns the raw value of the parameter.
```

So, in your case, since the evaluated global is not relevant, change your Parameter calls either to Parameter('Docked ligand library', 0) or Parameter('Docked ligand library', 2) and this should have the desired effect