Elemental bioimaging by means of fast scanning laser ablation-inductively coupled plasma-mass spectrometry
Christoph A. Wehe,1 Georgina M. Thyssen,1 Christina Herdering,1 Indra Raj,2 Giuliano Ciarimboli,2 Michael Sperling,1,3 and Uwe Karst*1
1 University of Münster, Institute of Inorganic and Analytical Chemistry, Corrensstr. 28/30, 48149 Münster, Germany
2 University of Münster, University Hospital, Medical Clinic D, Experimental Nephrology and Interdisciplinary Center for Clinical Research (IZKF), Albert-Schweitzer-Campus 1 – A14, 48149 Münster, Germany
3 European Virtual Institute for Speciation Analysis (EVISA), Mendelstr. 11, 48149 Münster, Germany
Supporting Information
1
HOW TO USE THE VBA MACROS
The intent of this supporting information is to show how VBA macros were used to transform the raw data obtained from the transient survey scan acquisitions to final CSV files, which are loadable in ImageJ or Origin.
As Microsoft Excel since its 2007 version is limited to a worksheet size of 1,048,576 rows and 16,384 columns, it is important to select the right export settings in the Qtegra ISDS software: If transient survey scans have been acquired, the scanned masses have to be exported separately from the raw intensities. This can be done as the corresponding information are marked in the export window of the software as X (masses) and Y (intensities). The line by line export option should not be enabled, but “,” should be chosen as separator for the CSV export. Afterwards, the attached macros can be loaded into Excel beginning with the sub named “CAW_Imaging()”. After starting, the macro will ask to state the path of both exported CSV files beginning with X and then Y. The number of lines, the mass region as well as the number of data points are displayed. Afterwards, the mass region of interest can be typed. The macro will start to search for masses within the stated region and will add up all intensities for each pixel. Depending on the hardware used, this step may be time demanding. In the tab “Export”, the cumulated results can be found, ready to be saved as e.g. CSV for import in ImageJ. The macro named “Sub CAW_Sum_Spectra()” can be used to generate isotopic patterns for the complete image. After the first macro has successfully imported the data, it can be started, showing again all critical parameters and beginning to sum all intensities according to their m/z ratio. Afterwards, a plot of the scanned mass region will be automatically created.
Sub CAW_Imaging()
'
' This macro was created at the University of Münster, Institute of Inorganic and Analytical Chemistry, Germany and published as part of a research paper.
' In case of any questions, please do not hesitate to contact the authors.
Dim strFileX As String
Dim strFileY As String
Dim srcX As Workbook
Dim srcY As Workbook
Dim expWB As Worksheet
Dim X As Worksheet
Dim Y As Worksheet
Dim TMP As Worksheet
Dim Lines As Long
Dim Linescorr As Long
Dim Runs As Long
Dim Runscorr As Long
Dim Points As Long
Dim Pointscorr As Long
Dim lowmass As Double
Dim highmass As Double
Dim lowcut As Double
Dim highcut As Double
Dim i As Long
Dim j As Long
Dim k As Long
Dim l As Long
Dim m As Long
Dim n As Long
Dim hlp As Double
Application.ScreenUpdating = False
Application.DisplayAlerts = False
While Worksheets.Count > 1
Worksheets(2).Delete
Wend
Worksheets(1).Range("A1:XFD99999").ClearContents
Worksheets(1).Name = "Table1"
Application.DisplayAlerts = True
strFileX = Application.GetOpenFilename("File (*.csv),*.csv", False, "Select X data's CSV file", False, False)
strFileY = Application.GetOpenFilename("File (*.csv),*.csv", False, "Select Y data's CSV file", False, False)
Set TMP = Worksheets.Add
With TMP
.Name = "Tempo"
.Move after:=Sheets(Sheets.Count)
End With
Set expWB = Worksheets.Add
With expWB
.Name = "Export"
.Move after:=Sheets(Sheets.Count)
End With
Set X = Worksheets.Add
With X
.Name = "X data"
.Move after:=Sheets(Sheets.Count)
End With
Set Y = Worksheets.Add
With Y
.Name = "Y data"
.Move after:=Sheets(Sheets.Count)
End With
Set srcX = Workbooks.Open(Filename:=strFileX, Local:=True)
Cells.Copy
X.Activate
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
srcX.Close
Set srcY = Workbooks.Open(Filename:=strFileY, Local:=True)
Cells.Copy
Y.Activate
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
srcY.Close
Lines = WorksheetFunction.CountA(Sheets("X data").Range("1:1"))
Linescorr = Lines
Runs = WorksheetFunction.CountA(Sheets("X data").Range("B:B"))
Runs = Runs + 2
Runscorr = (Sheets("X data").Cells(Runs, 2).Value) + 1
X.Activate
Points = Application.WorksheetFunction.CountIf(Range("B:B"), 0)
Pointscorr = Points + 2
lowmass = (Sheets("X data").Cells(3, 5).Value)
highmass = (Sheets("X data").Cells(Pointscorr, 5).Value)
Worksheets(1).Activate
MsgBox "Number of lines = " & Linescorr & vbCrLf & "Number of runs = " & Runscorr & vbCrLf & "Number of data points = " & Points & vbCrLf & "Mass range = " & lowmass & " - " & highmass
lowcut = InputBox("Insert lower mass range border", "Low mass border")
highcut = InputBox("Insert upper mass range border", "High mass border")
For m = 1 To Linescorr
n = m + 4
For j = 0 To (Runscorr - 1)
k = j + 1
For i = ((Points * j) + 3) To ((Points * k) + 3)
If (Sheets("X data").Cells(i, n).Value >= lowcut) Then
If (Sheets("X data").Cells(i, n).Value <= highcut) Then
Sheets("Y data").Cells(i, n).Copy
TMP.Select
Range(Cells(i - 2, k), Cells(i - 2, k)).Select
ActiveSheet.Paste
Else
End If
Else
End If
Next
Next
For l = 1 To Runscorr
TMP.Select
hlp = Application.WorksheetFunction.Sum(Range(TMP.Cells(1, l), TMP.Cells(99999, l)))
expWB.Select
Range(expWB.Cells(m, l), expWB.Cells(m, l)).Value = hlp
Next
TMP.Range("A1:XFD99999").ClearContents
Next
End Sub
Sub CAW_Sum_Spectra()
'
' This macro was created at the University of Münster, Institute of Inorganic and Analytical Chemistry, Germany and published as part of a research paper.
' In case of any questions, please do not hesitate to contact the authors.
Dim PlotWS As Worksheet
Dim PlotWB As Worksheet
Dim Lines As Long
Dim Linescorr As Long
Dim Runs As Long
Dim Runscorr As Long
Dim Points As Long
Dim Pointscorr As Long
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
Dim e As Long
Dim f As Long
Dim g As Long
Dim h As Long
Dim o As Long
Dim p As Long
Application.ScreenUpdating = False
Set PlotWS = Worksheets.Add
With PlotWS
.Name = "PlotWS"
.Move after:=Sheets(Sheets.Count)
End With
Set PlotWB = Worksheets.Add
With PlotWB
.Name = "PlotWB"
.Move after:=Sheets(Sheets.Count)
End With
Lines = WorksheetFunction.CountA(Sheets("X data").Range("1:1"))
Linescorr = Lines
Runs = WorksheetFunction.CountA(Sheets("X data").Range("B:B"))
Runs = Runs + 2
Runscorr = (Sheets("X data").Cells(Runs, 2).Value) + 1
Sheets("X data").Activate
Points = Application.WorksheetFunction.CountIf(Range("B:B"), 0)
Pointscorr = Points + 2
For a = 0 To (Runscorr - 1)
b = (Points * a) + 3
c = a + 1
d = (Points * c) + 2
e = 5 + Runscorr - 1
p = 0
For f = b To d
p = p + 1
Sheets("Y data").Select
hlp = Application.WorksheetFunction.Sum(Range(Sheets("Y data").Cells(f, 5), Sheets("Y data").Cells(f, e)))
PlotWS.Select
PlotWS.Range(PlotWS.Cells(c, p), PlotWS.Cells(c, p)).Value = hlp
Next
Next
For g = 1 To Points
PlotWS.Select
hlp = Application.WorksheetFunction.Sum(Range(PlotWS.Cells(1, g), PlotWS.Cells(Runscorr, g)))
PlotWB.Select
PlotWB.Range(PlotWB.Cells(g, 2), PlotWB.Cells(g, 2)).Value = hlp
Next
For h = 1 To Points
o = h + 2
Sheets("X data").Range(Sheets("X data").Cells(o, 5), Sheets("X data").Cells(o, 5)).Copy _
Destination:=PlotWB.Range(PlotWB.Cells(h, 1), PlotWB.Cells(h, 1))
Next
Application.ScreenUpdating = True
PlotWB.Select
Columns("A:B").Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
ActiveChart.SetSourceData Source:=Range("PlotWB!$A:$B")
ActiveChart.ChartTitle.Select
Selection.Delete
End Sub
1