Useful stuff!

Thursday, May 23, 2013

Recalibrate Thermo RAW files automatically


Okay.
This is AWESOME.
There are several reasons that we might want to go back and recalibrate our RAW files.  Sometimes you find out after a big experiment that someone forgot to calibrate the Orbitrap (not me, but other people!  I'm a super calibrator.  Sometimes you find out you left lockmass off.  Or you have an Orbitrap XL or Discovery and lockmass adds to your cycle time so you leave it off to dig a little deeper into your data.

Until now, there was only one way to recalibrate your RAW files and it required that you use the command prompt, you had to do it one at a time (single core, even) and it doesn't work with anything newer than a Velos.

Then we get this new free node from the Mechtler lab.  You download it, follow the simple installation instructions and then set up the workflow as shown above (there is another formation on PD-Nodes.org, but I couldn't get it to work myself), and you recalibrate your RAW files.

I pulled an old Orbitrap XL file from my postdoc and gave it a try.  I never used lockmass due to the cycle time issue on this instrument, so it made a perfect test.

206 peptides in the fraction (ran with no modifications):

Run 1:  Average mass variation:  4.65 +/- 1.15 (not too shabby for 30,000 resolution)
Run 2: (Post calibration!):  0.87 +/- 1.06

BOOM!  I exported it as an MGF file and then reimported that one back into the exact same workflow.  Sub-PPM mass accuracy on an XL without lockmass?

I don't think I have to spend a lot of time on this.  I hope the immense value of this amazing tool is apparent.  How many good peptides get dropped because they are 11 ppm out?  I'm curious, because I think there are a lot.

Another idea that just popped into my head:  If our goal is to get into the sub-ppm mass accuracy range and we can get it at 30,000 resolution or even 60,000 resolution, would we be able to save cycle time on experiments we would have ran at 100,000+ by just running them at lower resolution and then recalibrating them?

So much potential here.  I can't wait to experiment further!  Thank you Dr. Mechtler and lab!


5 comments:

  1. Hi Ben,

    Is there a publication that describes this utility and a download link? It looks very handy!

    ReplyDelete
  2. Unfortunately, there hasn't yet been a publication out of this group. There is information and the downloads are available at pd-nodes.org

    ReplyDelete
  3. Hi Ben,

    I understand I am a bit late to comment but I'm interested in the other way you mentioned that could be used to re-calibrate data from older instruments including the Velos. Is the program still around and does it have a name?

    Cheers

    ReplyDelete
    Replies
    1. Chris,
      Sure! It is called "ReCalOffline". Chances are it is actually installed on your instrument PC. If not you can go to any Xcalibur install file and find FTTools and install that whole thing. It'll put RecalOFFline and some other neat little executables on your desktop. Let me know if you can't find them -- or don't have access to the Thermo Flexera FlexNet where you can download them and I'll send you a download link for a version that is compatible with (almost) any Orbitrap files.

      Delete
    2. This blog comes up each time someone looks for
      re-calibration of thermo .raw mass spectrometry files, even though its a bit older. ;)
      The Post Search Mass Calibrator doesn't work for Compound Discoverer (as far I know).
      Thermo's ReCalOffline tool is very useful. The only drawback is that the tool doesn't allow for command line inputs or batch processing, so you will need to spend a lot of time, clicking buttons in case your batches are long. While that lets you contemplate the importance of instrument calibration before your run, it might also lead to errors and is just annoying.

      One suggestions would be to use a nifty tool like AutoHotKey to streamline the process:
      - Install AutoHotKey on the PC that runs the ReCal Offline software.
      - Make a script. (I'll add a template here, but you will need to adjust the button and cursor positions on your individual screen resolution. See the documentation of ask a AI bot).
      - Run the script and calibrate each file in 2-3 seconds.

      Also curious to hear alternatives!

      Script:

      #Requires AutoHotkey v2.0

      ;*** MANUAL EDIT 1/3 ***
      ; Change the path below to the folder with Raw data!
      MyPath := "C:\Data"

      ; *** MANUAL EDIT 2/3 ***
      ; Change the following calibration file name.
      CalFile := "LMPOS.dref"

      ; *** MANUAL EDIT 3/3 ***
      ;Change PPM error for search
      ppmtolerance := "30"



      ; Function to handle errors and exit gracefully
      ErrorExit(Message) {
      MsgBox Message
      ExitApp
      }

      ; Run the program and check if it starts successfully
      Run "C:\Xcalibur4.1\System\Programs\RecalOffline.exe"
      if (!WinWait("RecalOffline", , 5000)) {
      ErrorExit("Failed to start RecalOffline.exe. Exiting script.")
      }

      Sleep 200
      Send "^o"


      ; Moves to specified folder
      Send MyPath
      Send "{Enter}"

      Sleep 2000

      ; Wait for the user to select a file and for the dialog to close
      WaitForFileSelection()

      ; Wait until the file is opened in the program and maximise window to ensure positions are correct
      WinActivate "RecalOffline"
      WinMaximize "RecalOffline"

      ; Select the button labeled "Load Ref..."
      Send "^{Click 81 500}" ; click on Load Ref button

      ; Select call file
      Send CalFile

      Send "{Enter}"
      Sleep 1200 ; Adding a small delay to ensure the command is processed

      ; The following clicks are based on the screen position, you might need to change them.
      ; Use Windows Spy for AHKv2 to find correct position
      ; Mass Tolerance
      Send "{Click 180 584}"
      Send "{BackSpace}"
      Send "{BackSpace}"
      Send ppmtolerance

      ;Press use for each ion
      Send "{Click 417 152}"
      Send "{Click 417 172}"
      Send "{Click 417 195}"
      Send "{Click 417 218}"
      Send "{Click 417 240}"
      Send "{Click 417 260}"
      Send "{Click 417 282}"
      ; Recalibration (per Scan)
      Send "{Click 250 644}"
      ; Search
      Send "{Click 88 744}"
      Sleep 300
      ; Convert
      Send "{Click 375 746}"
      Send "{Enter}"

      IB := InputBox("Continue with next file?")
      if IB.Result = "OK"{
      Reload
      }else{
      MsgBox "Unclear to proceed, stopping run."
      Exit
      }

      Sleep 1000

      Exit

      ; Function to wait until a file is selected and the dialog closes
      WaitForFileSelection() {
      Loop {
      ; Check if the window title of the file explorer has changed
      if !WinActive("Open") {
      ; Small delay to ensure stability
      Sleep 100
      if !WinExist("Open") {
      Break
      }
      }
      Sleep 100
      }
      }

      Delete