Pep-Calc Microsoft Excel Add-In
Note
A less technical summary of Excel add-in usage can be found at https://www.pep-calc.com/excel/.
The VBA snippet below uses Pep-Calc API to add the custom calculation functions PTIDEPROP() and PTOIDPROP() to Microsoft Excel, and is available to download as a Microsoft Excel add-in (see Add-In Download).
Usage
PTIDEPROP() and PTOIDPROP() take the input values prop, sequence, nTerm and cTerm. The prop input can take any of the values listed in the table below. The remaining inputs describe the peptide / peptoid sequence and N- and C-terminal formulae, respectively.
Inputs should be formatted as described on the Peptide Calculator and Peptoid Calculator help pages.
Property |
Calculated Result |
Function |
Corresponding API Resource |
|---|---|---|---|
|
Sequence molecular weight, molecular formula and any of the parameters listed on the Getting Started page |
|
|
|
Peptide isoelectric point |
|
|
|
Peptide molar extinction coefficient (oxidized or reduced) |
|
Add-In Download
The code below is included in the Microsoft Excel add-in Pep-Calc.xlam, which also includes the required JsonConverter.bas, Dictionary.cls and the URLEncode() function found here - see Visual Basic for Applications (VBA) for more information.
Pep-Calc.xlam(Excel add-in)calc_example.xls(example worksheet)
Add-ins can be installed from within Excel using File > Options > Add-Ins and browsing to the downloaded .xlam file. More detailed instructions for installing Excel add-ins can be found on the Office website.
Important
.xlam files downloaded from the internet may need to be unblocked before use by right-clicking on the file and choosing Properties > General > Unblock.
'Peptide and peptoid calculation functions powered by Pep-Calc API
'https://www.pep-calc.com/
Private Function getJson(endpoint As String, sequence As String, nTerm As String, cTerm As String, masses As String)
Dim Request As Object
Dim seq, N_term, C_term, mz As String
Dim Json As Dictionary
seq = URLEncode(sequence)
N_term = URLEncode(nTerm)
C_term = URLEncode(cTerm)
If masses <> "" Then mz = URLEncode(masses)
Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
Request.Open "GET", _
"https://api.pep-calc.com" + endpoint + _
"?seq=" + seq + "&N_term=" + N_term + "&C_term=" + C_term +"&mz=" + mz
Request.Send
Set Json = JsonConverter.ParseJson(Request.ResponseText)
Set getJson = Json
End Function
Function ptideProp(prop As String, sequence As String, nTerm As String, cTerm As String)
Dim Json As Object
If prop = "iso" Then
Set Json = getJson("/peptide/iso", sequence, nTerm, cTerm, "")
ptideProp = Json("pI")
ElseIf prop = "extinctionOx" Then
Set Json = getJson("/peptide/extinction", sequence, nTerm, cTerm, "")
ptideProp = Json("oxidized")
ElseIf prop = "extinctionRed" Then
Set Json = getJson("/peptide/extinction", sequence, nTerm, cTerm, "")
ptideProp = Json("reduced")
Else
Set Json = getJson("/peptide", sequence, nTerm, cTerm, "")
ptideProp = Json(prop)
End If
End Function
Function ptoidProp(prop As String, sequence As String, nTerm As String, cTerm As String)
Dim Json As Object
Set Json = getJson("/peptoid", sequence, nTerm, cTerm, "")
ptoidProp = Json(prop)
End Function