Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed tests/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file not shown.
133,179 changes: 133,179 additions & 0 deletions tests/data/mgfs/BSA1.mgf

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions tests/data/params/MSGFPlus_params.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Parent mass tolerance
# Examples: 2.5Da or 30ppm
# Use comma to set asymmetric values, for example "0.5Da,2.5Da" will set 0.5Da to the left (expMass<theoMass) and 2.5Da to the right (expMass>theoMass)
PrecursorMassTolerance=5ppm

# Max Number of Modifications per peptide
# If this value is large, the search will be slow
NumMods=3

# Modifications (see below for examples)
StaticMod=C2H3N1O1, C, fix, any, Carbamidomethyl # Fixed Carbamidomethyl C (alkylation)

DynamicMod=O1, M, opt, any, Oxidation # Oxidized methionine
DynamicMod=C2H2O, *, opt, Prot-N-term, Acetyl # Acetylation Protein N-term

# Fragmentation Method
# 0 means as written in the spectrum or CID if no info (Default)
# 1 means CID
# 2 means ETD
# 3 means HCD
# 4 means Merge spectra from the same precursor (e.g. CID/ETD pairs, CID/HCD/ETD triplets)
FragmentationMethodID=3

# Instrument ID
# 0 means Low-res LCQ/LTQ (Default for CID and ETD); use InstrumentID=0 if analyzing a dataset with low-res CID and high-res HCD spectra
# 1 means High-res LTQ (Default for HCD; also appropriate for high res CID); use InstrumentID=1 for Orbitrap, Lumos, and QEHFX instruments
# 2 means TOF
# 3 means Q-Exactive
InstrumentID=0

# Enzyme ID
# 0 means unspecific cleavage (cleave after any residue)
# 1 means Trypsin (Default); optionally use this along with NTT=0 for a no-enzyme-specificity search of a tryptically digested sample
# 2: Chymotrypsin, 3: Lys-C, 4: Lys-N, 5: Glu-C, 6: Arg-C, 7: Asp-N, 8: alphaLP, 9: No Cleavage (for peptidomics)
EnzymeID=1

# Isotope error range
# Takes into account of the error introduced by choosing non-monoisotopic peak for fragmentation.
# Useful for accurate precursor ion masses
# Ignored if the parent mass tolerance is > 0.5Da or 500ppm
# The combination of -t and -ti determins the precursor mass tolerance.
# e.g. "-t 20ppm -ti -1,2" tests abs(exp-calc-n*1.00335Da)<20ppm for n=-1, 0, 1, 2.
IsotopeErrorRange=-1,2

# Number of tolerable termini
# The number of peptide termini that must have been cleaved by the enzyme (default 1)
# For trypsin, 2 means fully tryptic only, 1 means partially tryptic, and 0 means no-enzyme search
NTT=2

# Control N-terminal methionine cleavage
# 0 means to consider protein N-term Met cleavage (Default)
# 1 means to ignore protein N-term Met cleavage
IgnoreMetCleavage=0

# Target/Decoy search mode
# 0 means don't search decoy database (default)
# 1 means search decoy database to compute FDR (source FASTA file must be forward-only proteins)
TDA=0

# Number of Threads (by default, uses all available cores)
NumThreads=1

# Minimum peptide length to consider
MinPepLength=6

# Maximum peptide length to consider
MaxPepLength=50

# Minimum precursor charge to consider (if not specified in the spectrum)
MinCharge=2

# Maximum precursor charge to consider (if not specified in the spectrum)
MaxCharge=5

# Number of matches per spectrum to be reported
# If this value is greater than 1, the FDR values computed by MS-GF+ will be skewed by high-scoring 2nd and 3rd hits
NumMatchesPerSpec=5

# Amino Acid Modification Examples
# Specify static modifications using one or more StaticMod= entries
# Specify dynamic modifications using one or more DynamicMod= entries
# Modification format is:
# Mass or CompositionString, Residues, ModType, Position, Name (all five fields are required).
# CompositionString can only contain a limited set of elements, primarily C H N O S or P
#
# Examples:
# C2H3N1O1, C, fix, any, Carbamidomethyl # Fixed Carbamidomethyl C (alkylation)
# O1, M, opt, any, Oxidation # Oxidation M
# 15.994915, M, opt, any, Oxidation # Oxidation M (mass is used instead of CompositionString)
# H-1N-1O1, NQ, opt, any, Deamidated # Negative numbers are allowed.
# CH2, K, opt, any, Methyl # Methylation K
# C2H2O1, K, opt, any, Acetyl # Acetylation K
# HO3P, STY,opt, any, Phospho # Phosphorylation STY
# C2H3NO, *, opt, N-term, Carbamidomethyl # Variable Carbamidomethyl N-term
# H-2O-1, E, opt, N-term, Glu->pyro-Glu # Pyro-glu from E
# H-3N-1, Q, opt, N-term, Gln->pyro-Glu # Pyro-glu from Q
# C2H2O, *, opt, Prot-N-term, Acetyl # Acetylation Protein N-term
96 changes: 96 additions & 0 deletions tests/data/params/MSGFPlus_params_no_Carbamidomethyl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Parent mass tolerance
# Examples: 2.5Da or 30ppm
# Use comma to set asymmetric values, for example "0.5Da,2.5Da" will set 0.5Da to the left (expMass<theoMass) and 2.5Da to the right (expMass>theoMass)
PrecursorMassTolerance=5ppm

# Max Number of Modifications per peptide
# If this value is large, the search will be slow
NumMods=3

# Modifications (see below for examples)

DynamicMod=O1, M, opt, any, Oxidation # Oxidized methionine
DynamicMod=C2H2O, *, opt, Prot-N-term, Acetyl # Acetylation Protein N-term

# Fragmentation Method
# 0 means as written in the spectrum or CID if no info (Default)
# 1 means CID
# 2 means ETD
# 3 means HCD
# 4 means Merge spectra from the same precursor (e.g. CID/ETD pairs, CID/HCD/ETD triplets)
FragmentationMethodID=3

# Instrument ID
# 0 means Low-res LCQ/LTQ (Default for CID and ETD); use InstrumentID=0 if analyzing a dataset with low-res CID and high-res HCD spectra
# 1 means High-res LTQ (Default for HCD; also appropriate for high res CID); use InstrumentID=1 for Orbitrap, Lumos, and QEHFX instruments
# 2 means TOF
# 3 means Q-Exactive
InstrumentID=0

# Enzyme ID
# 0 means unspecific cleavage (cleave after any residue)
# 1 means Trypsin (Default); optionally use this along with NTT=0 for a no-enzyme-specificity search of a tryptically digested sample
# 2: Chymotrypsin, 3: Lys-C, 4: Lys-N, 5: Glu-C, 6: Arg-C, 7: Asp-N, 8: alphaLP, 9: No Cleavage (for peptidomics)
EnzymeID=1

# Isotope error range
# Takes into account of the error introduced by choosing non-monoisotopic peak for fragmentation.
# Useful for accurate precursor ion masses
# Ignored if the parent mass tolerance is > 0.5Da or 500ppm
# The combination of -t and -ti determins the precursor mass tolerance.
# e.g. "-t 20ppm -ti -1,2" tests abs(exp-calc-n*1.00335Da)<20ppm for n=-1, 0, 1, 2.
IsotopeErrorRange=-1,2

# Number of tolerable termini
# The number of peptide termini that must have been cleaved by the enzyme (default 1)
# For trypsin, 2 means fully tryptic only, 1 means partially tryptic, and 0 means no-enzyme search
NTT=2

# Control N-terminal methionine cleavage
# 0 means to consider protein N-term Met cleavage (Default)
# 1 means to ignore protein N-term Met cleavage
IgnoreMetCleavage=0

# Target/Decoy search mode
# 0 means don't search decoy database (default)
# 1 means search decoy database to compute FDR (source FASTA file must be forward-only proteins)
TDA=0

# Number of Threads (by default, uses all available cores)
NumThreads=1

# Minimum peptide length to consider
MinPepLength=6

# Maximum peptide length to consider
MaxPepLength=50

# Minimum precursor charge to consider (if not specified in the spectrum)
MinCharge=2

# Maximum precursor charge to consider (if not specified in the spectrum)
MaxCharge=5

# Number of matches per spectrum to be reported
# If this value is greater than 1, the FDR values computed by MS-GF+ will be skewed by high-scoring 2nd and 3rd hits
NumMatchesPerSpec=5

# Amino Acid Modification Examples
# Specify static modifications using one or more StaticMod= entries
# Specify dynamic modifications using one or more DynamicMod= entries
# Modification format is:
# Mass or CompositionString, Residues, ModType, Position, Name (all five fields are required).
# CompositionString can only contain a limited set of elements, primarily C H N O S or P
#
# Examples:
# C2H3N1O1, C, fix, any, Carbamidomethyl # Fixed Carbamidomethyl C (alkylation)
# O1, M, opt, any, Oxidation # Oxidation M
# 15.994915, M, opt, any, Oxidation # Oxidation M (mass is used instead of CompositionString)
# H-1N-1O1, NQ, opt, any, Deamidated # Negative numbers are allowed.
# CH2, K, opt, any, Methyl # Methylation K
# C2H2O1, K, opt, any, Acetyl # Acetylation K
# HO3P, STY,opt, any, Phospho # Phosphorylation STY
# C2H3NO, *, opt, N-term, Carbamidomethyl # Variable Carbamidomethyl N-term
# H-2O-1, E, opt, N-term, Glu->pyro-Glu # Pyro-glu from E
# H-3N-1, Q, opt, N-term, Gln->pyro-Glu # Pyro-glu from Q
# C2H2O, *, opt, Prot-N-term, Acetyl # Acetylation Protein N-term
64 changes: 64 additions & 0 deletions tests/integrationtests/wrappers/test_msgfplus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import xml.etree.ElementTree as ETree

import urgap


def test_searchdb_msgfplus_carbamidomethyl_in_usermods():
mgf = urgap.UFile(
uri=f"file:///{urgap._test_folder}/data/mgfs?uftype={urgap.uftypes.proteomics.converter.PYMZML_MGF}#BSA1.mgf"
)
fasta = urgap.UFile(
uri=f"file:///{urgap._test_folder}/data/fastas?uftype={urgap.uftypes.proteomics.FASTA}#BSA1.fasta"
)
unimod = urgap.UFile(
uri=f"file:///{urgap._test_folder}/data/usermods?uftype={urgap.uftypes.proteomics.MODS_XML}#unimod_no_carbamidomethyl.xml"
)
usermod = urgap.UFile(
uri=f"file:///{urgap._test_folder}/data/usermods?uftype={urgap.uftypes.proteomics.MODS_XML}#usermods_carbamidomethyl.xml"
)
params1 = urgap.UFile(
uri=f"file:///{urgap._test_folder}/data/params?uftype={urgap.uftypes.proteomics.params.MSGFPLUS_TXT}#MSGFPlus_params_no_Carbamidomethyl.txt"
)
params2 = urgap.UFile(
uri=f"file:///{urgap._test_folder}/data/params?uftype={urgap.uftypes.proteomics.params.MSGFPLUS_TXT}#MSGFPlus_params.txt"
)

urd = urgap.URunDict(
{
"parameters": {
"MsgfPlus:20240326": {},
},
"unode_parameters": {
"storage_base_uri": f"file://{urgap._test_folder}/data",
},
}
)

search_node = urgap.init_node("MsgfPlus:20240326")
search_result = search_node.run(
[mgf, fasta, params1],
urd,
)
assert search_result[0].path.exists() is True

tree = ETree.parse(search_result[0].path)
root = tree.getroot()

for ele in root.findall(".//{*}Modification"):
assert ele[0].get("name") != "Carbamidomethyl"
search_node.remove_output_folder(output_file=search_result[0])

search_result = search_node.run(
[mgf, fasta, params2],
urd,
)
assert search_result[0].path.exists() is True
tree = ETree.parse(search_result[0].path)
root = tree.getroot()

C_DETECTED = False
for ele in root.findall(".//{*}Modification"):
if ele[0].get("name") == "Carbamidomethyl":
C_DETECTED = True
assert C_DETECTED is True
search_node.remove_output_folder(output_file=search_result[0])
1 change: 1 addition & 0 deletions urgap/resources/MsgfPlus/2024_03_26/BuildSuffixArray.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"C:\Program Files\Java\jre8\bin\java.exe" -Xmx4000M -cp C:\MSGFPlus\MSGFPlus.jar edu.ucsd.msjava.msdbsearch.BuildSA -d C:\SequenceDB\MyDatabase.fasta -tda 2
6 changes: 6 additions & 0 deletions urgap/resources/MsgfPlus/2024_03_26/Convert_mzid_to_tsv.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rem Option 1:
MzidToTsvConverter.exe C:\Work\DatasetName_msgfplus.mzid -mzid:C:\Work\DatasetName_msgfplus.mzid -tsv:C:\Work\DatasetName_msgfplus.tsv -unroll -showDecoy

rem Option 2:
"C:\Program Files\Java\jre8\bin\java.exe" -Xmx2000M -cp C:\MSGFPlus\MSGFPlus.jar edu.ucsd.msjava.ui.MzIDToTsv -i C:\Work\DatasetName_msgfplus.mzid -o C:\Work\DatasetName_msgfplus.tsv -showQValue 1 -showDecoy 1 -unroll 1

77 changes: 77 additions & 0 deletions urgap/resources/MsgfPlus/2024_03_26/Docs/BuildSA.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BuildSA</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>

<body>
<h1 class="pagetitle">BuildSA</h1>

<p>
<a href="index.html">MS-GF+ Documentation home</a>
</p>

<h1>BuildSA</h1>

<p>
Index a protein database (FASTA file) for fast searching.
</p>
<div class="codePanel">
<pre class="code">Usage: java -Xmx3500M -cp MSGFPlus.jar edu.ucsd.msjava.msdbsearch.BuildSA
<span class="code-keyword">-d DatabaseFile</span> (*.fasta or *.fa or *.faa; if a directory path, index all FASTA files)
<span class="code-keyword">[-tda 0/1/2]</span> (0: Target database only, 1: Concatenated target-decoy database only, 2: Both (Default))
<span class="code-keyword">[-o OutputDir]</span> (Directory to save index files; default is the same as the input file)
<span class="code-keyword">[-decoy DecoyPrefix]</span> (Prefix for decoy protein names; default is XXX)
</pre>
</div>

<p style="color:#003366;">
<b>Parameters:</b>
</p>
<ul>
<li style="margin-bottom: 10px;">
<b>-d DatabaseFilePath</b>
<ul>
<li>Name of a protein database file, or a directory containing one or more protein database files</li>
<li>Database file names must end with ".fasta" or ".fa" or ".faa"</li>
</ul>
</li>
<li>
<b>-tda 0/1/2</b>
<ul>
<li>If 0, only "DatabaseFile" will be indexed.</li>
<li>If 1, a new database file (*.revConcat.fasta) will be generated by appending reversed proteins. This forward-reverse database will be indexed.</li>
<li>If 2, both the original database and the forward-reverse database file will be indexed.</li>
</ul>
</li>
<li>
<b>-o OutputDirectory</b>
<ul>
<li>Path to the output directory (use double quotes if the path contains spaces)</li>
<li>By default, the index files are created in the same directory as the Database</li>
</ul>
</li>
<li>
<b>-decoy DecoyPrefix</b>
<ul>
<li>Text to prepend to protein names when including decoy (reverse sequence) proteins in the .revCat.fasta file and related index files</li>
<li>Defaults to XXX (though an underscore is also added, giving names like <span class="code-keyword"><code>XXX_Contaminant_TRYP_BOVIN</code></span>)</li>
<li>Use <span class="code-keyword"><code>-decoy REV</code></span> to get names like <span class="code-keyword"><code>REV_Contaminant_TRYP_BOVIN</code></span></li>
<li>If -decoy is used with BuildSA it should also be used with <a href="MSGFPlus.html">MS-GF+</a></li>
</ul>
</li>

</ul>

<p>BuildSA creates a suffix array of the protein database. For an input database file DBFileName.fasta, BuildSA will generate 4 auxiliary files:</p>
<ul>
<li>DBFileName.canno</li>
<li>DBFileName.cnlcp</li>
<li>DBFileName.csarr</li>
<li>DBFileName.cseq</li>
</ul>
<p>BuildSA only needs to be executed once for each protein database file.</p>
</body>
</html>
Loading
Loading