External tool accessing multiple reports and not recognizing path to R lilian heil  2024-08-19 11:45
 

Hi!

I am trying to write a tool that plots cal curves. So I need a report that has information on intensity for each replicate, as well as cal curve information (slope, LOD, LOQ, etc). I can write this all to one report, but it takes forever. If I remember correctly, it recalculates LOD and LOQ for every line in the table. I really only need that once per peptide, but I may have 12+ rows per peptide. Normally I just write two reports: one that has info on cal curve (one row per peptide), and one that has a row for each point on the cal curve. Is there a way to get an external tool to use these two reports? Or would you suggest another way to do this? It can take a very long time to write the report as is.

Another small thing, I am unable to get Skyline to recognize the path to R.exe. The only reason I can think it's doing this is because there is a space in the path (C:\Program Files\R\R-4.3.1\bin\x64\R.exe). When I run in command line I normally have to add quotation marks around the path name, but Skyline still can't find path when I manually specify pathname, and the macro also has space in name and it gives the same error. Is there a way around this besides moving R installation directory?

Thanks,

Lilian

 
 
lilian heil responded:  2024-08-19 12:01
This is the exact error I get for the path to R. This is the correct path to my R installation, I can usually call R from this path if it's in quotation marks.

---------------------------
Skyline-daily
---------------------------
File not found.
C:\Program Files\R\R-4.3.1\bin\R.exe
Please check the command location is correct for this tool.
---------------------------
OK More Info
---------------------------
Skyline-daily (64-bit) 24.1.1.202 (c511d22bf)

pwiz.Skyline.Model.Tools.ToolExecutionException: File not found.
C:\Program Files\R\R-4.3.1\bin\R.exe
Please check the command location is correct for this tool. ---> System.ComponentModel.Win32Exception: The directory name is invalid
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at pwiz.Skyline.ToolsUI.ToolDescriptionRunUI.RunExecutableBackground(ToolDescription toolDesc, SrmDocument document, IToolMacroProvider toolMacroProvider, TextWriter textWriter, IProgressMonitor progressMonitor, Control parent) in C:\proj\pwiz\pwiz_tools\Skyline\ToolsUI\ToolDescriptionRunUI.cs:line 268
   --- End of inner exception stack trace ---
   at pwiz.Skyline.ToolsUI.ToolDescriptionRunUI.RunExecutableBackground(ToolDescription toolDesc, SrmDocument document, IToolMacroProvider toolMacroProvider, TextWriter textWriter, IProgressMonitor progressMonitor, Control parent) in C:\proj\pwiz\pwiz_tools\Skyline\ToolsUI\ToolDescriptionRunUI.cs:line 309
   at pwiz.Skyline.ToolsUI.ToolDescriptionRunUI.<>c__DisplayClass4_0.<RunExecutable>b__0() in C:\proj\pwiz\pwiz_tools\Skyline\ToolsUI\ToolDescriptionRunUI.cs:line 164
---------------------------
 
Nick Shulman responded:  2024-08-19 12:02

If your external tool is written in R, you would usually just tell Skyline which version of R you are using and Skyline will take care of installing that version of R as well as all of the packages that you need.
The best example of this is the MSstats external tool.
https://github.com/ProteoWizard/pwiz/tree/master/pwiz_tools/Skyline/Executables/Tools/MSstats/tool-inf
The tool-inf/info.properties file tells Skyline which version of R is being used, and what the required packages are:
If Skyline notices that any of those packages are missing, Skyline will run the tool-inf/InstallPackages.r script.
And then the .properties file for your menu item would have something like Command =$(ProgramPath(R,4.2.2)) and Skyline would look in the Windows Registry to figure out where that particular version of R is.

There is not a simple way to get an external tool to use two reports.
If you are writing your external tool in C# you can use the "Tool Service API" to call back into Skyline to request more reports.
I think there are some examples of how to do that in the PRM Conductor external tool:
https://skyline.ms/skyts/home/software/Skyline/tools/details.view?name=PRM Conductor

It would be helpful if you could send me your report and Skyline document where the figures of merit are slow. It might be that the only thing you can do is split the report into two separate reports, but it's also possible that Skyline is doing something inefficient that I should fix.

You can use the checkboxes on the "Reports" tab of the document settings dialog ("Settings > Document Settings") to add your report definition to the Skyline document.
Then you can use the "File > Share" menu item to create a .zip file containing your Skyline document and supporting files including extracted chromatograms and the document will also include the report definitions of all of the checked reports from the Document Settings dialog.

Files which are less than 50MB can be attached to these support requests. You can always upload larger files here:
https://skyline.ms/files.url
-- Nick

 
lilian heil responded:  2024-08-19 17:02

Hi Nick,

Thanks! I was reading R in that way, but it didn't work for some reason. Reinstalled and it's working now, false alarm. Uploaded example doc: P1_Neo_60SPD_DilutionCurve_Adjust_Bounds_Opt_Trans_Test.sky.zip. Forgot to save with report, so attached that here.

I actually took out most of the peptides to speed things up when testing, there were originally hundreds in the document.

-Lilian

 
Nick Shulman responded:  2024-08-20 13:31
Lilian,
I probably won't be able to make that report of yours any faster. Also, with the new way of calculating figures of merit using bootstrap curves it will probably become even slower.

It is actually possible to use the Tool Service API from other languages such as R and Python.

I have written a command-line program called ToolServiceCmd.exe which uses the Tool Service API to call into Skyline.
So far, the only real thing that it supports calling is "GetReport".
There is an example R program which uses it here:
https://proteome.gs.washington.edu/~nicksh/ExternalToolExamples/ExampleCmdTool.zip
You can add this to Skyline with the "Add > From File" button at "Tools > External Tools".
After you do that, there will be two new menu items on the "Tools" menu: "Count Proteins Using R" and "Count Proteins Using Python" which both use ToolServiceCmd.exe to tell Skyline to execute a report.

If calling back into Skyline from R is something you would like to be able to do, I could try to make "ToolServiceCmd.exe" work better.
-- Nick
 
lilian heil responded:  2024-08-26 09:11
Got it, thanks. I will think about how to do this. Thanks!

-Lilian