Skyline external tool using SkylineTool not able to import small molecule blib from directory using AddSpectralLibrary command

support
Skyline external tool using SkylineTool not able to import small molecule blib from directory using AddSpectralLibrary command Chris Ashwood  2020-11-13
 

Hi Skyline Support Team,

I hope you are doing well.

I am currently trying to fix a new error that I have tried to fix with no avail. Has the new Skyline updates (daily or stable) changed how they handle external tool directories and paths? Or the SkylineTool?

The C# app I am developing loads small molecule spectral libraries using the SkylineTool with the following command:
_toolClient.AddSpectralLibrary("NGlyCat_Library", NGlyCatBlib);

Skyline appears to be unable to find the blib file (as shown in red in the attached image) despite the blib being in the tool directory. To my knowledge, this command has not caused any issues until I updated to the newest Skyline versions. I also get an error (shown below) that the document must be fully loaded so I cannot share the full Skyline document with the Share button.
System.IO.IOException: Settings.PeptideSettings.Libraries: null library
at pwiz.Skyline.SkylineWindow.ShareDocument() in C:\proj\pwiz_x64\pwiz_tools\Skyline\SkylineFiles.cs:line 1185

I rolled back my daily version but it did not seem to fix the issue. And I also tried an older version of my program that worked fine and it also failed.

Any help would be appreciated because I'm going a little crazy trying to find what I changed on my end to cause this issue. I have included the Skyline assay and spectral libraries in the uploaded file (Skyline_SpecLib_error.zip).

Cheers,
Chris

 
 
Nick Shulman responded:  2020-11-13
What exactly is the value of the variable "NGlyCatBlib"? It sounds like you have constructed it to be the full path to the .blib file inside of your tool's install directory.

Your tool should never add a library from the tool install directory to the user's document. The tool install directory will eventually get deleted if the user upgrades Skyline enough times. Windows keeps a few older versions of Skyline around to enable rolling back to previous versions, but eventually old tool directories get deleted.

The tool directory is somewhere the folder where Skyline got installed under AppData\Local\Apps\2.0...

The Skyline document does not contain the full path to .blib file. Instead, the .sky file contains the "Name" of the library, and the user settings file contains a mapping from library Name to where to find that library on that computer.
There is a description of how to find the user's settings file (called "user.config" somewhere under "AppData\Local\Apps\2.0\Data") here:
https://skyline.ms/wiki/home/software/Skyline/page.view?name=tip_recover_install

The user settings file is XML and you can look at it in any text editor. I expect that what you will find in there is that Skyline thinks the library "NGlyCat_Library" can be found in a folder under AppData which no longer exists. For this reason, whenever you open a document that uses a library of that name, Skyline asks you to browser for the .blib file.

I think your tool should copy the .blib file into the same folder as the user's .sky file before you call "AddSpectralLibrary".

Does this sound like what is going on? If not, I might be able to give you better advice if I could see the source code for your external tool and maybe your user.config file.

(There was a recent change in Skyline-Daily where if you launch a tutorial from the Start Page, the current working directory gets set to the folder where everything was downloaded to, but I don't think that has anything to do with the behavior you are seeing).
-- Nick
 
Chris Ashwood responded:  2020-11-14
Hi Nick,

NGlyCatBlib is a variable I set to just the name of the spectral library (e.g. NGlyCat.blib) that is in the tooldir of the zip file with the Skyline external tool exe.

Your explanation makes perfect sense why this broke. I went about loading the blib the wrong way and I think your suggestion of moving it to the document directory is perfect. I'll try that out and let you know how it goes.

I don't think the tutorial is the issue as I haven't used one recently.

Thanks again, great explanation.

Cheers,
Chris
 
Chris Ashwood responded:  2020-11-16
Hi Nick,

I modified the tool to prompt the user with a file dialog to get the full path of the downloaded file and that seems to have done the trick. Thank you!

Cheers,
Chris