Skip to content

Commit

Permalink
✨ Add parsing of attributes for MaxQuant 1.5
Browse files Browse the repository at this point in the history
- from 1.6 onwords, information is given explicitly
  • Loading branch information
Henry committed Nov 19, 2023
1 parent df208d2 commit 5a95fa0
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 1 deletion.
4 changes: 3 additions & 1 deletion proteobench/io/params/maxquant.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def add_record(data: dict, tag: str, record) -> dict:
def read_xml_record(element: ET.Element) -> dict:
"""Read entire record in a nested dict structure."""
data = dict()
if element.attrib:
data.update(element.attrib)
for child in element:
if len(child) > 1 and child.tag:
# if there is a list, process each element one by one
Expand Down Expand Up @@ -125,7 +127,7 @@ def flatten_dict_of_dicts(d: dict, parent_key: str = "") -> dict:
def build_Series_from_records(records, index_length=4):
records = flatten_dict_of_dicts(records)
idx = pd.MultiIndex.from_tuples(
(extend_tuple(k, index_length) for (k, v) in records)
(extend_tuple(k, index_length) for (k, _) in records)
)
return pd.Series((v for (k, v) in records), index=idx)

Expand Down
60 changes: 60 additions & 0 deletions test/params/mqpar1.5.3.30_MBR.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
,,,,run_identifier
aifSilWeight,,,,0
aifIsoWeight,,,,0
aifTopx,,,,0
aifCorrelation,,,,0
aifCorrelationFirstPass,,,,0
aifMinMass,,,,0
aifMsmsTol,,,,0
aifSecondPass,,,,false
aifIterative,,,,false
aifThresholdFdr,,,,0
writeMsScansTable,,,,true
writeMsmsScansTable,,,,true
writeMs3ScansTable,,,,true
writeAllPeptidesTable,,,,true
writeMzRangeTable,,,,true
disableMd5,,,,false
name,,,,Session1
maxQuantVersion,,,,1.5.3.30
tempFolder,,,,
Expand Down Expand Up @@ -187,15 +203,59 @@ numberOfCandidatesMultiplexedMsms,,,,25
numberOfCandidatesMsms,,,,15
massDifferenceMods,,,,
mainSearchMaxCombinations,,,,200
msmsParamsArray,msmsParams,Name,,FTMS
msmsParamsArray,msmsParams,MatchToleranceInPpm,,true
msmsParamsArray,msmsParams,DeisotopeToleranceInPpm,,true
msmsParamsArray,msmsParams,DeNovoToleranceInPpm,,true
msmsParamsArray,msmsParams,Deisotope,,true
msmsParamsArray,msmsParams,Topx,,12
msmsParamsArray,msmsParams,HigherCharges,,true
msmsParamsArray,msmsParams,IncludeWater,,true
msmsParamsArray,msmsParams,IncludeAmmonia,,true
msmsParamsArray,msmsParams,DependentLosses,,true
msmsParamsArray,msmsParams,Recalibration,,false
msmsParamsArray,msmsParams,MatchTolerance,,20
msmsParamsArray,msmsParams,DeisotopeTolerance,,7
msmsParamsArray,msmsParams,DeNovoTolerance,,10
msmsParamsArray,msmsParams,Name,,ITMS
msmsParamsArray,msmsParams,MatchToleranceInPpm,,false
msmsParamsArray,msmsParams,DeisotopeToleranceInPpm,,false
msmsParamsArray,msmsParams,DeNovoToleranceInPpm,,false
msmsParamsArray,msmsParams,Deisotope,,false
msmsParamsArray,msmsParams,Topx,,8
msmsParamsArray,msmsParams,HigherCharges,,true
msmsParamsArray,msmsParams,IncludeWater,,true
msmsParamsArray,msmsParams,IncludeAmmonia,,true
msmsParamsArray,msmsParams,DependentLosses,,true
msmsParamsArray,msmsParams,Recalibration,,false
msmsParamsArray,msmsParams,MatchTolerance,,0.5
msmsParamsArray,msmsParams,DeisotopeTolerance,,0.15
msmsParamsArray,msmsParams,DeNovoTolerance,,0.25
msmsParamsArray,msmsParams,Name,,TOF
msmsParamsArray,msmsParams,MatchToleranceInPpm,,true
msmsParamsArray,msmsParams,DeisotopeToleranceInPpm,,false
msmsParamsArray,msmsParams,DeNovoToleranceInPpm,,false
msmsParamsArray,msmsParams,Deisotope,,true
msmsParamsArray,msmsParams,Topx,,10
msmsParamsArray,msmsParams,HigherCharges,,true
msmsParamsArray,msmsParams,IncludeWater,,true
msmsParamsArray,msmsParams,IncludeAmmonia,,true
msmsParamsArray,msmsParams,DependentLosses,,true
msmsParamsArray,msmsParams,Recalibration,,false
msmsParamsArray,msmsParams,MatchTolerance,,40
msmsParamsArray,msmsParams,DeisotopeTolerance,,0.01
msmsParamsArray,msmsParams,DeNovoTolerance,,0.02
msmsParamsArray,msmsParams,Name,,Unknown
msmsParamsArray,msmsParams,MatchToleranceInPpm,,false
msmsParamsArray,msmsParams,DeisotopeToleranceInPpm,,false
msmsParamsArray,msmsParams,DeNovoToleranceInPpm,,false
msmsParamsArray,msmsParams,Deisotope,,false
msmsParamsArray,msmsParams,Topx,,8
msmsParamsArray,msmsParams,HigherCharges,,true
msmsParamsArray,msmsParams,IncludeWater,,true
msmsParamsArray,msmsParams,IncludeAmmonia,,true
msmsParamsArray,msmsParams,DependentLosses,,true
msmsParamsArray,msmsParams,Recalibration,,false
msmsParamsArray,msmsParams,MatchTolerance,,0.5
msmsParamsArray,msmsParams,DeisotopeTolerance,,0.15
msmsParamsArray,msmsParams,DeNovoTolerance,,0.25
Expand Down
60 changes: 60 additions & 0 deletions test/params/mqpar1.5.3.30_MBR.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{
"aifSilWeight": "0",
"aifIsoWeight": "0",
"aifTopx": "0",
"aifCorrelation": "0",
"aifCorrelationFirstPass": "0",
"aifMinMass": "0",
"aifMsmsTol": "0",
"aifSecondPass": "false",
"aifIterative": "false",
"aifThresholdFdr": "0",
"writeMsScansTable": "true",
"writeMsmsScansTable": "true",
"writeMs3ScansTable": "true",
"writeAllPeptidesTable": "true",
"writeMzRangeTable": "true",
"disableMd5": "false",
"name": "Session1",
"maxQuantVersion": "1.5.3.30",
"tempFolder": null,
Expand Down Expand Up @@ -425,27 +441,71 @@
"msmsParamsArray": [
{
"msmsParams": {
"Name": "FTMS",
"MatchToleranceInPpm": "true",
"DeisotopeToleranceInPpm": "true",
"DeNovoToleranceInPpm": "true",
"Deisotope": "true",
"Topx": "12",
"HigherCharges": "true",
"IncludeWater": "true",
"IncludeAmmonia": "true",
"DependentLosses": "true",
"Recalibration": "false",
"MatchTolerance": "20",
"DeisotopeTolerance": "7",
"DeNovoTolerance": "10"
}
},
{
"msmsParams": {
"Name": "ITMS",
"MatchToleranceInPpm": "false",
"DeisotopeToleranceInPpm": "false",
"DeNovoToleranceInPpm": "false",
"Deisotope": "false",
"Topx": "8",
"HigherCharges": "true",
"IncludeWater": "true",
"IncludeAmmonia": "true",
"DependentLosses": "true",
"Recalibration": "false",
"MatchTolerance": "0.5",
"DeisotopeTolerance": "0.15",
"DeNovoTolerance": "0.25"
}
},
{
"msmsParams": {
"Name": "TOF",
"MatchToleranceInPpm": "true",
"DeisotopeToleranceInPpm": "false",
"DeNovoToleranceInPpm": "false",
"Deisotope": "true",
"Topx": "10",
"HigherCharges": "true",
"IncludeWater": "true",
"IncludeAmmonia": "true",
"DependentLosses": "true",
"Recalibration": "false",
"MatchTolerance": "40",
"DeisotopeTolerance": "0.01",
"DeNovoTolerance": "0.02"
}
},
{
"msmsParams": {
"Name": "Unknown",
"MatchToleranceInPpm": "false",
"DeisotopeToleranceInPpm": "false",
"DeNovoToleranceInPpm": "false",
"Deisotope": "false",
"Topx": "8",
"HigherCharges": "true",
"IncludeWater": "true",
"IncludeAmmonia": "true",
"DependentLosses": "true",
"Recalibration": "false",
"MatchTolerance": "0.5",
"DeisotopeTolerance": "0.15",
"DeNovoTolerance": "0.25"
Expand Down

0 comments on commit 5a95fa0

Please sign in to comment.