Tarskin / LaCyTools

A high-throughput data extraction package for LC-MS data.
Apache License 2.0
9 stars 5 forks source link

Extracting charge from an analyte goes wrong if elements are used (e.g. _H) #34

Closed Tarskin closed 6 years ago

Tarskin commented 6 years ago

The program currently extracts the charge from an analyte as follows:

charge = j[0].split("_")[1]

This will take the wrong section if an analyte is used with underscores, rather should split and count from the end, as LaCyTools always appends charge state and isotope, suggested change:

charge = j[0].split("_")[-2]

Tarskin commented 6 years ago

This also requires changing the 'writeResults' function, specifically line:

composition,charge,isotope = i[4][0].split("_")

Suggested change:

composition, charge, isotope = "_".join(i[4][0].split("_")[:-2]), i[4][0].split("_")[-2], i[4][0].split("_")[-1]