File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -149,9 +149,15 @@ def _infer_charge_columns(fieldnames):
149149 @staticmethod
150150 def _parse_peptidoform (percolator_peptide , charge ):
151151 """Parse Percolator TSV peptide notation to Peptidoform."""
152- # Remove leading and trailing amino acids
152+ # Remove leading and trailing amino acids (e.g., R.PEPTIDE.S -> PEPTIDE)
153153 match = re .match (r"^(?:[A-Z-])?\.(.+)\.(?:[A-Z-])?$" , percolator_peptide )
154154 peptidoform = match [1 ] if match else percolator_peptide
155+ # Handle Comet's n-terminal modification format: n[42.0106]PEPTIDE
156+ peptidoform = re .sub (r'^n\[([+-]?[\w\.]*?)\]' , r'[\1]-' , peptidoform )
157+
158+ # Ensure positive values inside square brackets have a '+' sign
159+ peptidoform = re .sub (r'\[(\d+[\.]*\d*)]' , r'[+\1]' , peptidoform )
160+
155161 if charge :
156162 peptidoform += f"/{ charge } "
157163 return Peptidoform (peptidoform )
You can’t perform that action at this time.
0 commit comments