diff --git a/wwpdb/utils/nmr/AlignUtil.py b/wwpdb/utils/nmr/AlignUtil.py index 66993bcf..047fd558 100644 --- a/wwpdb/utils/nmr/AlignUtil.py +++ b/wwpdb/utils/nmr/AlignUtil.py @@ -647,6 +647,28 @@ def getRestraintFormatName(fileType: str, ambig: bool = False) -> str: if fileType == 'nm-res-xpl': return 'XPLOR-NIH/CNS restraint' if ambig else 'XPLOR-NIH restraint' + if fileType == 'nm-aux-xea': + return 'XEASY PROT assignment' + + if fileType == 'nm-pea-ari': + return 'ARIA spectral peak list' + if fileType == 'nm-pea-pip': + return 'NMRPIPE spectral peak list' + if fileType == 'nm-pea-spa': + return 'SPARKY spectral peak list' + if fileType == 'nm-pea-top': + return 'TOPSPIN spectral peak list' + if fileType == 'nm-pea-viw': + return 'NMRVIEW spectral peak list' + if fileType == 'nm-pea-vnm': + return 'VNMR spectral peak list' + if fileType == 'nm-pea-xea': + return 'XEASY spectral peak list' + if fileType == 'nm-pea-xwi': + return 'XWINNMR spectral peak list' + if fileType == 'nm-pea-any': + return 'other spectral peak list' + return 'other restraint' diff --git a/wwpdb/utils/nmr/NmrDpReport.py b/wwpdb/utils/nmr/NmrDpReport.py index d4d2cb5c..95d5301c 100644 --- a/wwpdb/utils/nmr/NmrDpReport.py +++ b/wwpdb/utils/nmr/NmrDpReport.py @@ -89,6 +89,7 @@ # 19-Nov-2024 M. Yokochi - add support for pH titration data (NMR restraint remediation) # 22-Nov-2024 M. Yokochi - add 'nm-res-noa' file type for CYANA NOA (NOE Assignment) file # 05-Dec-2024 M. Yokochi - add 'nm-aux-xea' file type for XEASY PROT (Assignment) file (NMR restraint remediation) +# 16-Dec-2024 M. Yokochi - add 'nm-pea-vnm' file types for VNMR spectral list file (NMR restraint remediation) ## """ Wrapper class for NMR data processing report. @author: Masashi Yokochi @@ -1759,7 +1760,7 @@ def __init__(self, verbose: bool = True, log: IO = sys.stdout): 'nm-res-noa', 'nm-res-oth', 'nm-res-ros', 'nm-res-sax', 'nm-res-syb', 'nm-res-xpl', 'nm-pea-any', 'nm-pea-ari', 'nm-pea-pip', 'nm-pea-spa', 'nm-pea-top', - 'nm-pea-vie', 'nm-pea-xea', 'nm-pea-xwi') + 'nm-pea-vie', 'nm-pea-vnm', 'nm-pea-xea', 'nm-pea-xwi') self.content_types = ('model', 'nmr-data-nef', 'nmr-data-str', 'nmr-chemical-shifts', 'nmr-restraints', 'nmr-peaks') @@ -1868,7 +1869,7 @@ def __init__(self, verbose: bool = True, log: IO = sys.stdout): self.__lfh = log self.items = ('model_poly_seq_vs_coordinate', 'model_poly_seq_vs_nmr_poly_seq', 'nmr_poly_seq_vs_model_poly_seq', - 'model_poly_seq_vs_mr_restraint', 'model_poly_seq_vs_mr_topology', + 'model_poly_seq_vs_mr_restraint', 'model_poly_seq_vs_mr_topology', 'model_poly_seq_vs_spectral_peak', 'nmr_poly_seq_vs_chem_shift', 'nmr_poly_seq_vs_dist_restraint', 'nmr_poly_seq_vs_dihed_restraint', 'nmr_poly_seq_vs_rdc_restraint', 'nmr_poly_seq_vs_spectral_peak', 'nmr_poly_seq_vs_spectral_peak_alt', 'nmr_poly_seq_vs_noepk_restraint', 'nmr_poly_seq_vs_jcoup_restraint', diff --git a/wwpdb/utils/nmr/NmrDpUtility.py b/wwpdb/utils/nmr/NmrDpUtility.py index ec3b20a7..4511f5cf 100644 --- a/wwpdb/utils/nmr/NmrDpUtility.py +++ b/wwpdb/utils/nmr/NmrDpUtility.py @@ -200,7 +200,7 @@ # 22-Nov-2024 M. Yokochi - add support for CYANA NOA (NOE Assignment) file. file type: 'nm-res-noa' # 27-Nov-2024 M. Yokochi - implement atom name mapping history as requirement of standalone NMR data conversion service # 28-Nov-2024 M. Yokochi - drop support for old pynmrstar versions less than 3.2 -# 11-Dec-2024 M. Yokochi - Add support for spectral peak list file in native formats (NMR restraint remediation Phase 2 for legacy entries with public MR and new deposition) +# 16-Dec-2024 M. Yokochi - combine spectral peak lists written in software native formats into single NMR-STAR file (DAOTHER-8905, NMR restraint remediation Phase 2) ## """ Wrapper class for NMR data processing. @author: Masashi Yokochi @@ -320,7 +320,8 @@ NMR_STAR_LP_DATA_ITEMS, THRESHHOLD_FOR_CIRCULAR_SHIFT, PLANE_LIKE_LOWER_LIMIT, - PLANE_LIKE_UPPER_LIMIT) + PLANE_LIKE_UPPER_LIMIT, + SPECTRAL_DIM_TEMPLATE) from wwpdb.utils.nmr.mr.AmberMRReader import AmberMRReader from wwpdb.utils.nmr.mr.AmberPTReader import AmberPTReader from wwpdb.utils.nmr.mr.AriaMRReader import AriaMRReader @@ -342,6 +343,7 @@ from wwpdb.utils.nmr.pk.NmrViewPKReader import NmrViewPKReader from wwpdb.utils.nmr.pk.SparkyPKReader import SparkyPKReader from wwpdb.utils.nmr.pk.TopSpinPKReader import TopSpinPKReader + from wwpdb.utils.nmr.pk.VnmrPKReader import VnmrPKReader from wwpdb.utils.nmr.pk.XeasyPKReader import XeasyPKReader from wwpdb.utils.nmr.pk.XeasyPROTReader import XeasyPROTReader from wwpdb.utils.nmr.pk.XwinNmrPKReader import XwinNmrPKReader @@ -437,7 +439,8 @@ NMR_STAR_LP_DATA_ITEMS, THRESHHOLD_FOR_CIRCULAR_SHIFT, PLANE_LIKE_LOWER_LIMIT, - PLANE_LIKE_UPPER_LIMIT) + PLANE_LIKE_UPPER_LIMIT, + SPECTRAL_DIM_TEMPLATE) from nmr.mr.AmberMRReader import AmberMRReader from nmr.mr.AmberPTReader import AmberPTReader from nmr.mr.AriaMRReader import AriaMRReader @@ -459,6 +462,7 @@ from nmr.pk.NmrViewPKReader import NmrViewPKReader from nmr.pk.SparkyPKReader import SparkyPKReader from nmr.pk.TopSpinPKReader import TopSpinPKReader + from nmr.pk.VnmrPKReader import VnmrPKReader from nmr.pk.XeasyPKReader import XeasyPKReader from nmr.pk.XeasyPROTReader import XeasyPROTReader from nmr.pk.XwinNmrPKReader import XwinNmrPKReader @@ -552,7 +556,7 @@ seq_mismatch_warning_pattern = re.compile(r"\[Sequence mismatch warning\] \[.*\] The residue '(\d+):([0-9A-Z]+)' is not present " r"in polymer sequence of chain (\S+) of the coordinates. Please update the sequence in the Macromolecules page.") -gromacs_tag_pattern = re.compile(r'\s*[\s+[a-z0-9_]+\s+\]') +gromacs_tag_pattern = re.compile(r'\s*[\s+[0-9a-z_]+\s+\]') mismatched_input_err_msg = "mismatched input" # NOTICE: depends on ANTLR v4 extraneous_input_err_msg = "extraneous input" # NOTICE: depends on ANTLR v4 @@ -561,6 +565,8 @@ possible_typo_for_comment_out_pattern = re.compile(r'\s*([13])$') +sparky_assignment_pattern = re.compile(r'[0-9A-Za-z_\+\*\?\'\"]+-[0-9A-Za-z_\+\*\?\'\"]+\S*') + comment_code_mixed_set = {'#', '!'} default_coord_properties = {'tautomer': {}, 'rotamer': {}, 'near_ring': {}, 'near_para_ferro': {}, 'bond_length': {}, @@ -586,8 +592,8 @@ 'nm-res-syb', 'nm-res-ros', 'nm-res-xpl') parsable_pk_file_types = ('nm-aux-xea', - 'nm-pea-ari', 'nm-pea-pip', 'nm-pea-vie', 'nm-pea-spa', - 'nm-pea-top', 'nm-pea-xea', 'nm-pea-xwi') + 'nm-pea-ari', 'nm-pea-pip', 'nm-pea-spa', 'nm-pea-top', + 'nm-pea-vie', 'nm-pea-vnm', 'nm-pea-xea', 'nm-pea-xwi') def detect_bom(fPath: str, default: str = 'utf-8') -> str: @@ -1087,9 +1093,11 @@ def is_peak_list(line: str, has_header: bool = True) -> bool: """ Return whether a given input is derived from peak list in any native format. """ + col = None + if has_header and line.count('E') + line.count('e') >= 2: # XEASY peak list - s = line.split() - return 'U' in s or 'T' in s + col = line.split() + return 'U' in col or 'T' in col if 'w1' in line and 'w2' in line: # Sparky peak list return True @@ -1109,35 +1117,125 @@ def is_peak_list(line: str, has_header: bool = True) -> bool: if '' in line: # TopSpin peak list return True + if 'peak id.' in line and 'Dim 0 (ppm)' in line and 'Dim 1 (ppm)' in line: # VNMR peak list + return True + + if col is None: + col = line.split() + + if len(col) > 3 and sparky_assignment_pattern.match(col[0]): # Sparky + try: + float(col[1]) + float(col[2]) + return True + except (ValueError, TypeError): + pass + + if len(col) > 6 and sparky_assignment_pattern.match(col[6]): # VNMR 2D + try: + int(col[0]) + float(col[1]) + float(col[3]) + return True + except (ValueError, TypeError): + pass + + if len(col) > 8 and sparky_assignment_pattern.match(col[8]): # VNMR 3D + try: + int(col[0]) + float(col[1]) + float(col[3]) + float(col[5]) + return True + except (ValueError, TypeError): + pass + + if len(col) > 10 and sparky_assignment_pattern.match(col[10]): # VNMR 4D + try: + int(col[0]) + float(col[1]) + float(col[3]) + float(col[5]) + float(col[7]) + return True + except (ValueError, TypeError): + pass + return False -def get_peak_list_format(line: str, has_header: bool = True, in_type: bool = False) -> Optional[str]: +def get_peak_list_format(line: str, has_header: bool = True, as_code: bool = False) -> Optional[str]: """ Return peak list format for a given input. """ + col = None + if has_header: # and line.count('E') + line.count('e') >= 2: # XEASY peak list - s = line.split() - if 'U' in s or 'T' in s: - return 'nm-pea-xea' if in_type else 'XEASY' + col = line.split() + if 'U' in col or 'T' in col: + return 'nm-pea-xea' if as_code else 'XEASY' if 'w1' in line and 'w2' in line: # Sparky peak list - return 'nm-pea-spa' if in_type else 'Sparky' + return 'nm-pea-spa' if as_code else 'Sparky' if 'label' in line and 'dataset' in line and 'sw' in line and 'sf' in line: # NMRView peak list - return 'nm-pea-vie' if in_type else 'NMRView' + return 'nm-pea-vie' if as_code else 'NMRView' if 'VARS' in line and 'X_PPM' in line and 'Y_PPM' in line: # NMRPipe peak list - return 'nm-pea-pip' if in_type else 'NMRPipe' + return 'nm-pea-pip' if as_code else 'NMRPipe' if '' in line: # TopSpin peak list - return 'nm-pea-top' if in_type else 'TopSpin' + return 'nm-pea-top' if as_code else 'TopSpin' + + if 'peak id.' in line and 'Dim 0 (ppm)' in line and 'Dim 1 (ppm)' in line: + return 'nm-pea-vnm' if as_code else 'VNMR' + + if col is None: + col = line.split() + + if len(col) > 3 and sparky_assignment_pattern.match(col[0]): # Sparky + try: + float(col[1]) + float(col[2]) + return 'nm-pea-spa' if as_code else 'Sparky' + except (ValueError, TypeError): + pass + + if len(col) > 6 and sparky_assignment_pattern.match(col[6]): # VNMR 2D + try: + int(col[0]) + float(col[1]) + float(col[3]) + return 'nm-pea-vnm' if as_code else 'VNMR' + except (ValueError, TypeError): + pass + + if len(col) > 8 and sparky_assignment_pattern.match(col[8]): # VNMR 3D + try: + int(col[0]) + float(col[1]) + float(col[3]) + float(col[5]) + return 'nm-pea-vnm' if as_code else 'VNMR' + except (ValueError, TypeError): + pass + + if len(col) > 10 and sparky_assignment_pattern.match(col[10]): # VNMR 4D + try: + int(col[0]) + float(col[1]) + float(col[3]) + float(col[5]) + float(col[7]) + return 'nm-pea-vnm' if as_code else 'VNMR' + except (ValueError, TypeError): + pass return None @@ -1153,12 +1251,15 @@ def get_number_of_dimensions_of_peak_list(file_format: str, line: str) -> Option return int(col[-1]) if file_format == 'Sparky': + col = line.split() if 'w1' in line: - col = line.split() dim = [int(w[1:]) for w in col if w.startswith('w') and w[1:].isdigit()] if len(dim) > 0: return max(dim) + if len(col) > 3 and sparky_assignment_pattern.match(col[0]): + return col[0].count('-') + 1 + if file_format == 'NMRView': col = line.split() return len(col) @@ -1199,10 +1300,26 @@ def get_number_of_dimensions_of_peak_list(file_format: str, line: str) -> Option if '' in line: return 4 + if file_format == 'VNMR': + if 'Dim 3 (ppm)' in line: + return 4 + if 'Dim 2 (ppm)' in line: + return 3 + if 'Dim 1 (ppm)' in line: + return 2 + + col = line.split() + if len(col) > 6 and sparky_assignment_pattern.match(col[6]): + return col[6].count('-') + 1 + if len(col) > 8 and sparky_assignment_pattern.match(col[8]): + return col[8].count('-') + 1 + if len(col) > 10 and sparky_assignment_pattern.match(col[10]): + return col[10].count('-') + 1 + return None -def get_prompt_file_format(line: str) -> str: +def get_prompt_file_format(line: str) -> Optional[str]: """ Return prompt file type for a given input. """ @@ -1475,7 +1592,7 @@ def __init__(self, verbose: bool = False, log: IO = sys.stderr): self.__testSfTagConsistency, self.__testCsPseudoAtomNameConsistencyInMrLoop, self.__testCsValueConsistencyInPkLoop, - self.__testCsValueConsistencyInPkAltLoop, + self.__testCsValueConsistencyInPkAltLoop ] # validation tasks for coordinate file only @@ -1505,7 +1622,8 @@ def __init__(self, verbose: bool = False, log: IO = sys.stderr): self.__validateStrPk, self.__updateConstraintStats, self.__detectSimpleDistanceRestraint, - self.__calculateStatsOfExptlData + self.__calculateStatsOfExptlData, + self.__detectDimTransferTypeViaThroughSpace ] # nmr-*-consistency-check tasks @@ -1536,6 +1654,7 @@ def __init__(self, verbose: bool = False, log: IO = sys.stderr): self.__deleteSkippedLoop, self.__deleteUnparsedEntryLoop, self.__updatePolymerSequence, + self.__remediateRawTextPk, self.__updateAuthSequence, self.__updateDihedralAngleType, self.__fixDisorderedIndex, @@ -1596,6 +1715,7 @@ def __init__(self, verbose: bool = False, log: IO = sys.stderr): __annotateTasks.extend(__cifCheckTasks) __annotateTasks.extend(__crossCheckTasks) __annotateTasks.append(self.__updatePolymerSequence) + __annotateTasks.append(self.__remediateRawTextPk) __annotateTasks.append(self.__depositNmrData) __annotateTasks.extend(__depositTasks) __annotateTasks.append(self.__depositNmrData) @@ -7542,22 +7662,15 @@ def __initializeDpReport(self, srcPath: str = None) -> bool: convert_codec(arPath, _arPath, codec, 'utf-8') arPath = _arPath - for _file_type in parsable_pk_file_types: + file_type, _ = self.__getPeakListFileTypeAndContentSubtype(arPath) - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(arPath, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - ar['file_type'] = _file_type - break + if file_type is not None: + ar['file_type'] = file_type input_source.setItemValue('file_name', os.path.basename(arPath)) input_source.setItemValue('file_type', ar['file_type']) - input_source.setItemValue('content_type', 'nmr-restraints' if ar['file_type'] not in parsable_pk_file_types else 'nmr-peaks') + input_source.setItemValue('content_type', + 'nmr-restraints' if ar['file_type'] not in parsable_pk_file_types else 'nmr-peaks') if 'original_file_name' in ar: input_source.setItemValue('original_file_name', ar['original_file_name']) @@ -10249,8 +10362,11 @@ def __detectContentSubType__(self, file_list_id: int, input_source: NmrDpReportI if not has_spectral_peak and self.__combined_mode: + primary_spectra_for_structure_determination =\ + 'NOESY or ROESY' if self.__exptl_method != 'SOLID-STATE NMR' else 'REDOR or RFDR' + warn = "The wwPDB NMR Validation Task Force strongly encourages the submission of spectral peak lists, "\ - "in particular those generated from NOESY spectra." + f"in particular those generated from the {primary_spectra_for_structure_determination} spectra." self.report.warning.appendDescription('encouragement', {'file_name': file_name, 'description': warn}) @@ -11716,7 +11832,7 @@ def __detectContentSubTypeOfLegacyMr(self) -> bool: fileListId += 1 - if file_type in ('nmr-star', 'nm-res-mr', 'nm-res-oth', 'nm-res-sax') or file_type.startswith('nm-peak'): + if file_type in ('nmr-star', 'nm-res-mr', 'nm-res-oth', 'nm-res-sax') or file_type.startswith('nm-pea'): continue if (content_subtype is not None and 'dist_restraint' in content_subtype)\ @@ -11893,65 +12009,6 @@ def __detectContentSubTypeOfLegacyPk(self) -> bool: if not file_type.startswith('nm-pea'): continue - if is_binary_file(file_path): # DAOTHER-9425 - - err = f"The spectal peak list file {file_name!r} is not plain text file." - - self.report.error.appendDescription('format_issue', - {'file_name': file_name, 'description': err}) - self.report.setError() - - if self.__verbose: - self.__lfh.write(f"+NmrDpUtility.__extractPublicMrFileIntoLegacyPk() ++ Error - {err}\n") - - continue - - codec = detect_bom(file_path, 'utf-8') - - if codec != 'utf-8': - _file_path = file_path + '~' - convert_codec(file_path, _file_path, codec, 'utf-8') - file_path = _file_path - - if file_type != 'nm-pea-any': - - reader = self.__getSimpleFileReader(file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(file_path, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - input_source_dic['content_subtype'] = content_subtype - continue - - else: - - settled = False - - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(file_path, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - input_source_dic['file_type'] = _file_type - input_source_dic['content_subtype'] = content_subtype - settled = True - break - - if settled: - continue - - content_subtype = input_source_dic['content_subtype'] - if content_subtype is None: - input_source_dic['content_subtype'] = {'spectral_peak': 1} - original_file_name = None if 'original_file_name' in input_source_dic: if input_source_dic['original_file_name'] is not None: @@ -11959,27 +12016,9 @@ def __detectContentSubTypeOfLegacyPk(self) -> bool: if file_name != original_file_name and original_file_name is not None: file_name = f"{original_file_name} ({file_name})" - has_spectral_peak = False - - try: - - with open(file_path, 'r', encoding='utf-8') as ifh: - has_header = False - for idx, line in enumerate(ifh): - if line.isspace() or comment_pattern.match(line): - if line.startswith('#INAME'): - has_header = True - elif is_peak_list(line): # XwinNMR - has_spectral_peak = True - continue - if is_peak_list(line, has_header): - has_spectral_peak = True - if has_spectral_peak or idx >= self.mr_max_spacer_lines: - break - - except UnicodeDecodeError: # catch exception due to binary format (DAOTHER-9425) + if is_binary_file(file_path): # DAOTHER-9425 - err = f"The spectal peak list file {file_name!r} is not plain text file." + err = f"The spectal peak list file {file_name!r} (any plain text format) is not plain text file." self.report.error.appendDescription('format_issue', {'file_name': file_name, 'description': err}) @@ -12001,39 +12040,28 @@ def __detectContentSubTypeOfLegacyPk(self) -> bool: reader = self.__getSimpleFileReader(file_type, False) - listener, parser_err_listener, lexer_err_listener = reader.parse(file_path, None) + listener, parser_err_listener, _ = reader.parse(file_path, None) - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None + # ignore lexer error beacuse of imcomplete XML file format + # has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: + if not has_parser_error and content_subtype is not None and len(content_subtype) > 0: input_source_dic['content_subtype'] = content_subtype continue else: - settled = False + _file_type, _content_subtype = self.__getPeakListFileTypeAndContentSubtype(file_path) - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(file_path, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - input_source_dic['file_type'] = _file_type - input_source_dic['content_subtype'] = content_subtype - settled = True - break - - if settled: + if _file_type is not None: + input_source_dic['file_type'] = _file_type + input_source_dic['content_subtype'] = _content_subtype continue - if has_spectral_peak: - continue + content_subtype = input_source_dic['content_subtype'] + if content_subtype is None: + input_source_dic['content_subtype'] = {'spectral_peak': 1} has_mr_header = has_pdb_format = has_cif_format = has_str_format = False @@ -12446,11 +12474,6 @@ def __getSimpleFileReader(self, file_type: str, verbose: bool, sll_pred: bool = self.__ccU, self.__csStat, self.__nefT, reasons) return reader - if file_type == 'nm-pea-vie': - reader = NmrViewPKReader(verbose, self.__lfh, None, None, None, None, None, - self.__ccU, self.__csStat, self.__nefT, - reasons) - return reader if file_type == 'nm-pea-spa': reader = SparkyPKReader(verbose, self.__lfh, None, None, None, None, None, self.__ccU, self.__csStat, self.__nefT, @@ -12461,6 +12484,16 @@ def __getSimpleFileReader(self, file_type: str, verbose: bool, sll_pred: bool = self.__ccU, self.__csStat, self.__nefT, reasons) return reader + if file_type == 'nm-pea-vie': + reader = NmrViewPKReader(verbose, self.__lfh, None, None, None, None, None, + self.__ccU, self.__csStat, self.__nefT, + reasons) + return reader + if file_type == 'nm-pea-vnm': + reader = VnmrPKReader(verbose, self.__lfh, None, None, None, None, None, + self.__ccU, self.__csStat, self.__nefT, + reasons) + return reader if file_type == 'nm-pea-xea': reader = XeasyPKReader(verbose, self.__lfh, None, None, None, None, None, self.__ccU, self.__csStat, self.__nefT) @@ -13326,6 +13359,7 @@ def __divideLegacyMrIfNecessary(self, file_path: str, file_type: str, err_desc: return False # actual issue in the line before the parser error should be handled by manual if prev_input is not None and comment_pattern.match(prev_input)\ + and len_valid_types > 0 and valid_types[0] not in parsable_pk_file_types\ and file_type != 'nm-res-cya' and 'nm-res-cya' not in valid_types: # CYANA MR grammar is lax to check comment try: @@ -13712,7 +13746,7 @@ def __peelLegacyMrIfNecessary(self, file_path: str, file_type: str, err_desc: di if not has_lexer_error: if j3 == 0 and is_peak_list(err_input): - file_format = get_peak_list_format(err_input, in_type=True) + file_format = get_peak_list_format(err_input, as_code=True) if file_format is not None: shutil.copyfile(div_ext_file, div_ext_file + f'-selected-as-{file_format[-7:0]}') else: @@ -14608,25 +14642,37 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - has_spectral_peak = False - if not is_valid: - with open(file_path, 'r', encoding='utf-8') as ifh: - has_header = False - for idx, line in enumerate(ifh): - if line.isspace() or comment_pattern.match(line): - if line.startswith('#INAME'): - has_header = True - elif is_peak_list(line): # XwinNMR - has_spectral_peak = True - continue - if is_peak_list(line, has_header): - has_spectral_peak = True - if has_spectral_peak or idx >= self.mr_max_spacer_lines: - break + _file_type = None + + with open(file_path, 'r', encoding='utf-8') as ifh: + has_header = False + for idx, line in enumerate(ifh): + if line.isspace() or comment_pattern.match(line): + if line.startswith('#INAME'): + has_header = True + else: # XwinNMR + _file_type = get_peak_list_format(line, as_code=True) + if _file_type is not None: + break + continue + _file_type = get_peak_list_format(line, has_header, as_code=True) + if _file_type is not None or idx >= self.mr_max_spacer_lines: + break - if has_spectral_peak and file_type != 'nm-pea-ari': + if _file_type == 'nm-pea-ari' and file_type != 'nm-pea-ari': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ - self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-res-ari') + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-ari') + + is_valid |= _is_valid + err += _err + if _genuine_type is not None: + genuine_type.append(_genuine_type) + valid_types.update(_valid_types) + possible_types.update(_possible_types) + + if _file_type == 'nm-pea-pip' and file_type != 'nm-pea-pip': + _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-pip') is_valid |= _is_valid err += _err @@ -14635,9 +14681,9 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - if has_spectral_peak and file_type != 'nm-pea-pip': + if _file_type == 'nm-pea-spa' and file_type != 'nm-pea-spa': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ - self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-res-pip') + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-spa') is_valid |= _is_valid err += _err @@ -14646,9 +14692,9 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - if has_spectral_peak and file_type != 'nm-pea-vie': + if _file_type == 'nm-pea-top' and file_type != 'nm-pea-top': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ - self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-res-vie') + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-top') is_valid |= _is_valid err += _err @@ -14657,9 +14703,9 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - if has_spectral_peak and file_type != 'nm-pea-spa': + if _file_type == 'nm-pea-vie' and file_type != 'nm-pea-vie': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ - self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-res-spa') + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-vie') is_valid |= _is_valid err += _err @@ -14668,9 +14714,9 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - if has_spectral_peak and file_type != 'nm-pea-top': + if _file_type == 'nm-pea-vnm' and file_type != 'nm-pea-vnm': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ - self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-res-top') + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-vnm') is_valid |= _is_valid err += _err @@ -14679,9 +14725,9 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - if has_spectral_peak and file_type != 'nm-pea-xea': + if _file_type == 'nm-pea-xea' and file_type != 'nm-pea-xea': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ - self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-res-xea') + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-xea') is_valid |= _is_valid err += _err @@ -14690,9 +14736,9 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - if has_spectral_peak and file_type != 'nm-pea-xwi': + if _file_type == 'nm-pea-xwi' and file_type != 'nm-pea-xwi': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ - self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-res-xwi') + self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-pea-xwi') is_valid |= _is_valid err += _err @@ -14701,7 +14747,7 @@ def __detectOtherPossibleFormatAsErrorOfLegacyMr(self, file_path: str, file_name valid_types.update(_valid_types) possible_types.update(_possible_types) - if not is_valid and not has_spectral_peak and file_type != 'nm-aux-xea': + if not is_valid and _file_type is None and file_type != 'nm-aux-xea': _is_valid, _err, _genuine_type, _valid_types, _possible_types =\ self.__detectOtherPossibleFormatAsErrorOfLegacyMr__(file_path, file_name, file_type, dismiss_err_lines, 'nm-aux-xea') @@ -14875,6 +14921,7 @@ def __extractPublicMrFileIntoLegacyMr(self) -> bool: settled_file_types = list(parsable_mr_file_types) settled_file_types.extend(list(parsable_pk_file_types)) + settled_file_types.append('nm-res-sax') for ar in self.__inputParamDict[ar_file_path_list]: @@ -14972,20 +15019,7 @@ def __extractPublicMrFileIntoLegacyMr(self) -> bool: if os.path.exists(ign_pk_file): # in case the MR file can be ignored as peak list file - settled_file_type = None - - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(ign_pk_file, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - settled_file_type = _file_type - break + settled_file_type, _ = self.__getPeakListFileTypeAndContentSubtype(ign_pk_file) _ar = ar.copy() @@ -15756,20 +15790,7 @@ def split_concat_comp_id_seq_id(string): if os.path.exists(ign_pk_file): # in case the MR file can be ignored as peak list file - settled_file_type = None - - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(ign_pk_file, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - settled_file_type = _file_type - break + settled_file_type, _ = self.__getPeakListFileTypeAndContentSubtype(ign_pk_file) _ar = ar.copy() @@ -15837,20 +15858,7 @@ def split_concat_comp_id_seq_id(string): if os.path.exists(ign_pk_file): # in case the MR file can be ignored as peak list file - settled_file_type = None - - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(ign_pk_file, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - settled_file_type = _file_type - break + settled_file_type, _ = self.__getPeakListFileTypeAndContentSubtype(ign_pk_file) _ar = ar.copy() @@ -16174,20 +16182,7 @@ def split_concat_comp_id_seq_id(string): if os.path.exists(ign_pk_file): # in case the MR file can be ignored as peak list file - settled_file_type = None - - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(ign_pk_file, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - settled_file_type = _file_type - break + settled_file_type, _ = self.__getPeakListFileTypeAndContentSubtype(ign_pk_file) _ar.copy() @@ -16256,36 +16251,23 @@ def split_concat_comp_id_seq_id(string): remediated = True - has_spectral_peak = False - - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(dst_file, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - has_spectral_peak = True + settled_file_type, _ = self.__getPeakListFileTypeAndContentSubtype(dst_file) - shutil.copyfile(dst_file, dst_file + f'-selected-as-{_file_type[-7:]}') + if settled_file_type is not None: - _ar = ar.copy() + shutil.copyfile(dst_file, dst_file + f'-selected-as-{settled_file_type[-7:]}') - _ar['file_name'] = dst_file - _ar['file_type'] = _file_type - peak_file_list.append(_ar) + _ar = ar.copy() - pk_list_paths.append({_file_type: dst_file, - 'original_file_name': None if dst_file.endswith('-noname.mr') else os.path.basename(dst_file)}) + _ar['file_name'] = dst_file + _ar['file_type'] = settled_file_type + peak_file_list.append(_ar) - remediated = True + pk_list_paths.append({'nmr-peaks': dst_file, + 'original_file_name': None if dst_file.endswith('-noname.mr') else os.path.basename(dst_file)}) - break + remediated = True - if has_spectral_peak: continue if has_str_format or has_cif_format: @@ -16566,20 +16548,7 @@ def split_concat_comp_id_seq_id(string): if os.path.exists(ign_pk_file): # in case the MR file can be ignored as peak list file - settled_file_type = None - - for _file_type in parsable_pk_file_types: - - reader = self.__getSimpleFileReader(_file_type, False) - - listener, parser_err_listener, lexer_err_listener = reader.parse(ign_pk_file, None) - - has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None - has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None - content_subtype = listener.getContentSubtype() if listener is not None else None - if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: - settled_file_type = _file_type - break + settled_file_type, _ = self.__getPeakListFileTypeAndContentSubtype(ign_pk_file) _ar = ar.copy() @@ -16980,6 +16949,54 @@ def split_concat_comp_id_seq_id(string): return not self.report.isError() + def __getPeakListFileTypeAndContentSubtype(self, file_path: str) -> Tuple[Optional[str], Optional[dict]]: + """ Return peak list file type and content subtype of a given file path. + """ + + file_type = None + + with open(file_path, 'r', encoding='utf-8') as ifh: + has_header = False + for idx, line in enumerate(ifh): + if line.isspace() or comment_pattern.match(line): + if line.startswith('#INAME'): + has_header = True + else: # XwinNMR + file_type = get_peak_list_format(line, as_code=True) + if file_type is not None: + break + continue + file_type = get_peak_list_format(line, has_header, as_code=True) + if file_type is not None or idx >= self.mr_max_spacer_lines: + break + + if file_type is not None: + + reader = self.__getSimpleFileReader(file_type, False) + + listener, parser_err_listener, _ = reader.parse(file_path, None) + + # ignore lexer error beacuse of imcomplete XML file format + # has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None + has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None + content_subtype = listener.getContentSubtype() if listener is not None else None + if not has_parser_error and content_subtype is not None and len(content_subtype) > 0: + return file_type, content_subtype + + for file_type in parsable_pk_file_types: + + reader = self.__getSimpleFileReader(file_type, False) + + listener, parser_err_listener, lexer_err_listener = reader.parse(file_path, None) + + has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None + has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None + content_subtype = listener.getContentSubtype() if listener is not None else None + if not has_lexer_error and not has_parser_error and content_subtype is not None and len(content_subtype) > 0: + return file_type, content_subtype + + return None, None + def __getPolymerSequence(self, file_list_id: int, sf: Union[pynmrstar.Entry, pynmrstar.Saveframe, pynmrstar.Loop], content_subtype: str ) -> List[List[dict]]: """ Wrapper function to retrieve polymer sequence from loop of a specified saveframe and content subtype via NEFTranslator. @@ -34787,8 +34804,19 @@ def __validateLegacyPk(self) -> bool: if not has_poly_seq: return False + file_type = 'nmr-star' content_subtype = 'spectral_peak' + sf_category = self.sf_categories[file_type][content_subtype] + + rlist_ids = [] + if len(self.__star_data) > 0 and isinstance(self.__star_data[0], pynmrstar.Entry): + for idx, sf in enumerate(self.__star_data[0].get_saveframes_by_category(sf_category), start=1): + list_id = get_first_sf_tag(sf, 'ID') + rlist_ids.append(int(list_id) if list_id not in emptyValue else idx) + + reserved_list_ids = {content_subtype: rlist_ids} if len(rlist_ids) > 0 else None + xeasyAtomNumberDict = None has_nm_aux_xea_file = False @@ -34863,8 +34891,6 @@ def deal_aux_warn_message(listener): if file_name != original_file_name and original_file_name is not None: file_name = f"{original_file_name} ({file_name})" - self.__cur_original_ar_file_name = original_file_name - reader = XeasyPROTReader(self.__verbose, self.__lfh, self.__representative_model_id, self.__representative_alt_id, @@ -34899,8 +34925,6 @@ def deal_aux_warn_message(listener): input_source = self.report.input_sources[0] input_source_dic = input_source.get() - has_poly_seq = has_key_value(input_source_dic, 'polymer_sequence') - nmr_poly_seq = input_source_dic['polymer_sequence'] cif_poly_seq = self.__caC['polymer_sequence'] @@ -35097,14 +35121,12 @@ def deal_pea_warn_message(listener): self.__nmr_ext_poly_seq.append(d) elif warn.startswith('[Missing data]'): - # consume_suspended_message() - - self.report.error.appendDescription('missing_data', - {'file_name': file_name, 'description': warn}) - self.report.setError() + self.report.warning.appendDescription('missing_data', + {'file_name': file_name, 'description': warn}) + self.report.setWarning() if self.__verbose: - self.__lfh.write(f"+NmrDpUtility.__validateLegacyPk() ++ ValueError - {warn}\n") + self.__lfh.write(f"+NmrDpUtility.__validateLegacyPk() ++ Warning - {warn}\n") elif warn.startswith('[Range value error]') and not self.__remediation_mode: # consume_suspended_message() @@ -35165,10 +35187,6 @@ def deal_pea_warn_message_for_lazy_eval(listener): suspended_errors_for_lazy_eval.append({'invalid_data': {'file_name': file_name, 'description': warn}}) - # elif warn.startswith('[Missing data]'): - # suspended_errors_for_lazy_eval.append({'missing_data': - # {'file_name': file_name, 'description': warn}}) - # elif warn.startswith('[Range value error]') and not self.__remediation_mode: # suspended_errors_for_lazy_eval.append({'anomalous_data': # {'file_name': file_name, 'description': warn}}) @@ -35208,13 +35226,11 @@ def deal_pea_warn_message_for_lazy_eval(listener): suspended_errors_for_lazy_eval.append({'missing_mandatory_content': {'file_name': file_name, 'description': err}}) - content_subtype = input_source_dic['content_subtype'] + _content_subtype = input_source_dic['content_subtype'] - if content_subtype is None or len(content_subtype) == 0: + if _content_subtype is None or len(_content_subtype) == 0: continue - self.__cur_original_ar_file_name = original_file_name - suspended_errors_for_lazy_eval.clear() if file_type == 'nm-pea-ari': @@ -35229,7 +35245,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=self.__list_id_counter, entryId=self.__entry_id) + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) if listener is not None: reasons = listener.getReasonsForReparsing() @@ -35247,7 +35263,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=_list_id_counter, entryId=self.__entry_id) + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) deal_pea_warn_message(listener) @@ -35292,7 +35308,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=self.__list_id_counter, entryId=self.__entry_id) + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) if listener is not None: reasons = listener.getReasonsForReparsing() @@ -35310,7 +35326,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=_list_id_counter, entryId=self.__entry_id) + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) deal_pea_warn_message(listener) @@ -35343,19 +35359,19 @@ def deal_pea_warn_message_for_lazy_eval(listener): if sf not in pk_sf_dict_holder[content_subtype]: pk_sf_dict_holder[content_subtype].append(sf) - elif file_type == 'nm-pea-vie': - reader = NmrViewPKReader(self.__verbose, self.__lfh, - self.__representative_model_id, - self.__representative_alt_id, - self.__mr_atom_name_mapping, - self.__cR, self.__caC, - self.__ccU, self.__csStat, self.__nefT) + elif file_type == 'nm-pea-spa': + reader = SparkyPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) _list_id_counter = copy.copy(self.__list_id_counter) listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=self.__list_id_counter, entryId=self.__entry_id) + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) if listener is not None: reasons = listener.getReasonsForReparsing() @@ -35363,17 +35379,17 @@ def deal_pea_warn_message_for_lazy_eval(listener): if reasons is not None: deal_pea_warn_message_for_lazy_eval(listener) - reader = NmrViewPKReader(self.__verbose, self.__lfh, - self.__representative_model_id, - self.__representative_alt_id, - self.__mr_atom_name_mapping, - self.__cR, self.__caC, - self.__ccU, self.__csStat, self.__nefT, - reasons) + reader = SparkyPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=_list_id_counter, entryId=self.__entry_id) + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) deal_pea_warn_message(listener) @@ -35388,7 +35404,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): if create_sf_dict: if len(listener.getContentSubtype()) == 0: - err = f"Failed to validate NMR spectral peak list file (NMRVIEW) {file_name!r}." + err = f"Failed to validate NMR spectral peak list file (SPARKY) {file_name!r}." self.report.error.appendDescription('internal_error', "+NmrDpUtility.__validateLegacyPk() ++ Error - " + err) self.report.setError() @@ -35406,19 +35422,19 @@ def deal_pea_warn_message_for_lazy_eval(listener): if sf not in pk_sf_dict_holder[content_subtype]: pk_sf_dict_holder[content_subtype].append(sf) - elif file_type == 'nm-pea-spa': - reader = SparkyPKReader(self.__verbose, self.__lfh, - self.__representative_model_id, - self.__representative_alt_id, - self.__mr_atom_name_mapping, - self.__cR, self.__caC, - self.__ccU, self.__csStat, self.__nefT) + elif file_type == 'nm-pea-top': + reader = TopSpinPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) _list_id_counter = copy.copy(self.__list_id_counter) listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=self.__list_id_counter, entryId=self.__entry_id) + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) if listener is not None: reasons = listener.getReasonsForReparsing() @@ -35426,17 +35442,17 @@ def deal_pea_warn_message_for_lazy_eval(listener): if reasons is not None: deal_pea_warn_message_for_lazy_eval(listener) - reader = SparkyPKReader(self.__verbose, self.__lfh, - self.__representative_model_id, - self.__representative_alt_id, - self.__mr_atom_name_mapping, - self.__cR, self.__caC, - self.__ccU, self.__csStat, self.__nefT, - reasons) + reader = TopSpinPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=_list_id_counter, entryId=self.__entry_id) + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) deal_pea_warn_message(listener) @@ -35451,7 +35467,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): if create_sf_dict: if len(listener.getContentSubtype()) == 0: - err = f"Failed to validate NMR spectral peak list file (SPARKY) {file_name!r}." + err = f"Failed to validate NMR spectral peak list file (TOPSPIN) {file_name!r}." self.report.error.appendDescription('internal_error', "+NmrDpUtility.__validateLegacyPk() ++ Error - " + err) self.report.setError() @@ -35469,8 +35485,8 @@ def deal_pea_warn_message_for_lazy_eval(listener): if sf not in pk_sf_dict_holder[content_subtype]: pk_sf_dict_holder[content_subtype].append(sf) - elif file_type == 'nm-pea-top': - reader = TopSpinPKReader(self.__verbose, self.__lfh, + elif file_type == 'nm-pea-vie': + reader = NmrViewPKReader(self.__verbose, self.__lfh, self.__representative_model_id, self.__representative_alt_id, self.__mr_atom_name_mapping, @@ -35481,7 +35497,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=self.__list_id_counter, entryId=self.__entry_id) + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) if listener is not None: reasons = listener.getReasonsForReparsing() @@ -35489,7 +35505,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): if reasons is not None: deal_pea_warn_message_for_lazy_eval(listener) - reader = TopSpinPKReader(self.__verbose, self.__lfh, + reader = NmrViewPKReader(self.__verbose, self.__lfh, self.__representative_model_id, self.__representative_alt_id, self.__mr_atom_name_mapping, @@ -35499,7 +35515,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=_list_id_counter, entryId=self.__entry_id) + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) deal_pea_warn_message(listener) @@ -35514,7 +35530,70 @@ def deal_pea_warn_message_for_lazy_eval(listener): if create_sf_dict: if len(listener.getContentSubtype()) == 0: - err = f"Failed to validate NMR spectral peak list file (TOPSPIN) {file_name!r}." + err = f"Failed to validate NMR spectral peak list file (NMRVIEW) {file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__validateLegacyPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__validateLegacyPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-vnm': + reader = VnmrPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(file_path, self.__cifPath, + createSfDict=create_sf_dict, originalFileName=original_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = VnmrPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(file_path, self.__cifPath, + createSfDict=create_sf_dict, originalFileName=original_file_name, + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if create_sf_dict: + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (VNMR) {file_name!r}." self.report.error.appendDescription('internal_error', "+NmrDpUtility.__validateLegacyPk() ++ Error - " + err) self.report.setError() @@ -35545,7 +35624,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=self.__list_id_counter, entryId=self.__entry_id) + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) if listener is not None: reasons = listener.getReasonsForReparsing() @@ -35564,7 +35643,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=_list_id_counter, entryId=self.__entry_id) + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) deal_pea_warn_message(listener) @@ -35609,7 +35688,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=self.__list_id_counter, entryId=self.__entry_id) + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) if listener is not None: reasons = listener.getReasonsForReparsing() @@ -35627,7 +35706,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): listener, _, _ = reader.parse(file_path, self.__cifPath, createSfDict=create_sf_dict, originalFileName=original_file_name, - listIdCounter=_list_id_counter, entryId=self.__entry_id) + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) deal_pea_warn_message(listener) @@ -35725,7 +35804,7 @@ def deal_pea_warn_message_for_lazy_eval(listener): input_source.setItemValue('polymer_sequence', poly_seq_rst) - self.report.sequence_alignment.setItemValue('model_poly_seq_vs_spectral_peak', seq_align) + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) if proc_nmr_ext_poly_seq and len(self.__nmr_ext_poly_seq) > 0: entity_assembly = self.__caC['entity_assembly'] @@ -42248,6 +42327,605 @@ def __calculateStatsOfSpectralPeakAlt(self, file_list_id: int, sf_framecode: str if self.__verbose: self.__lfh.write(f"+NmrDpUtility.__calculateStatsOfSpectralPeakAlt() ++ Error - {str(e)}\n") + def __detectDimTransferTypeViaThroughSpace(self) -> bool: + """ Detect spectral peak transfer type via through-space. + """ + + if len(self.__star_data) == 0 or not isinstance(self.__star_data[0], pynmrstar.Entry): + return False + + input_source = self.report.input_sources[0] + input_source_dic = input_source.get() + + file_name = input_source_dic['file_name'] + file_type = input_source_dic['file_type'] + + content_subtype = 'spectral_peak' + + sf_category = self.sf_categories[file_type][content_subtype] + lp_category = self.lp_categories[file_type][content_subtype] + pk_char_category = '_Peak_char' + + sf_list = self.__star_data[0].get_saveframes_by_category(sf_category) + + if len(sf_list) == 0: + return False # raised proper recomendation already + + exp_classes = [] + + for sf in sf_list: + + data_file_name = '' + + if not self.__native_combined: # natively combined nmr_data file needs to be inventigated + + if file_type == 'nmr-star': + exp_class = get_first_sf_tag(sf, 'Experiment_class') + + if exp_class.endswith('through-space'): + return True + + data_file_name = get_first_sf_tag(sf, 'Data_file_name') + + # '_nef_spectrum_dimension_transfer' or '_Spectral_dim_transfer' + aux_lp_category = self.aux_lp_categories[file_type][content_subtype][1] + + try: + + aux_loop = sf.get_loop(aux_lp_category) + + dat = aux_loop.get_tag(['Type' if file_type == 'nmr-star' else 'transfer_type']) + + for row in dat: + if row == 'through-space': + return True + + except KeyError: + pass + + try: + + _num_dim = get_first_sf_tag(sf, self.num_dim_items[file_type]) + num_dim = int(_num_dim) + + if num_dim not in range(1, MAX_DIM_NUM_OF_SPECTRA): + raise ValueError() + + except ValueError: + continue + + if num_dim > 5: + continue + + max_dim = num_dim + 1 + + cur_spectral_dim = {} + + try: + + loop = sf.get_loop(lp_category) + + key_items = [] + for dim in range(1, max_dim): + for k in self.pk_key_items[file_type]: + if k['type'] == 'float': # position + _k = copy.copy(k) + if '%s' in k['name']: + _k['name'] = k['name'] % dim + key_items.append(_k['name']) + cur_spectral_dim[dim] = copy.copy(SPECTRAL_DIM_TEMPLATE) + cur_spectral_dim[dim]['freq_hint'] = [] + + dat = loop.get_tag(key_items) + + for row in dat: + + for dim in range(1, max_dim): + freq = row[dim - 1] + if isinstance(freq, str): + freq = float(freq) + cur_spectral_dim[dim]['freq_hint'].append(freq) + + exp_class = self.__guessPrimaryDimTransferTypeOf(data_file_name, num_dim, cur_spectral_dim) + + if exp_class == 'through-space': + return True + + exp_class = f'{exp_class!r}' + + if exp_class not in exp_classes: + exp_classes.append(exp_class) + + except KeyError: + + if file_type == 'nef': + continue + + try: + + loop = sf.get_loop(pk_char_category) + + dat = loop.get_tag(['Spectral_dim_ID', 'Chem_shift_val']) + + for row in dat: + dim, freq = row + if isinstance(dim, str): + dim = int(dim) + if isinstance(freq, str): + freq = float(freq) + cur_spectral_dim[dim]['freq_hint'].append(freq) + + exp_class = self.__guessPrimaryDimTransferTypeOf(data_file_name, num_dim, cur_spectral_dim) + + if exp_class == 'through-space': + return True + + exp_class = f'{exp_class!r}' + + if exp_class not in exp_classes: + exp_classes.append(exp_class) + + except KeyError: + continue + + primary_spectra_for_structure_determination =\ + 'NOESY or ROESY' if self.__exptl_method != 'SOLID-STATE NMR' else 'REDOR or RFDR' + + warn = f"You have uploaded spectral peak list(s) classified into {', '.join(exp_classes)}, respectively. "\ + f"However, none of spectral peak list(s) appears to be derived from expected spectra such as the {primary_spectra_for_structure_determination}. "\ + "The wwPDB NMR Validation Task Force strongly encourages the submission of spectral peak lists, "\ + f"in particular those generated from the {primary_spectra_for_structure_determination} spectra." + + self.report.warning.appendDescription('encouragement', + {'file_name': file_name, 'description': warn}) + self.report.setWarning() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__detectDimTransferTypeViaThroughSpace() ++ Warning - {warn}\n") + + return False + + def __guessPrimaryDimTransferTypeOf(self, data_file_name: str, d: int, cur_spectral_dim: dict) -> str: + """ Return expected primary dimensional transfer type from a given frequencies. + """ + + file_name = data_file_name.lower() + + acq_dim_id = 1 + + for __d, __v in cur_spectral_dim.items(): + if 'freq_hint' in __v: + __v['freq_hint'] = numpy.array(__v['freq_hint'], dtype=float) # list -> numpy array + if __v['freq_hint'].size > 0: + center = numpy.mean(__v['freq_hint']) + + if 125 < center < 130: + __v['atom_type'] = 'C' + __v['atom_isotope_number'] = 13 + __v['axis_code'] = 'C-aromatic' + elif 115 < center < 125: + __v['atom_type'] = 'N' + __v['atom_isotope_number'] = 15 + __v['axis_code'] = 'N' + elif 170 < center < 180: + __v['atom_type'] = 'C' + __v['atom_isotope_number'] = 13 + __v['axis_code'] = 'CO' + elif 6 < center < 9: + __v['atom_type'] = 'H' + __v['atom_isotope_number'] = 1 + __v['axis_code'] = 'HN/H-aromatic' + elif 4 < center < 6: + __v['atom_type'] = 'H' + __v['atom_isotope_number'] = 1 + __v['axis_code'] = 'H' # all + elif 2 < center < 4: + __v['atom_type'] = 'H' + __v['atom_isotope_number'] = 1 + __v['axis_code'] = 'H-aliphatic' + elif 0 < center < 2: + __v['atom_type'] = 'H' + __v['atom_isotope_number'] = 1 + __v['axis_code'] = 'H-methyl' + elif 60 < center < 90: + __v['atom_type'] = 'C' + __v['atom_isotope_number'] = 13 + __v['axis_code'] = 'C' # all + elif 30 < center < 50: + __v['atom_type'] = 'C' + __v['atom_isotope_number'] = 13 + __v['axis_code'] = 'C-aliphatic' + elif 10 < center < 30: + __v['atom_type'] = 'C' + __v['atom_isotope_number'] = 13 + __v['axis_code'] = 'C-methyl' + + isotope_number = __v['atom_isotope_number'] + + if isotope_number is not None: + __v['acquisition'] = 'yes' if __d == acq_dim_id\ + and (isotope_number == 1 or (isotope_number == 13 and self.__exptl_method == 'SOLID-STATE NMR')) else 'no' + + if __d == 1 and __v['acquisition'] == 'no': + acq_dim_id = d + + __v['under_sampling_type'] = 'not observed' if __v['acquisition'] == 'yes' else 'aliased' + + if __v['freq_hint'].size > 0 and d > 2 and __d >= 2\ + and self.__exptl_method != 'SOLID-STATE NMR' and __v['atom_isotope_number'] == 13: + max_ppm = __v['freq_hint'].max() + min_ppm = __v['freq_hint'].min() + width = max_ppm - min_ppm + if center < 100.0 and width < 50.0: + __v['under_sampling_type'] = 'fold' + + for __v in cur_spectral_dim.values(): + if __v['axis_code'] == 'HN/H-aromatic': + has_a = any(___v['spectral_region'] == 'C-aromatic' for ___v in cur_spectral_dim.values()) + __v['axis_code'] = 'H-aromatic' if has_a else 'HN' + if __v['spectral_region'] == 'HN/H-aromatic': + has_a = any(___v['spectral_region'] == 'C-aromatic' for ___v in cur_spectral_dim.values()) + __v['spectral_region'] = 'H-aromatic' if has_a else 'HN' + + cur_spectral_dim_transfer = [] + + # onebond: 'Any transfer that connects only directly bonded atoms in this experiment' + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 in ('HN', 'H-aliphatic', 'H-aromatic', 'H-methyl'): + cases = 0 + max_corr_eff = 0.0 + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _region2 = _dict2['spectral_region'] + if (_region1 == 'HN' and _region2 == 'N')\ + or (_region1 == 'H-aliphatic' and _region2 == 'C-aliphatic')\ + or (_region1 == 'H-aromatic' and _region2 == 'C-aromatic')\ + or (_region1 == 'H-methyl' and _region2 == 'C-methyl'): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + if not any(_transfer for _transfer in cur_spectral_dim_transfer + if _transfer['type'] == 'onebond' + and (_dim_id1 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']] + or _dim_id2 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']])): + cases += 1 + max_corr_eff = max(max_corr_eff, numpy.corrcoef(_dict1['freq_hint'], _dict2['freq_hint'])[0][1]) + + if cases == 1: + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _region2 = _dict2['spectral_region'] + if (_region1 == 'HN' and _region2 == 'N')\ + or (_region1 == 'H-aliphatic' and _region2 == 'C-aliphatic')\ + or (_region1 == 'H-aromatic' and _region2 == 'C-aromatic')\ + or (_region1 == 'H-methyl' and _region2 == 'C-methyl'): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + if not any(_transfer for _transfer in cur_spectral_dim_transfer + if _transfer['type'] == 'onebond' + and (_dim_id1 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']] + or _dim_id2 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']])): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'onebond', + 'indirect': 'no'} + cur_spectral_dim_transfer.append(transfer) + + elif cases > 1: + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _region2 = _dict2['spectral_region'] + if (_region1 == 'HN' and _region2 == 'N')\ + or (_region1 == 'H-aliphatic' and _region2 == 'C-aliphatic')\ + or (_region1 == 'H-aromatic' and _region2 == 'C-aromatic')\ + or (_region1 == 'H-methyl' and _region2 == 'C-methyl'): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + if not any(_transfer for _transfer in cur_spectral_dim_transfer + if _transfer['type'] == 'onebond' + and (_dim_id1 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']] + or _dim_id2 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']])): + if numpy.corrcoef(_dict1['freq_hint'], _dict2['freq_hint'])[0][1] < max_corr_eff: + continue + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'onebond', + 'indirect': 'no'} + cur_spectral_dim_transfer.append(transfer) + + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 in ('HN', 'H-aliphatic', 'H-aromatic', 'H-methyl'): + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _region2 = _dict2['spectral_region'] + if (_region1 == 'HN' and _region2 == 'N')\ + or (_region1 == 'H-aliphatic' and _region2 == 'C-aliphatic')\ + or (_region1 == 'H-aromatic' and _region2 == 'C-aromatic')\ + or (_region1 == 'H-methyl' and _region2 == 'C-methyl'): + if _dict1['acquisition'] == 'no' and _dict2['acquisition'] == 'no': + if not any(_transfer for _transfer in cur_spectral_dim_transfer + if _transfer['type'] == 'onebond' + and (_dim_id1 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']] + or _dim_id2 in [_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']])): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'onebond', + 'indirect': 'no'} + cur_spectral_dim_transfer.append(transfer) + + # jcoupling: 'Transfer via direct J coupling over one or more bonds' + if 'cosy' in file_name: + if d == 2: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 == 1: + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _iso_num1 != _dict2['atom_isotope_number']: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'jcoupling', + 'indirect': 'no'} + cur_spectral_dim_transfer.append(transfer) + + elif d == 3: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'HN': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict2['atom_isotope_number'] not in (1, 13): + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'jcoupling', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'H-aliphatic': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _isotope2 = _dict2['atom_isotope'] + if _dim_id1 == _dim_id2 or _isotope2 not in (1, 13): + continue + if _isotope2 == 13\ + and not any(_transfer for _transfer in cur_spectral_dim_transfer + if _transfer['type'] == 'onebond' + and {_dim_id1, _dim_id2} == {_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']}): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'jcoupling', + 'indirect': 'yes' if _isotope2 == 1 else 'no'} + cur_spectral_dim_transfer.append(transfer) + + elif d == 4: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'HN': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict2['atom_isotope_number'] != 1: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'jcoupling', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'H-aliphatic': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict2['atom_isotope_number'] != 1: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'jcoupling', + 'indirect': 'no'} + cur_spectral_dim_transfer.append(transfer) + + # jmultibond: 'Transfer via direct J coupling over multiple bonds' + + # relayed: 'Transfer via multiple successive J coupling steps (TOCSY relay)' + if 'tocsy' in file_name: + if d == 2: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 == 1: + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _iso_num1 != _dict2['atom_isotope_number']: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'relayed', + 'indirect': 'no'} + cur_spectral_dim_transfer.append(transfer) + + elif d == 3: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'HN': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict2['atom_isotope_number'] not in (1, 13): + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'relayed', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'H-aliphatic': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _isotope2 = _dict2['atom_isotope'] + if _dim_id1 == _dim_id2 or _isotope2 not in (1, 13): + continue + if _isotope2 == 13\ + and not any(_transfer for _transfer in cur_spectral_dim_transfer + if _transfer['type'] == 'onebond' + and {_dim_id1, _dim_id2} == {_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']}): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'relayed', + 'indirect': 'yes' if _isotope2 == 1 else 'no'} + cur_spectral_dim_transfer.append(transfer) + + elif d == 4: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'HN': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict2['atom_isotope_number'] != 1: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'relayed', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'H-aliphatic': + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict2['atom_isotope_number'] != 1: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'relayed', + 'indirect': 'no'} + cur_spectral_dim_transfer.append(transfer) + + # relayed-alternate: 'Relayed transfer where peaks from an odd resp. even number of transfer steps have opposite sign' + + # through-space: 'Any transfer that does not go through the covalent bonded skeleton + if 'noe' in file_name or 'roe' in file_name: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 in ('HN', 'H-aliphatic', 'H-aromatic', 'H-methyl') and d > 2: + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict1['atom_isotope_number'] != _dict2['atom_isotope_number']: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + if self.__exptl_method == 'SOLID-STATE NMR' and d == 2: + if 'rfdr' in file_name: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 in (1, 13): + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _iso_num1 != _dict2['atom_isotope_number']: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + elif 'redor' in file_name: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 in (13, 15, 19, 31): + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _iso_num2 = _dict2['atom_isotope_number'] + if _dim_id1 == _dim_id2 or _iso_num2 not in (13, 15, 19, 31) or _iso_num1 == _iso_num2: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 in ('HN', 'H-aliphatic', 'H-aromatic', 'H-methyl') and d > 2: + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict1['atom_isotope_number'] != _dict2['atom_isotope_number']: + continue + if not any(_transfer for _transfer in cur_spectral_dim_transfer + if {_dim_id1, _dim_id2} == {_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']}): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', # optimistic inferencing? + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'H' and d == 2: # all + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict1['spectral_region'] != _region1: + continue + if not any(_transfer for _transfer in cur_spectral_dim_transfer + if {_dim_id1, _dim_id2} == {_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']}): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', # optimistic inferencing? + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + if self.__exptl_method == 'SOLID-STATE NMR' and d == 2: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _region1 = _dict1['spectral_region'] + if _region1 == 'C': # all + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _dict1['spectral_region'] != _region1: + continue + if not any(_transfer for _transfer in cur_spectral_dim_transfer + if {_dim_id1, _dim_id2} == {_transfer['spectral_dim_id_1'], _transfer['spectral_dim_id_2']}): + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', # optimistic inferencing? + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 in (13, 15, 19, 31): + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _iso_num2 = _dict2['atom_isotope_number'] + if _dim_id1 == _dim_id2 or _iso_num2 not in (13, 15, 19, 31) or _iso_num1 == _iso_num2: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', # optimistic inferencing? + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + for __v in cur_spectral_dim.values(): + if 'freq_hint' in __v: + del __v['freq_hint'] + + primary_dim_transfer = '' + for transfer in cur_spectral_dim_transfer: + if transfer['type'] == 'through-space': + primary_dim_transfer = transfer['type'] + break + if transfer['type'].startswith('relayed')\ + and primary_dim_transfer != 'through-space': + primary_dim_transfer = transfer['type'] + elif transfer['type'] == 'jmultibond'\ + and primary_dim_transfer not in ('through-space', 'relayed', 'relayed-alternate'): + primary_dim_transfer = transfer['type'] + elif transfer['type'] == 'jcoupling'\ + and primary_dim_transfer not in ('through-space', 'relayed', 'relayed-alternate', 'jmultibond'): + primary_dim_transfer = transfer['type'] + elif transfer['type'] == 'onebond'\ + and primary_dim_transfer == '': + primary_dim_transfer = transfer['type'] + + return primary_dim_transfer + def __extractCoordStructConf(self, nmr_chain_id: str, nmr_seq_ids: List[int]) -> List[Optional[str]]: """ Extract conformational annotations of coordinate file. """ @@ -45537,11 +46215,16 @@ def __testCoordAtomIdConsistency(self) -> bool: nmr2ca = {} + _ref_chain_id = None + for ca in chain_assign_dic['nmr_poly_seq_vs_model_poly_seq']: ref_chain_id = ca['ref_chain_id'] test_chain_id = ca['test_chain_id'] + if _ref_chain_id is None: + _ref_chain_id = ref_chain_id + result = next((seq_align for seq_align in seq_align_dic['nmr_poly_seq_vs_model_poly_seq'] if seq_align['ref_chain_id'] == ref_chain_id and seq_align['test_chain_id'] == test_chain_id), None) @@ -45558,6 +46241,8 @@ def __testCoordAtomIdConsistency(self) -> bool: if nmr_input_source_dic['content_subtype'] is None: continue + ref_chain_id = _ref_chain_id + modified = False for content_subtype in nmr_input_source_dic['content_subtype']: @@ -45855,6 +46540,7 @@ def get_coord_atom_site_of(chain_id, seq_id, comp_id): cif_ps = next(ps for ps in cif_polymer_sequence if ps['chain_id'] == cif_chain_id) if ca['sequence_coverage'] < LOW_SEQ_COVERAGE: # DAOTHER-8751, issue #2 + if 'auth_seq_id' in cif_ps: cif_seq_id, cif_comp_id = next(((_seq_id, _comp_id) for _auth_seq_id, _seq_id, _comp_id in zip(cif_ps['auth_seq_id'], cif_ps['seq_id'], cif_ps['comp_id']) @@ -45868,6 +46554,7 @@ def get_coord_atom_site_of(chain_id, seq_id, comp_id): continue else: + cif_comp_id = next((_comp_id for _seq_id, _comp_id in zip(cif_ps['seq_id'], cif_ps['comp_id']) if _seq_id == cif_seq_id), None) @@ -45875,7 +46562,19 @@ def get_coord_atom_site_of(chain_id, seq_id, comp_id): if cif_comp_id is None: continue + if cif_comp_id != comp_id and seq_id != cif_seq_id: + cif_comp_id = next((_comp_id for _seq_id, _comp_id + in zip(cif_ps['seq_id'], cif_ps['comp_id']) + if _seq_id == seq_id), None) + + if cif_comp_id is None: + continue + + if cif_comp_id == comp_id: + cif_seq_id = seq_id + if ca['sequence_coverage'] < LOW_SEQ_COVERAGE: + if 'auth_seq_id' in cif_ps: cif_comp_id = next((_comp_id for _seq_id, _comp_id in zip(cif_ps['auth_seq_id'], cif_ps['comp_id']) @@ -45918,7 +46617,7 @@ def get_coord_atom_site_of(chain_id, seq_id, comp_id): atom_id_ = atom_id atom_name = atom_id - found, seq_key, coord_atom_site_ = get_coord_atom_site_of(cif_chain_id, seq_id, comp_id) + found, seq_key, coord_atom_site_ = get_coord_atom_site_of(cif_chain_id, cif_seq_id, comp_id) if found: @@ -45967,6 +46666,28 @@ def get_coord_atom_site_of(chain_id, seq_id, comp_id): coord_atom_site_ = coord_atom_site.get(seq_key) + if coord_atom_site_ is None and file_type == 'nmr-star': + + if max_dim == 2: + auth_asym_id_name = 'Auth_asym_ID' + auth_seq_id_name = 'Auth_seq_ID' + else: + auth_asym_id_name = f'Auth_asym_ID_{j + 1}' + auth_seq_id_name = f'Auth_seq_ID_{j + 1}' + + if auth_asym_id_name in row and auth_seq_id_name in row\ + and row[auth_asym_id_name] not in emptyValue\ + and (isinstance(row[auth_seq_id_name], int) or row[auth_seq_id_name].isdigit()): + cif_chain_id = row[auth_asym_id_name] + cif_seq_id = row[auth_seq_id_name] + if isinstance(cif_seq_id, str): + cif_seq_id = int(cif_seq_id) + + _, seq_key, coord_atom_site_ = get_coord_atom_site_of(cif_chain_id, cif_seq_id, comp_id) + + if coord_atom_site_ is not None: + cif_comp_id = coord_atom_site_['comp_id'] + if coord_atom_site_ is None or coord_atom_site_['comp_id'] != cif_comp_id\ or (atom_id_ not in coord_atom_site_['atom_id'] and (('auth_atom_id' in coord_atom_site_ and atom_id_ not in coord_atom_site_['auth_atom_id']) @@ -45984,7 +46705,8 @@ def get_coord_atom_site_of(chain_id, seq_id, comp_id): cyclic = self.__isCyclicPolymer(ref_chain_id) if self.__nonblk_bad_nterm\ - and (seq_id == 1 or cif_seq_id == 1 or (cif_chain_id, cif_seq_id - 1) in coord_unobs_res)\ + and (seq_id == 1 or cif_seq_id == 1 or ((seq_key[0], seq_key[1] - 1) + if seq_key is not None else (cif_chain_id, cif_seq_id - 1)) in coord_unobs_res)\ and atom_id_ in aminoProtonCode and (cyclic or comp_id == 'PRO' or (atom_id_ in protonBeginCode or (coord_atom_site_ is not None and 'auth_atom_id' not in coord_atom_site_))): # DAOTHER-7665 @@ -46018,7 +46740,8 @@ def get_coord_atom_site_of(chain_id, seq_id, comp_id): modified = True elif self.__nonblk_bad_nterm\ - and (seq_id == 1 or cif_seq_id == 1 or (cif_chain_id, cif_seq_id - 1) in coord_unobs_res)\ + and (seq_id == 1 or cif_seq_id == 1 or ((seq_key[0], seq_key[1] - 1) + if seq_key is not None else (cif_chain_id, cif_seq_id - 1)) in coord_unobs_res)\ and atom_id_ == 'P': continue @@ -48736,6 +49459,1098 @@ def __updatePolymerSequence(self) -> bool: return True + def __remediateRawTextPk(self) -> bool: + """ Remediate raw text data in saveframe of spectral peak list (for NMR data remediation upgrade to Phase 2). + """ + + if not self.__combined_mode: + return True + + if len(self.__star_data) == 0: + return False + + input_source = self.report.input_sources[0] + input_source_dic = input_source.get() + + file_type = input_source_dic['file_type'] + + if file_type == 'nef': + return True + + has_poly_seq = has_key_value(input_source_dic, 'polymer_sequence') + + if not has_poly_seq: + return False + + if self.__srcPath == self.__dstPath: + return True + + content_subtype = 'spectral_peak' + + sf_category = self.sf_categories[file_type][content_subtype] + lp_category = self.lp_categories[file_type][content_subtype] + + def get_reserved_list_ids(): + rlist_ids_dict = {content_subtype: []} + for idx, sf in enumerate(self.__star_data[0].get_saveframes_by_category(sf_category), start=1): + list_id = get_first_sf_tag(sf, 'ID') + rlist_ids_dict[content_subtype].append(int(list_id) if list_id not in emptyValue else idx) + return rlist_ids_dict + + reserved_list_ids = get_reserved_list_ids() + multiple_pk_sf_idx = [] + + for idx, sf in enumerate(self.__star_data[0].get_saveframes_by_category(sf_category), start=1): + + if any(loop for loop in sf.loops if loop.category == lp_category): + continue + + text_data = get_first_sf_tag(sf, 'Text_data') + + if text_data in emptyValue: + continue + + data_format = get_first_sf_tag(sf, 'Text_data_format') + + if data_format == 'json': + continue + + data_file_name = get_first_sf_tag(sf, 'Data_file_name') + + file_type = content_subtype_dict = None + + if data_format == 'ARIA': + file_type = 'nm-pea-ari' + elif data_format == 'NMRPipe': + file_type = 'nm-pea-pip' + elif data_format == 'Sparky': + file_type = 'nm-pea-spa' + elif data_format == 'TopSpin': + file_type = 'nm-pea-top' + elif data_format == 'NMRView': + file_type = 'nm-pea-vie' + elif data_format == 'VNMR': + file_type = 'nm-pea-vnm' + elif data_format == 'XwinNMR': + file_type = 'nm-pea-xwi' + else: + + for _file_type in parsable_pk_file_types: + + if _file_type.startswith('nm-aux'): + continue + + reader = self.__getSimpleFileReader(_file_type, False) + + listener, parser_err_listener, lexer_err_listener = reader.parse(text_data, None, isFilePath=False) + + has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None + has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None + content_subtype_dict = listener.getContentSubtype() if listener is not None else None + if not has_lexer_error and not has_parser_error and content_subtype_dict is not None and len(content_subtype_dict) > 0: + file_type = _file_type + break + + if file_type is None: + continue + + if content_subtype_dict is None: + reader = self.__getSimpleFileReader(file_type, False) + + listener, parser_err_listener, lexer_err_listener = reader.parse(text_data, None, isFilePath=False) + + has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None + has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None + content_subtype_dict = listener.getContentSubtype() if listener is not None else None + + if content_subtype_dict is None\ + or content_subtype not in content_subtype_dict\ + or content_subtype_dict[content_subtype] == 0: + continue + + content_subtype_len = content_subtype_dict[content_subtype] + + if content_subtype_len == 1: # enable to process text data in place + + _reserved_list_ids = copy.deepcopy(reserved_list_ids) + list_id = get_first_sf_tag(sf, 'ID') + _reserved_list_ids[content_subtype].remove(int(list_id) if list_id not in emptyValue else idx) + + self.__remediateRawTextPk__(sf, file_type, data_file_name, text_data, _reserved_list_ids) + + else: + multiple_pk_sf_idx.append(idx) + + if len(multiple_pk_sf_idx) > 0: # need to split into multiple peak lists + + for idx, sf in enumerate(self.__star_data[0].get_saveframes_by_category(sf_category), start=1): + + if idx not in multiple_pk_sf_idx: + continue + + reserved_list_ids = get_reserved_list_ids() + list_id = get_first_sf_tag(sf, 'ID') + reserved_list_ids[content_subtype].remove(int(list_id) if list_id not in emptyValue else idx) + + text_data = get_first_sf_tag(sf, 'Text_data') + data_format = get_first_sf_tag(sf, 'Text_data_format') + data_file_name = get_first_sf_tag(sf, 'Data_file_name') + + file_type = content_subtype_dict = None + + if data_format == 'ARIA': + file_type = 'nm-pea-ari' + elif data_format == 'NMRPipe': + file_type = 'nm-pea-pip' + elif data_format == 'Sparky': + file_type = 'nm-pea-spa' + elif data_format == 'TopSpin': + file_type = 'nm-pea-top' + elif data_format == 'NMRView': + file_type = 'nm-pea-vie' + elif data_format == 'VNMR': + file_type = 'nm-pea-vnm' + elif data_format == 'XwinNMR': + file_type = 'nm-pea-xwi' + else: + + for _file_type in parsable_pk_file_types: + + if _file_type.startswith('nm-aux'): + continue + + reader = self.__getSimpleFileReader(_file_type, False) + + listener, parser_err_listener, lexer_err_listener = reader.parse(text_data, None, isFilePath=False) + + has_lexer_error = lexer_err_listener is not None and lexer_err_listener.getMessageList() is not None + has_parser_error = parser_err_listener is not None and parser_err_listener.getMessageList() is not None + content_subtype_dict = listener.getContentSubtype() if listener is not None else None + if not has_lexer_error and not has_parser_error and content_subtype_dict is not None and len(content_subtype_dict) > 0: + file_type = _file_type + break + + if file_type is None: + continue + + self.__remediateRawTextPk__(sf, file_type, data_file_name, text_data, reserved_list_ids) + + return True + + def __remediateRawTextPk__(self, src_sf: pynmrstar.Saveframe, file_type: str, data_file_name: str, text_data: str, + reserved_list_ids: List[int]) -> bool: + """ Remediate raw text data in saveframe of spectral peak list (for NMR data remediation upgrade to Phase 2). + """ + + __errors = self.report.getTotalErrors() + + content_subtype = 'spectral_peak' + + sf_framecode = get_first_sf_tag(src_sf, 'sf_framecode') + + poly_seq_set = [] + + if self.__list_id_counter is None: + self.__list_id_counter = {} + + pk_sf_dict_holder = {} + + proc_nmr_ext_poly_seq = False + + if self.__nmr_ext_poly_seq is None and not self.__bmrb_only or not self.__internal_mode: # nmrPolySeq is None in __retrieveCoordAssemblyChecker() + proc_nmr_ext_poly_seq = True + + self.__nmr_ext_poly_seq = [] + + input_source = self.report.input_sources[0] + input_source_dic = input_source.get() + + nmr_poly_seq = input_source_dic['polymer_sequence'] + cif_poly_seq = self.__caC['polymer_sequence'] + + seq_align, _ = alignPolymerSequence(self.__pA, cif_poly_seq, nmr_poly_seq) + chain_assign, _ = assignPolymerSequence(self.__pA, self.__ccU, 'nmr-star', cif_poly_seq, nmr_poly_seq, seq_align) + + if chain_assign is not None: + + for ca in chain_assign: + ref_chain_id = ca['ref_chain_id'] + test_chain_id = ca['test_chain_id'] + + sa = next(sa for sa in seq_align + if sa['ref_chain_id'] == ref_chain_id + and sa['test_chain_id'] == test_chain_id) + + if sa['conflict'] > 0 or sa['unmapped'] == 0: + continue + + s1 = next(s for s in nmr_poly_seq if s['chain_id'] == test_chain_id) + s2 = next(s for s in cif_poly_seq if s['auth_chain_id'] == ref_chain_id) + + self.__pA.setReferenceSequence(s1['comp_id'], 'REF' + test_chain_id) + self.__pA.addTestSequence(s2['comp_id'], test_chain_id) + self.__pA.doAlign() + + myAlign = self.__pA.getAlignment(test_chain_id) + + length = len(myAlign) + + _matched, unmapped, conflict, offset_1, offset_2 = getScoreOfSeqAlign(myAlign) + + if conflict == 0 and unmapped > 0: + + nmr_seq_ids, cif_auth_seq_ids = [], [] + + for i in range(length): + if str(myAlign[i][0]) != '.' and i < len(s1['seq_id']): + nmr_seq_ids.append(s1['seq_id'][i]) + else: + nmr_seq_ids.append(None) + + for i in range(length): + if str(myAlign[i][1]) != '.' and i < len(s2['seq_id']): + cif_auth_seq_ids.append(s2['auth_seq_id'][i]) + else: + cif_auth_seq_ids.append(None) + + for i in range(length): + myPr = myAlign[i] + if myPr[0] == myPr[1]: + continue + + nmr_comp_id = str(myPr[0]) + cif_comp_id = str(myPr[1]) + + if cif_comp_id == '.' and nmr_comp_id != '.': + nmr_seq_id = nmr_seq_ids[i] - offset_1 if nmr_seq_ids[i] is not None else None + if nmr_seq_id is not None: + offset = None + for _offset in range(1, 20): + if i + _offset < length: + _myPr = myAlign[i + _offset] + if _myPr[0] == _myPr[1]: + offset = _offset + break + if i - _offset >= 0: + _myPr = myAlign[i - _offset] + if _myPr[0] == _myPr[1]: + offset = -_offset + break + + if offset is not None and cif_auth_seq_ids[i + offset] is not None: + cif_auth_seq_id = cif_auth_seq_ids[i + offset] - offset - offset_2 + self.__nmr_ext_poly_seq.append({'auth_chain_id': s2['auth_chain_id'], + 'auth_seq_id': cif_auth_seq_id, + 'auth_comp_id': nmr_comp_id}) + + suspended_errors_for_lazy_eval = [] + + def consume_suspended_message(): + + if len(suspended_errors_for_lazy_eval) > 0: + for msg in suspended_errors_for_lazy_eval: + for k, v in msg.items(): + self.report.error.appendDescription(k, v) + self.report.setError() + suspended_errors_for_lazy_eval.clear() + + def deal_pea_warn_message(listener): + + if listener.warningMessage is not None: + + for warn in listener.warningMessage: + + if warn.startswith('[Concatenated sequence]'): + self.report.warning.appendDescription('concatenated_sequence', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setWarning() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Warning - {warn}\n") + + elif warn.startswith('[Sequence mismatch]'): + # consume_suspended_message() + + self.report.error.appendDescription('sequence_mismatch', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {warn}\n") + + elif warn.startswith('[Atom not found]'): + if not self.__remediation_mode or 'Macromolecules page' not in warn: + consume_suspended_message() + + self.report.error.appendDescription('atom_not_found', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {warn}\n") + else: + self.report.warning.appendDescription('sequence_mismatch', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setWarning() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Warning - {warn}\n") + + elif warn.startswith('[Hydrogen not instantiated]'): + if self.__remediation_mode: + self.report.warning.appendDescription('hydrogen_not_instantiated', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setWarning() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Warning - {warn}\n") + else: + consume_suspended_message() + + self.report.error.appendDescription('hydrogen_not_instantiated', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {warn}\n") + + elif warn.startswith('[Coordinate issue]'): + # consume_suspended_message() + + self.report.error.appendDescription('coordinate_issue', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {warn}\n") + + elif warn.startswith('[Invalid atom nomenclature]'): + consume_suspended_message() + + self.report.error.appendDescription('invalid_atom_nomenclature', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {warn}\n") + + elif warn.startswith('[Invalid atom selection]') or warn.startswith('[Invalid data]'): + consume_suspended_message() + + self.report.error.appendDescription('invalid_data', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ ValueError - {warn}\n") + + elif warn.startswith('[Sequence mismatch warning]'): + self.report.warning.appendDescription('sequence_mismatch', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setWarning() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Warning - {warn}\n") + + if seq_mismatch_warning_pattern.match(warn): + g = seq_mismatch_warning_pattern.search(warn).groups() + d = {'auth_chain_id': g[2], + 'auth_seq_id': int(g[0]), + 'auth_comp_id': g[1]} + if d not in self.__nmr_ext_poly_seq: + self.__nmr_ext_poly_seq.append(d) + + elif warn.startswith('[Missing data]'): + self.report.warning.appendDescription('missing_data', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setWarning() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Warning - {warn}\n") + + elif warn.startswith('[Range value error]') and not self.__remediation_mode: + # consume_suspended_message() + + self.report.error.appendDescription('anomalous_data', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ ValueError - {warn}\n") + + elif warn.startswith('[Range value warning]') or (warn.startswith('[Range value error]') and self.__remediation_mode): + self.report.warning.appendDescription('inconsistent_mr_data', + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}) + self.report.setWarning() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Warning - {warn}\n") + + else: + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ KeyError - " + warn) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ KeyError - {warn}\n") + + def deal_pea_warn_message_for_lazy_eval(listener): + + if listener.warningMessage is not None: + + for warn in listener.warningMessage: + + if warn.startswith('[Sequence mismatch]'): + suspended_errors_for_lazy_eval.append({'sequence_mismatch': + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}}) + + elif warn.startswith('[Atom not found]'): + if not self.__remediation_mode or 'Macromolecules page' not in warn: + suspended_errors_for_lazy_eval.append({'atom_not_found': + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}}) + + elif warn.startswith('[Hydrogen not instantiated]'): + if self.__remediation_mode: + pass + else: + suspended_errors_for_lazy_eval.append({'hydrogen_not_instantiated': + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}}) + + # elif warn.startswith('[Coordinate issue]'): + # suspended_errors_for_lazy_eval.append({'coordinate_issue': + # {'file_name': data_file_name, 'sf_framecode': sf_framecode, + # 'description': warn}}) + + # elif warn.startswith('[Invalid atom nomenclature]'): + # suspended_errors_for_lazy_eval.append({'invalid_atom_nomenclature': + # {'file_name': data_file_name, 'sf_framecode': sf_framecode, + # 'description': warn}}) + + elif warn.startswith('[Invalid atom selection]') or warn.startswith('[Invalid data]'): + suspended_errors_for_lazy_eval.append({'invalid_data': + {'file_name': data_file_name, 'sf_framecode': sf_framecode, + 'description': warn}}) + + # elif warn.startswith('[Range value error]') and not self.__remediation_mode: + # suspended_errors_for_lazy_eval.append({'anomalous_data': + # {'file_name': data_file_name, 'sf_framecode': sf_framecode, + # 'description': warn}}) + + if file_type == 'nm-pea-ari': + reader = AriaPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = AriaPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (ARIA) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-pip': + reader = NmrPipePKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = NmrPipePKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (NMRPIPE) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-spa': + reader = SparkyPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = SparkyPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (SPARKY) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-top': + reader = TopSpinPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = TopSpinPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (TOPSPIN) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-vie': + reader = NmrViewPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = NmrViewPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (NMRVIEW) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-vnm': + reader = VnmrPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = VnmrPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (VNMR) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-xea': + reader = XeasyPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + None) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None and listener.warningMessage is not None and len(listener.warningMessage) > 0: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = XeasyPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + None, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (XEASY) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + elif file_type == 'nm-pea-xwi': + reader = XwinNmrPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT) + + _list_id_counter = copy.copy(self.__list_id_counter) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=self.__list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + if listener is not None: + reasons = listener.getReasonsForReparsing() + + if reasons is not None: + deal_pea_warn_message_for_lazy_eval(listener) + + reader = XwinNmrPKReader(self.__verbose, self.__lfh, + self.__representative_model_id, + self.__representative_alt_id, + self.__mr_atom_name_mapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + reasons) + + listener, _, _ = reader.parse(text_data, self.__cifPath, isFilePath=False, + createSfDict=True, originalFileName=data_file_name, + listIdCounter=_list_id_counter, reservedListIds=reserved_list_ids, entryId=self.__entry_id) + + deal_pea_warn_message(listener) + + poly_seq = listener.getPolymerSequence() + if poly_seq is not None: + input_source.setItemValue('polymer_sequence', poly_seq) + poly_seq_set.append(poly_seq) + + seq_align = listener.getSequenceAlignment() + if seq_align is not None: + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if len(listener.getContentSubtype()) == 0: + err = f"Failed to validate NMR spectral peak list file (XWINNMR) {data_file_name!r}." + + self.report.error.appendDescription('internal_error', "+NmrDpUtility.__remediateRawTextPk() ++ Error - " + err) + self.report.setError() + + if self.__verbose: + self.__lfh.write(f"+NmrDpUtility.__remediateRawTextPk() ++ Error - {err}\n") + + self.__list_id_counter, sf_dict = listener.getSfDict() + if sf_dict is not None: + for k, v in sf_dict.items(): + content_subtype = contentSubtypeOf(k[0]) + if content_subtype not in pk_sf_dict_holder: + pk_sf_dict_holder[content_subtype] = [] + for sf in v: + if sf not in pk_sf_dict_holder[content_subtype]: + pk_sf_dict_holder[content_subtype].append(sf) + + if content_subtype in pk_sf_dict_holder: + + master_entry = self.__star_data[0] + + master_entry.remove_saveframe(sf_framecode) + + for sf in pk_sf_dict_holder[content_subtype]: + + cs_list = get_first_sf_tag(sf['saveframe'], 'Chemical_shift_list') + + if cs_list in emptyValue: + sf_category = self.sf_categories['nmr-star']['chem_shift'] + cs_sf_list = master_entry.get_saveframes_by_category(sf_category) + if len(cs_sf_list) == 1: + set_sf_tag(sf['saveframe'], 'Chemical_shift_list', get_first_sf_tag(cs_sf_list[0], 'Sf_framecode')) + + master_entry.add_saveframe(sf['saveframe']) + + if len(poly_seq_set) > 1: + + poly_seq_rst = None + for idx, poly_seq in enumerate(poly_seq_set): + if idx == 0: + poly_seq_rst = poly_seq + continue + for ps in poly_seq: + chain_id = ps['chain_id'] + for seq_id, comp_id in zip(ps['seq_id'], ps['comp_id']): + updatePolySeqRst(poly_seq_rst, chain_id, seq_id, comp_id) + + poly_seq_model = self.__caC['polymer_sequence'] + + sortPolySeqRst(poly_seq_rst) + + file_type = 'nm-pea-any' + + seq_align, _ = alignPolymerSequence(self.__pA, poly_seq_model, poly_seq_rst, conservative=False) + chain_assign, _ = assignPolymerSequence(self.__pA, self.__ccU, file_type, poly_seq_model, poly_seq_rst, seq_align) + + if chain_assign is not None: + + if len(poly_seq_model) == len(poly_seq_rst): + + chain_mapping = {} + + for ca in chain_assign: + ref_chain_id = ca['ref_chain_id'] + test_chain_id = ca['test_chain_id'] + + if ref_chain_id != test_chain_id: + chain_mapping[test_chain_id] = ref_chain_id + + if len(chain_mapping) == len(poly_seq_model): + + for ps in poly_seq_rst: + if ps['chain_id'] in chain_mapping: + ps['chain_id'] = chain_mapping[ps['chain_id']] + + seq_align, _ = alignPolymerSequence(self.__pA, poly_seq_model, poly_seq_rst, conservative=False) + chain_assign, _ = assignPolymerSequence(self.__pA, self.__ccU, file_type, poly_seq_model, poly_seq_rst, seq_align) + + trimSequenceAlignment(seq_align, chain_assign) + + input_source.setItemValue('polymer_sequence', poly_seq_rst) + + self.report.sequence_alignment.setItemValue(f'model_poly_seq_vs_{content_subtype}', seq_align) + + if proc_nmr_ext_poly_seq and len(self.__nmr_ext_poly_seq) > 0: + entity_assembly = self.__caC['entity_assembly'] + auth_chain_ids = list(set(d['auth_chain_id'] for d in self.__nmr_ext_poly_seq)) + for auth_chain_id in auth_chain_ids: + item = next(item for item in entity_assembly if auth_chain_id in item['auth_asym_id'].split(',')) + if item['entity_type'] == 'polymer': + poly_type = item['entity_poly_type'] + if poly_type.startswith('polypeptide'): + unknown_residue = 'UNK' + elif any(comp_id for comp_id in item['comp_id_set'] if comp_id in ('DA', 'DC', 'DG', 'DT'))\ + and any(comp_id for comp_id in item['comp_id_set'] if comp_id in ('A', 'C', 'G', 'U')): + unknown_residue = 'DN' + elif poly_type == 'polydeoxyribonucleotide': + unknown_residue = 'DN' + elif poly_type == 'polyribonucleotide': + unknown_residue = 'N' + else: + continue + ps = next(ps for ps in self.__caC['polymer_sequence'] if ps['auth_chain_id'] == auth_chain_id) + auth_seq_ids = [d['auth_seq_id'] for d in self.__nmr_ext_poly_seq if d['auth_chain_id'] == auth_chain_id] + auth_seq_ids.extend(list(filter(None, ps['auth_seq_id']))) + min_auth_seq_id = min(auth_seq_ids) + max_auth_seq_id = max(auth_seq_ids) + for auth_seq_id in range(min_auth_seq_id, max_auth_seq_id + 1): + if auth_seq_id not in ps['auth_seq_id']\ + and not any(d for d in self.__nmr_ext_poly_seq + if d['auth_chain_id'] == auth_chain_id and d['auth_seq_id'] == auth_seq_id): + self.__nmr_ext_poly_seq.append({'auth_chain_id': auth_chain_id, + 'auth_seq_id': auth_seq_id, + 'auth_comp_id': unknown_residue}) + + self.__nmr_ext_poly_seq = sorted(self.__nmr_ext_poly_seq, key=itemgetter('auth_chain_id', 'auth_seq_id')) + + return self.report.getTotalErrors() == __errors + def __updateAuthSequence(self) -> bool: """ Update auth sequence in NMR-STAR. """ diff --git a/wwpdb/utils/nmr/README.md b/wwpdb/utils/nmr/README.md index 1e9f2d3f..2001d78a 100644 --- a/wwpdb/utils/nmr/README.md +++ b/wwpdb/utils/nmr/README.md @@ -300,6 +300,7 @@ nm-pea-pip|**not applicable**|nmr-peaks/any|Spectral peak list file in NMRPIPE f nm-pea-spa|**not applicable**|nmr-peaks/any|Spectral peak list file in SPARKY format nm-pea-top|**not applicable**|nmr-peaks/any|Spectral peak list file in TOPSPIN format nm-pea-vie|**not applicable**|nmr-peaks/any|Spectral peak list file in NMRVIEW format +nm-pea-vnm|**not applicable**|nmr-peaks/any|Spectral peak list file in VNMR format nm-aux-xea|**not applicable**|nmr-peaks/any|Assignment file in XEASY format nm-pea-xea|**not applicable**|nmr-peaks/any|Spectral peak list file in XEASY format nm-pea-xwi|**not applicable**|nmr-peaks/any|Spectral peak list file in XWINNMR format diff --git a/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.csv b/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.csv index aa2f0779..c41a6cc4 100644 --- a/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.csv +++ b/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.csv @@ -1,11 +1,11 @@ comp_id,atom_id,count,min,max,avg,std,num_outliers THR,CG2,29747,11.7,36.170,21.550,1.090,694 -THR,H,63251,5.173,11.804,8.225,0.605,812 +THR,H,63272,5.173,11.804,8.225,0.605,812 THR,HA,38579,1.65,7.468,4.446,0.467,331 THR,HB,34630,0.92,8.346,4.166,0.319,533 THR,HG1,1216,-1.783,9.129,5.063,1.325,58 THR,MG,34610,-0.973,3.28,1.139,0.210,1122 -THR,N,60542,95.262,141.606,115.330,4.676,415 +THR,N,60563,95.262,141.606,115.330,4.675,415 TRP,C,7870,166.766,182.7,176.235,1.975,52 TRP,CA,11042,43.503,81.0,57.744,2.496,47 TRP,CB,10078,18.633,52.3,29.901,1.957,110 @@ -29,16 +29,16 @@ TRP,HZ2,6124,4.655,8.5980,7.289,0.313,212 TRP,HZ3,5528,3.877,8.898,6.881,0.366,178 TRP,N,12012,101.970,138.113,121.546,4.026,164 TRP,NE1,6055,106.0,141.38,129.262,2.134,174 -TYR,C,21555,165.167,184.78,175.541,1.936,147 -TYR,CA,29810,38.582,69.56,58.164,2.477,81 -TYR,CB,27380,25.321,57.732,39.235,2.116,214 +TYR,C,21579,165.167,184.78,175.541,1.935,147 +TYR,CA,29843,38.582,69.56,58.163,2.476,81 +TYR,CB,27413,25.321,57.732,39.235,2.114,214 TYR,CD1,10167,115.3,141.572,132.728,1.360,248 TYR,CD2,7120,113.003,139.472,132.718,1.476,149 TYR,CE1,10023,92.486,137.420,117.945,1.329,233 TYR,CE2,7028,106.548,135.823,117.921,1.246,136 TYR,CG,339,117.7,155.9,129.662,3.306,12 TYR,CZ,224,126.43,161.75577,156.898,2.476,6 -TYR,H,35052,4.156,12.34,8.281,0.719,257 +TYR,H,35085,4.156,12.34,8.281,0.718,259 TYR,HA,21303,1.188,6.825,4.599,0.543,284 TYR,HB2,19548,-0.494,4.7,2.909,0.361,426 TYR,HB3,19029,-0.192,4.7,2.846,0.381,461 @@ -47,20 +47,20 @@ TYR,HD2,14533,4.43,8.538,6.937,0.288,446 TYR,HE1,15815,4.58,8.0400,6.702,0.221,456 TYR,HE2,13873,4.58,8.5,6.704,0.223,388 TYR,HH,281,-0.788,13.748,9.075,1.584,11 -ALA,C,56024,164.477,187.2,177.815,2.027,475 -ALA,CA,75998,35.77,72.252,53.141,1.925,377 -ALA,CB,71585,6.606,40.32,18.961,1.746,1370 -ALA,H,85926,3.53,13.9288,8.195,0.572,926 +ALA,C,56076,164.477,187.2,177.816,2.026,476 +ALA,CA,76055,35.77,72.252,53.141,1.924,379 +ALA,CB,71642,6.606,40.32,18.961,1.745,1375 +ALA,H,85982,3.53,13.9288,8.195,0.572,926 ALA,HA,52146,0.870,6.514,4.238,0.420,1562 ALA,MB,50091,-0.830,3.4106,1.357,0.243,1581 -ALA,N,82354,98.053,142.81,123.380,3.422,883 -ARG,C,34850,167.086,184.51,176.494,1.966,177 -ARG,CA,48871,35.7,74.477,56.774,2.260,162 -ARG,CB,45080,18.470,44.328,30.629,1.773,632 +ALA,N,82410,98.053,142.81,123.380,3.421,883 +ARG,C,34868,167.086,184.51,176.494,1.965,177 +ARG,CA,48897,35.7,74.477,56.773,2.260,162 +ARG,CB,45107,18.470,44.328,30.629,1.773,632 ARG,CD,24070,27.121,51.422,43.164,0.918,645 ARG,CG,23954,18.22,49.3900,27.216,1.194,495 ARG,CZ,645,113.281,180.3,159.867,3.547,56 -ARG,H,56608,3.566,12.69,8.236,0.596,543 +ARG,H,56633,3.566,12.69,8.236,0.595,547 ARG,HA,35652,1.291,6.618,4.285,0.443,714 ARG,HB2,31922,-0.611,3.74,1.796,0.255,876 ARG,HB3,30156,-0.74,3.74,1.766,0.267,830 @@ -73,32 +73,32 @@ ARG,HH11,696,5.642,9.82,6.895,0.430,37 ARG,HH12,542,5.920,8.76,6.845,0.357,27 ARG,HH21,597,4.845,9.663,6.807,0.396,37 ARG,HH22,491,5.920,8.776,6.796,0.350,40 -ARG,N,52765,102.427,137.600,120.902,3.583,492 +ARG,N,52790,102.427,137.600,120.903,3.583,492 ARG,NE,4799,67.00,99.808,84.592,1.598,1488 ARG,NH1,152,67.6,87.82,74.089,4.815,39 ARG,NH2,129,69.258,87.83,72.837,2.912,45 -ASN,C,29532,166.8,187.551,175.298,1.741,223 -ASN,CA,41255,41.197,68.563,53.521,1.841,284 -ASN,CB,38753,23.164,57.35,38.687,1.633,665 +ASN,C,29562,166.8,187.551,175.298,1.740,224 +ASN,CA,41288,41.197,68.563,53.520,1.840,284 +ASN,CB,38786,23.164,57.35,38.687,1.633,665 ASN,CG,2259,111.6,183.8,176.713,2.373,15 -ASN,H,46794,2.610,12.675,8.323,0.606,713 +ASN,H,46824,2.610,12.675,8.323,0.606,713 ASN,HA,29194,2.040,6.600,4.658,0.349,588 ASN,HB2,27014,0.18,4.47,2.803,0.306,726 ASN,HB3,26031,-0.074,4.766,2.749,0.325,721 ASN,HD21,19570,2.06,9.767,7.328,0.475,352 ASN,HD22,19295,2.578,9.986,7.148,0.490,402 -ASN,N,44182,101.712,137.49,118.971,3.834,310 +ASN,N,44212,101.712,137.49,118.971,3.833,310 ASN,ND2,16660,99.4,134.500,112.746,2.236,405 -ASP,C,42672,166.8,182.955,176.432,1.671,360 -ASP,CA,58632,41.113,67.166,54.670,1.989,239 -ASP,CB,55032,26.5008,58.51,40.865,1.577,925 +ASP,C,42681,166.8,182.955,176.432,1.671,360 +ASP,CA,58642,41.113,67.166,54.670,1.988,239 +ASP,CB,55042,26.5008,58.51,40.866,1.577,925 ASP,CG,782,169.68,186.5,179.221,1.847,40 -ASP,H,66425,4.062,12.68,8.295,0.552,878 +ASP,H,66435,4.062,12.68,8.295,0.552,878 ASP,HA,40361,2.171,6.93,4.581,0.306,945 ASP,HB2,37099,-0.39,6.6,2.711,0.259,836 ASP,HB3,35580,-0.362,4.58,2.660,0.266,821 ASP,HD2,11,0.968,12.12,6.421,3.223,0 -ASP,N,64074,98.471,143.52,120.740,3.716,446 +ASP,N,64084,98.471,143.52,120.741,3.715,446 CYS,C,10931,166.733,187.591,174.822,2.032,55 CYS,CA,16559,41.514,68.074,58.028,3.450,24 CYS,CB,15666,17.99,63.89,33.453,6.556,23 @@ -108,12 +108,12 @@ CYS,HB2,16914,-0.488,4.715,2.956,0.427,493 CYS,HB3,16487,-0.83,4.77,2.893,0.438,491 CYS,HG,221,-1.830,8.486,2.086,1.269,10 CYS,N,18048,100.48,138.678,120.089,4.363,148 -GLN,C,32404,166.539,185.308,176.349,1.868,145 -GLN,CA,44301,43.453,67.016,56.540,2.066,144 -GLN,CB,40903,18.425,44.203,29.153,1.749,633 +GLN,C,32430,166.539,185.308,176.348,1.868,145 +GLN,CA,44331,43.453,67.016,56.539,2.065,144 +GLN,CB,40932,18.425,44.203,29.153,1.748,637 GLN,CD,2270,171.365,183.929,179.705,1.255,77 GLN,CG,22255,21.64,51.08,33.791,1.081,441 -GLN,H,49866,3.505,12.224,8.218,0.560,606 +GLN,H,49895,3.505,12.224,8.218,0.560,606 GLN,HA,29885,1.567,7.34,4.257,0.415,717 GLN,HB2,26747,-0.14,4.025,2.045,0.247,598 GLN,HB3,25416,-0.520,4.04,2.016,0.260,593 @@ -121,35 +121,35 @@ GLN,HE21,18192,3.39,9.922,7.229,0.439,279 GLN,HE22,17930,3.59,9.79,7.036,0.433,333 GLN,HG2,24747,-0.212,4.440,2.316,0.258,670 GLN,HG3,22860,-0.406,4.44,2.296,0.274,691 -GLN,N,47975,103.877,139.55,120.070,3.448,479 +GLN,N,48004,103.877,139.55,120.071,3.447,479 GLN,NE2,16230,92.49,133.301,111.869,1.686,455 -GLU,C,56693,166.8,183.598,176.934,1.875,369 -GLU,CA,76421,41.955,71.16,57.305,2.054,318 -GLU,CB,70836,18.356,49.560,29.952,1.668,1066 +GLU,C,56725,166.8,183.598,176.934,1.874,370 +GLU,CA,76460,41.955,71.16,57.304,2.054,318 +GLU,CB,70875,18.356,49.560,29.952,1.668,1066 GLU,CD,878,173.41,188.710,182.208,2.283,60 GLU,CG,39238,25.059,54.826,36.111,1.174,812 -GLU,H,86815,4.215,12.692,8.330,0.571,1066 +GLU,H,86853,4.215,12.692,8.330,0.571,1066 GLU,HA,53133,1.393,6.336,4.238,0.398,1407 GLU,HB2,47351,0.340,3.44,2.021,0.204,1107 GLU,HB3,44511,0.285,3.467,1.998,0.209,1074 GLU,HE2,17,2.727,7.376,4.132,1.447,1 GLU,HG2,43360,0.528,3.77,2.268,0.205,1132 GLU,HG3,40378,0.476,3.832,2.250,0.209,1009 -GLU,N,84017,101.337,138.6,120.798,3.388,824 -GLY,C,54066,163.029,187.394,173.903,1.780,889 -GLY,CA,75416,33.148,61.276,45.352,1.281,975 -GLY,H,84952,2.881,12.22,8.329,0.615,1988 +GLU,N,84055,101.337,138.6,120.799,3.387,825 +GLY,C,54107,163.029,187.394,173.903,1.779,890 +GLY,CA,75470,33.148,61.276,45.352,1.280,980 +GLY,H,85005,2.881,12.22,8.329,0.615,1988 GLY,H1,2,8.373,8.677,8.525,0.215,0 GLY,HA2,50664,0.7837959345,6.983,3.959,0.363,1316 GLY,HA3,48066,0.645,6.983,3.895,0.361,1359 -GLY,N,80434,91.124,139.866,109.546,3.545,1093 -HIS,C,14604,166.900,183.120,175.253,1.936,87 -HIS,CA,20817,42.505,82,56.471,2.291,163 -HIS,CB,19363,18.745,46.978,30.253,2.077,289 +GLY,N,80487,91.124,139.866,109.546,3.544,1095 +HIS,C,14612,166.900,183.120,175.254,1.935,87 +HIS,CA,20829,42.505,82,56.471,2.291,163 +HIS,CB,19375,18.745,46.978,30.253,2.077,289 HIS,CD2,6307,110.516,159.946,120.284,3.249,139 HIS,CE1,4880,104.667,144.756,137.590,2.317,99 HIS,CG,222,117.54,139.557,132.283,3.002,7 -HIS,H,23341,3.139,12.392,8.245,0.663,421 +HIS,H,23353,3.139,12.392,8.245,0.662,424 HIS,HA,14970,1.929,8.9,4.601,0.423,506 HIS,HB2,13785,-0.038,8.7,3.103,0.350,641 HIS,HB3,13315,-0.387,8.7,3.048,0.371,621 @@ -157,30 +157,30 @@ HIS,HD1,616,2.73,74.8,8.907,5.675,30 HIS,HD2,9423,0.264,9.415,7.001,0.464,460 HIS,HE1,7366,0.075,10.8810,7.951,0.559,274 HIS,HE2,265,6.037,16.53,9.625,2.288,22 -HIS,N,22031,103.986,136.48,119.740,4.021,250 +HIS,N,22043,103.986,136.48,119.741,4.020,250 HIS,ND1,373,162.040,229.140,193.190,18.607,108 HIS,NE2,397,161.098,226.759,183.312,16.406,26 -ILE,C,37430,166.4030,187.551,175.970,1.868,284 -ILE,CA,51443,39.563,71.856,61.677,2.672,121 -ILE,CB,47436,18.1,51.876,38.535,1.978,414 +ILE,C,37433,166.4030,187.551,175.970,1.868,284 +ILE,CA,51449,39.563,71.856,61.677,2.672,121 +ILE,CB,47442,18.1,51.876,38.535,1.977,415 ILE,CD1,31410,1.358,31.913,13.391,1.634,698 ILE,CG1,27197,8.767,42.087,27.757,1.694,428 ILE,CG2,28900,3.448,37.008,17.519,1.307,680 -ILE,H,58229,3.344,11.871,8.256,0.672,439 +ILE,H,58235,3.344,11.871,8.256,0.672,439 ILE,HA,36013,1.32,6.362,4.152,0.544,197 ILE,HB,33513,-1.280,3.87,1.789,0.286,713 ILE,HG12,30065,-2.12,2.849,1.275,0.391,471 ILE,HG13,28868,-2.368,2.990,1.204,0.405,443 ILE,MD,34597,-1.468,2.82,0.683,0.279,1093 ILE,MG,31896,-1.468,2.198,0.778,0.265,1025 -ILE,N,55829,83.327,138.12,121.416,4.159,801 -LEU,C,62467,166.222,189.78,177.107,1.901,462 -LEU,CA,85832,42.686,67.880,55.677,2.093,276 -LEU,CB,79254,26.4,53.70,42.215,1.816,1091 +ILE,N,55835,83.327,138.12,121.416,4.159,801 +LEU,C,62517,166.222,189.78,177.107,1.900,463 +LEU,CA,85889,42.686,67.880,55.677,2.092,277 +LEU,CB,79311,26.4,53.70,42.215,1.815,1094 LEU,CD1,48734,10.945,36.85,24.620,1.582,533 LEU,CD2,46619,9.860,32.515,24.100,1.667,429 LEU,CG,41701,15.3000,37.8,26.783,1.072,1180 -LEU,H,97516,3.012,13.220,8.215,0.626,763 +LEU,H,97567,3.012,13.220,8.215,0.626,763 LEU,H1,1,7.340,7.340,7.340,,0 LEU,HA,59732,1.721,6.420,4.294,0.450,695 LEU,HB2,54240,-1.252,4.1281,1.611,0.336,1071 @@ -188,14 +188,14 @@ LEU,HB3,51903,-1.777,3.2260,1.529,0.358,1063 LEU,HG,47015,-1.06,3.9,1.511,0.329,964 LEU,MD1,55847,-1.76,2.3640,0.755,0.272,1944 LEU,MD2,53829,-1.922,2.349,0.736,0.278,1831 -LEU,N,93135,84.655,177.633,121.846,3.811,606 -LYS,C,50626,166.633,185.000,176.732,1.893,340 -LYS,CA,70111,40.726,75.496,56.955,2.149,243 -LYS,CB,64930,15.95,46.600,32.743,1.736,1015 +LEU,N,93186,84.655,177.633,121.846,3.810,606 +LYS,C,50637,166.633,185.000,176.732,1.892,342 +LYS,CA,70126,40.726,75.496,56.955,2.148,244 +LYS,CB,64945,15.95,46.600,32.743,1.736,1015 LYS,CD,33534,15.366,42.868,28.966,1.088,1087 LYS,CE,32179,22.662,56.0,41.896,0.859,1111 LYS,CG,35755,16.845,40.50,24.896,1.103,1071 -LYS,H,81764,3.258,12.031,8.177,0.585,993 +LYS,H,81779,3.258,12.031,8.177,0.585,993 LYS,HA,51631,0.68,7.96,4.254,0.420,1074 LYS,HB2,45806,-0.300,3.819,1.779,0.237,1217 LYS,HB3,43131,-0.449,3.819,1.753,0.256,1127 @@ -205,32 +205,32 @@ LYS,HE2,35993,0.750,4.43,2.914,0.192,1238 LYS,HE3,31859,1.171,4.550,2.908,0.197,1098 LYS,HG2,41143,-0.77,3.128,1.370,0.247,1326 LYS,HG3,38089,-0.871,3.046,1.354,0.261,1200 -LYS,N,76871,101.1,140.3,121.120,3.664,640 +LYS,N,76886,101.1,140.3,121.120,3.663,642 LYS,NZ,126,20.9,47.3444,33.111,2.685,128 LYS,QZ,1433,1.320,9.90,7.412,0.609,65 -MET,C,15389,165.891,185.212,176.259,2.027,77 -MET,CA,21531,43.281,66.860,56.130,2.173,84 -MET,CB,19745,17.370,46.46,32.910,2.127,302 +MET,C,15406,165.891,185.212,176.260,2.026,77 +MET,CA,21549,43.281,66.860,56.129,2.172,84 +MET,CB,19762,17.370,46.46,32.910,2.126,303 MET,CE,8451,0.000,48.46,17.119,1.700,141 MET,CG,10243,15.937,51.7,32.028,1.319,205 -MET,H,23023,4.865,12.456,8.250,0.570,213 +MET,H,23037,4.865,12.456,8.250,0.570,213 MET,HA,14700,1.127,6.35,4.389,0.455,300 MET,HB2,12973,-1.05,4.07,2.029,0.321,372 MET,HB3,12187,-0.99,3.47,1.994,0.332,301 MET,HG2,11827,-0.528,4.400,2.422,0.354,369 MET,HG3,11198,-0.528,4.240,2.396,0.370,355 MET,ME,9195,-0.713,8.381,1.890,0.375,334 -MET,N,22355,102.804,138.547,120.135,3.421,220 -PHE,C,25974,166.845,184.929,175.490,1.939,162 -PHE,CA,35931,36.030,69.821,58.118,2.538,127 -PHE,CB,33350,25.52,56.739,39.877,2.030,312 +MET,N,22369,102.804,138.547,120.136,3.420,220 +PHE,C,25986,166.845,184.929,175.490,1.938,163 +PHE,CA,35946,36.030,69.821,58.118,2.537,127 +PHE,CB,33365,25.52,56.739,39.877,2.030,312 PHE,CD1,11461,116.948,148.7280,131.582,1.248,275 PHE,CD2,8116,115.549,140.309,131.572,1.209,191 PHE,CE1,9972,114.754,139.560,130.724,1.325,227 PHE,CE2,7049,114.7,139.70,130.759,1.215,160 PHE,CG,374,127.24,156.3,138.265,2.816,15 PHE,CZ,7353,115.100,147.2589,129.245,1.476,157 -PHE,H,41080,3.549,12.357,8.329,0.712,365 +PHE,H,41095,3.549,12.357,8.329,0.712,365 PHE,HA,24971,1.33,6.868,4.605,0.554,194 PHE,HB2,23020,0.159,4.461,3.002,0.359,466 PHE,HB3,22465,-0.212,4.690,2.942,0.381,476 @@ -239,10 +239,10 @@ PHE,HD2,16175,4.469,8.6518,7.062,0.309,496 PHE,HE1,16371,4.378,8.41,7.088,0.305,527 PHE,HE2,14205,4.378,8.41,7.086,0.309,460 PHE,HZ,11263,4.324,8.9479,6.998,0.411,375 -PHE,N,39003,101.474,139.02,120.369,4.079,226 -PRO,C,28970,168.381,183.423,176.771,1.445,411 -PRO,CA,40209,45.436,72.28,63.339,1.484,484 -PRO,CB,37104,20.914,50.25,31.838,1.147,941 +PHE,N,39018,101.474,139.02,120.369,4.079,226 +PRO,C,29023,168.381,183.423,176.771,1.444,411 +PRO,CA,40267,45.436,72.28,63.339,1.483,485 +PRO,CB,37158,20.914,50.25,31.839,1.146,949 PRO,CD,21511,26.918,66.221,50.343,1.043,470 PRO,CG,21588,18.2800,50.753,27.202,1.103,497 PRO,H,8,7.808,9.1660,8.519,0.473,0 @@ -254,27 +254,27 @@ PRO,HD3,23260,0.10,5.357,3.620,0.369,910 PRO,HG2,23541,-0.7800,4.418,1.928,0.301,890 PRO,HG3,21843,-0.880,4.418,1.906,0.312,843 PRO,N,2417,110.492,145.739,135.663,4.931,345 -SER,C,47300,164.470,197.1,174.635,1.686,542 -SER,CA,65846,45.13,73.678,58.685,2.033,318 -SER,CB,60473,30.972,78.834,63.795,1.493,936 -SER,H,72845,2.9640,13.13,8.275,0.559,1015 +SER,C,47332,164.470,197.1,174.635,1.685,544 +SER,CA,65886,45.13,73.678,58.684,2.033,318 +SER,CB,60513,30.972,78.834,63.795,1.492,938 +SER,H,72883,2.9640,13.13,8.275,0.559,1015 SER,HA,44603,1.277,6.8530,4.466,0.392,1236 SER,HB2,40373,1.673,5.660,3.871,0.250,1026 SER,HB3,37319,1.190,5.574,3.847,0.268,952 SER,HG,751,0.13,8.97,5.338,1.042,42 -SER,N,69622,95.97,133.684,116.308,3.396,797 -THR,C,40145,165.5,185.319,174.556,1.691,452 -THR,CA,55739,40.737,73.254,62.205,2.544,179 -THR,CB,51089,28.964,81.526,69.700,1.681,629 -TYR,N,32695,61.07,144.96,120.447,4.070,265 -VAL,C,49438,164.438,183.949,175.721,1.839,344 -VAL,CA,67553,39.654,77.145,62.534,2.822,144 -VAL,CB,62024,17.205,45.331,32.674,1.761,413 +SER,N,69660,95.97,133.684,116.308,3.395,799 +THR,C,40166,165.5,185.319,174.556,1.690,452 +THR,CA,55760,40.737,73.254,62.205,2.544,179 +THR,CB,51110,28.964,81.526,69.700,1.680,629 +TYR,N,32728,61.07,144.96,120.449,4.069,265 +VAL,C,49453,164.438,183.949,175.721,1.838,345 +VAL,CA,67571,39.654,77.145,62.534,2.822,144 +VAL,CB,62042,17.205,45.331,32.674,1.761,413 VAL,CG1,39176,12.071,32.27,21.490,1.358,571 VAL,CG2,37866,11.375,33.118,21.301,1.514,481 -VAL,H,76069,3.98,12.585,8.266,0.655,540 +VAL,H,76087,3.98,12.585,8.266,0.655,540 VAL,HA,46823,0.972,6.298,4.158,0.565,220 VAL,HB,42997,-1.240,3.758,1.986,0.309,951 VAL,MG1,43959,-1.55,2.573,0.824,0.260,1345 VAL,MG2,43175,-2.32,3.32,0.806,0.276,1265 -VAL,N,73511,93.758,143.29,121.077,4.337,850 +VAL,N,73529,93.758,143.29,121.077,4.337,850 diff --git a/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.pkl b/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.pkl index ec73771f..5f18a222 100644 Binary files a/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.pkl and b/wwpdb/utils/nmr/bmrb_cs_stat/aa_filt.pkl differ diff --git a/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.csv b/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.csv index 89b128ff..f6bbb1f0 100644 --- a/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.csv +++ b/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.csv @@ -1,16 +1,16 @@ comp_id,atom_id,count,min,max,avg,std,num_outliers SER,HN,1,7.91,7.91,7.910,,0 -SER,N,84847,0.000,416.964,116.295,4.079,303 -THR,C,49385,4.780,185.918,174.461,3.877,38 -THR,CA,68855,0.971,92.659,62.197,2.716,131 -THR,CB,63492,-939.2800,629.206,69.608,5.190,170 +SER,N,84885,0.000,416.964,116.295,4.078,303 +THR,C,49406,4.780,185.918,174.461,3.876,38 +THR,CA,68876,0.971,92.659,62.197,2.716,131 +THR,CB,63513,-939.2800,629.206,69.608,5.189,170 THR,CG2,38780,7.177,175.6,21.591,1.845,127 -THR,H,78166,0.02,21.7,8.226,0.631,678 +THR,H,78187,0.02,21.7,8.226,0.631,678 THR,HA,49360,0.87,7.468,4.448,0.476,295 THR,HB,44970,0.087,71.587,4.169,0.630,93 THR,HG1,1858,-1.783,11.01,5.149,1.446,30 THR,MG,44998,-12.1,16.3,1.139,0.272,593 -THR,N,74987,0.0,402,115.370,6.072,82 +THR,N,75008,0.0,402,115.371,6.071,82 TRP,C,10220,2.500,184.30,176.034,5.563,12 TRP,CA,14298,2.966,362.099,57.738,4.490,14 TRP,CB,13163,1.6,328.795,30.045,4.455,23 @@ -34,29 +34,29 @@ TRP,HZ2,8446,2.63,10.81,7.269,0.403,124 TRP,HZ3,7546,0.76,8.898,6.855,0.462,97 TRP,N,15575,6.712,423.160,121.619,5.726,15 TRP,NE1,8428,0.53,435.960,129.275,5.987,36 -TYR,C,27090,2.200,184.78,175.405,4.350,23 -TYR,CA,37566,2.200,357.681,58.130,2.994,29 -TYR,CB,34709,18.38,338.686,39.278,2.985,58 +TYR,C,27114,2.200,184.78,175.405,4.348,23 +TYR,CA,37599,2.200,357.681,58.130,2.993,29 +TYR,CB,34742,18.38,338.686,39.277,2.984,58 TYR,CD1,13569,19.40,141.572,132.388,5.216,70 TYR,CD2,9312,3.492,139.644,132.401,5.144,53 TYR,CE1,13311,40.435,182.764,117.737,4.011,113 TYR,CE2,9190,34.1221,154.10,117.787,3.203,73 TYR,CG,480,7.113,175.115,128.267,12.396,7 -ALA,C,68694,0.037,187.2,177.745,3.516,44 -ALA,CA,93611,17.007,354.698,53.146,2.639,95 -ALA,CB,88869,-40.993,318.868,19.031,2.882,217 -ALA,H,106183,-0.914,131.25,8.195,0.895,133 +ALA,C,68746,0.037,187.2,177.745,3.515,44 +ALA,CA,93668,17.007,354.698,53.146,2.639,95 +ALA,CB,88926,-40.993,318.868,19.031,2.881,217 +ALA,H,106239,-0.914,131.25,8.195,0.894,135 ALA,HA,66264,-2.52,17.870,4.243,0.439,1293 ALA,HN,1,8.32,8.32,8.320,,0 ALA,MB,64213,-14.040,5.48,1.353,0.275,1169 -ALA,N,102005,0.049,766,123.375,5.693,118 -ARG,C,42940,0.174,184.96,176.429,3.181,14 -ARG,CA,60453,8.369,358.124,56.771,3.175,66 -ARG,CB,56009,15.013,329.120,30.673,2.400,157 +ALA,N,102061,0.049,766,123.375,5.691,118 +ARG,C,42958,0.174,184.96,176.429,3.181,14 +ARG,CA,60479,8.369,358.124,56.771,3.174,66 +ARG,CB,56036,15.013,329.120,30.673,2.400,157 ARG,CD,31157,18.9350,342.642,43.199,2.792,48 ARG,CG,30954,0.000,328.290,27.248,2.906,58 ARG,CZ,880,43.199,184.497,160.085,6.983,9 -ARG,H,69746,0.011,178,8.241,0.988,47 +ARG,H,69771,0.011,178,8.241,0.987,47 ARG,HA,45118,1.212,12.57,4.287,0.465,544 ARG,HB2,40716,-4.78,27.530,1.789,0.307,533 ARG,HB3,38452,-2.880,27.530,1.760,0.318,555 @@ -69,32 +69,32 @@ ARG,HH11,1009,4.41,11.7,6.933,0.567,22 ARG,HH12,772,4.41,10.727,6.881,0.533,18 ARG,HH21,866,1.233,11.352,6.827,0.643,19 ARG,HH22,712,1.233,60.1410,6.907,2.096,1 -ARG,N,65394,0.125,433.808,120.853,4.565,110 +ARG,N,65419,0.125,433.808,120.854,4.564,110 ARG,NE,7456,-23.150,149.1080,89.924,13.498,60 ARG,NH1,304,6.450,124.7890,78.866,13.552,6 ARG,NH2,263,66.2,128.470,78.770,13.982,7 -ASN,C,36219,0.114,187.551,175.220,3.437,21 -ASN,CA,50783,2.200,354.022,53.531,3.283,37 -ASN,CB,47904,1.9620,342.798,38.715,3.342,54 +ASN,C,36249,0.114,187.551,175.220,3.436,21 +ASN,CA,50816,2.200,354.022,53.530,3.282,37 +ASN,CB,47937,1.9620,342.798,38.715,3.341,54 ASN,CG,3022,0.000,185.503,176.235,8.700,12 -ASN,H,57618,0.008,118.641,8.354,1.907,26 +ASN,H,57648,0.008,118.641,8.354,1.906,27 ASN,HA,37063,0.896,7.110,4.659,0.360,516 ASN,HB2,34606,-0.827,8.883,2.799,0.334,554 ASN,HB3,33385,-0.948,5.958,2.743,0.357,562 ASN,HD21,25715,0.687,111.320,7.335,0.825,53 ASN,HD22,25387,0.905,111.320,7.144,0.840,117 -ASN,N,54613,0.041,426.314,118.930,5.249,41 +ASN,N,54643,0.041,426.314,118.930,5.248,41 ASN,ND2,22266,21.038,1114.29,112.874,12.098,12 -ASP,C,53098,0.106,184.14,176.364,3.412,28 -ASP,CA,73037,5.630,354.531,54.675,2.604,78 -ASP,CB,68895,9.7,341.273,40.881,2.422,181 +ASP,C,53107,0.106,184.14,176.364,3.411,28 +ASP,CA,73047,5.630,354.531,54.675,2.604,78 +ASP,CB,68905,9.7,341.273,40.881,2.422,181 ASP,CG,1159,2.637,188.215,177.394,17.306,14 -ASP,H,82960,-0.35,25.876,8.296,0.580,706 +ASP,H,82970,-0.35,25.876,8.296,0.580,706 ASP,HA,52017,-3.75,8.66,4.583,0.324,762 ASP,HB2,48256,-5.2,37.4,2.716,0.491,104 ASP,HB3,46286,-1.46,37.2,2.666,0.498,122 ASP,HD2,22,0.968,12.30,5.611,3.198,0 -ASP,N,80089,0.061,428.093,120.719,4.495,126 +ASP,N,80099,0.061,428.093,120.719,4.494,126 CYS,C,13402,1.000,187.591,174.742,3.299,10 CYS,CA,20337,30.6688,90.374,57.980,3.492,24 CYS,CB,19320,17.850,111.008,33.478,6.664,21 @@ -104,12 +104,12 @@ CYS,HB2,20622,-39.82,363.580,3.118,6.051,43 CYS,HB3,20089,-44.2,363.580,3.043,5.487,43 CYS,HG,294,-1.830,10.700,2.080,1.386,6 CYS,N,22447,-147,628,120.340,16.795,82 -GLN,C,39070,0.069,1755.998,176.324,8.696,16 -GLN,CA,53693,1.733,356.830,56.539,2.529,53 -GLN,CB,49875,1.843,328.286,29.178,2.402,168 +GLN,C,39096,0.069,1755.998,176.324,8.693,16 +GLN,CA,53723,1.733,356.830,56.538,2.528,53 +GLN,CB,49904,1.843,328.286,29.179,2.402,168 GLN,CD,3005,6.789,190.624,179.339,7.132,7 GLN,CG,28381,0.000,333.032,33.807,2.445,45 -GLN,H,60503,0.000,122.824,8.243,1.858,23 +GLN,H,60532,0.000,122.824,8.243,1.857,23 GLN,HA,37492,0.000,29.948,4.264,0.467,380 GLN,HB2,33841,-1.514,10.461,2.043,0.273,455 GLN,HB3,32127,-1.4980,20.9,2.015,0.319,385 @@ -117,35 +117,35 @@ GLN,HE21,23642,-3.41,23.893,7.222,0.498,199 GLN,HE22,23347,0.000,113.695,7.038,0.851,36 GLN,HG2,31456,-1.76,33.5990,2.314,0.329,374 GLN,HG3,29106,-1.395,34.946,2.295,0.352,412 -GLN,N,58363,0.000,418.059,120.000,4.394,115 +GLN,N,58392,0.000,418.059,120.001,4.393,115 GLN,NE2,21294,33.9,412.160,111.875,2.909,71 -GLU,C,69510,0.074,184.71,176.840,4.028,46 -GLU,CA,94147,1.056,360.826,57.316,3.102,84 -GLU,CB,87685,9.08,330.834,29.994,2.954,139 +GLU,C,69542,0.074,184.71,176.840,4.027,46 +GLU,CA,94186,1.056,360.826,57.316,3.102,84 +GLU,CB,87724,9.08,330.834,29.994,2.954,139 GLU,CD,1227,0.000,198.609,181.241,13.526,8 GLU,CG,50730,6.16,337.230,36.141,2.821,70 -GLU,H,107028,0.008,123.2260,8.330,0.796,257 +GLU,H,107066,0.008,123.2260,8.330,0.796,257 GLU,HA,67655,0.433,8.02,4.239,0.409,1247 GLU,HB2,60883,-1.470,4.82,2.018,0.220,872 GLU,HB3,57231,-1.633,8.095,1.995,0.226,826 GLU,HE2,39,0.801,11.96,4.820,1.895,1 GLU,HG2,55982,-0.674,4.69,2.265,0.219,936 GLU,HG3,52071,-0.10,4.69,2.246,0.222,837 -GLU,N,103593,0.044,422.043,120.750,4.481,142 -GLY,C,66682,1.000,189.533,173.833,3.528,65 -GLY,CA,93149,2.200,344.994,45.369,2.091,191 -GLY,H,105113,-15.3,121.881,8.328,0.867,469 +GLU,N,103631,0.044,422.043,120.750,4.481,142 +GLY,C,66723,1.000,189.533,173.833,3.527,65 +GLY,CA,93203,2.200,344.994,45.369,2.090,191 +GLY,H,105166,-15.3,121.881,8.328,0.867,469 GLY,H1,2,8.373,8.677,8.525,0.215,0 GLY,HA2,64946,-3.4,8.64,3.958,0.397,1051 GLY,HA3,61629,-3.936,43.9930,3.890,0.431,877 -GLY,N,99972,0.2,791,109.639,6.526,283 -HIS,C,18208,1.000,184.204,175.137,4.520,16 -HIS,CA,26121,11.40,355.084,56.496,3.251,67 -HIS,CB,24408,13.496,329.046,30.315,3.030,78 +GLY,N,100025,0.2,791,109.639,6.524,283 +HIS,C,18216,1.000,184.204,175.137,4.519,16 +HIS,CA,26133,11.40,355.084,56.495,3.250,67 +HIS,CB,24420,13.496,329.046,30.315,3.029,78 HIS,CD2,8293,7.19,159.946,119.918,5.482,59 HIS,CE1,6483,8.198,166.282,137.258,5.498,62 HIS,CG,329,18.669,139.83,131.479,8.734,3 -HIS,H,29448,-0.3,177.991,8.258,1.224,40 +HIS,H,29460,-0.3,177.991,8.258,1.224,40 HIS,HA,19457,0.676,11.38,4.615,0.553,244 HIS,HB2,18056,-2.168,45.897,3.153,1.070,132 HIS,HB3,17491,-6.2,38.5,3.096,1.042,140 @@ -153,30 +153,30 @@ HIS,HD1,1112,-15,86.5,9.835,8.233,27 HIS,HD2,12562,-25.85,67.8,7.137,3.140,90 HIS,HE1,9843,-26.6,134.811,7.841,2.446,73 HIS,HE2,423,-15,76.4,11.071,7.584,11 -HIS,N,27835,0.2,427.146,119.687,5.067,47 +HIS,N,27847,0.2,427.146,119.687,5.066,47 HIS,ND1,895,31.026,261.013,190.990,33.552,2 HIS,NE2,805,17.0,257.572,180.659,19.986,21 -ILE,C,46040,0,187.551,175.837,4.299,32 -ILE,CA,63682,20.877,362.184,61.637,3.252,67 -ILE,CB,58959,-34.477,339.785,38.558,2.790,106 +ILE,C,46043,0,187.551,175.837,4.299,32 +ILE,CA,63688,20.877,362.184,61.637,3.252,67 +ILE,CB,58965,-34.477,339.785,38.558,2.790,106 ILE,CD1,40308,1.358,314.600,13.488,3.297,118 ILE,CG1,35040,8.0,329.288,27.765,3.205,168 ILE,CG2,37316,0.79,317.615,17.598,3.132,126 -ILE,H,72028,0.008,11.871,8.256,0.688,385 +ILE,H,72034,0.008,11.871,8.256,0.688,385 ILE,HA,45627,-9.0,173.538,4.162,0.971,7 ILE,HB,42746,-2.442,38.700,1.785,0.389,247 ILE,HG12,38656,-10.1,5.56,1.264,0.446,305 ILE,HG13,37143,-10.1,9.71,1.196,0.478,281 ILE,MD,44169,-4.15,13.891,0.674,0.325,703 ILE,MG,40966,-3.919,6.23,0.770,0.301,657 -ILE,N,69454,0.0000,531,121.434,5.847,135 -LEU,C,76707,0.071,189.78,177.015,3.478,32 -LEU,CA,105816,1.056,158.320,55.650,2.208,213 -LEU,CB,98202,7.439,93.180,42.221,1.985,674 +ILE,N,69460,0.0000,531,121.434,5.847,135 +LEU,C,76757,0.071,189.78,177.015,3.477,32 +LEU,CA,105873,1.056,158.320,55.650,2.207,213 +LEU,CB,98259,7.439,93.180,42.221,1.985,674 LEU,CD1,62448,0.438,120.700,24.651,2.005,236 LEU,CD2,59679,0.280,116.300,24.132,2.079,184 LEU,CG,53631,0.000,75.280,26.805,1.459,413 -LEU,H,119997,-0.3,119.596,8.218,0.722,412 +LEU,H,120048,-0.3,119.596,8.218,0.722,412 LEU,H1,1,7.340,7.340,7.340,,0 LEU,HA,75394,0.000,119.411,4.300,0.626,83 LEU,HB2,68947,-1.825,8.02,1.608,0.358,896 @@ -185,14 +185,14 @@ LEU,HG,60400,-2.08,5.965,1.503,0.348,753 LEU,HN,2,7.62,7.76,7.690,0.099,0 LEU,MD1,71000,-3.42,30.176,0.747,0.327,1130 LEU,MD2,68378,-3.42,24.59,0.729,0.382,669 -LEU,N,115246,0.044,627,121.947,7.315,114 -LYS,C,62089,0.112,996.253,176.632,5.302,39 -LYS,CA,86315,1.155,359.222,56.946,3.050,78 -LYS,CB,80265,-26.686,332.988,32.768,2.761,116 +LEU,N,115297,0.044,627,121.947,7.313,114 +LYS,C,62100,0.112,996.253,176.632,5.302,39 +LYS,CA,86330,1.155,359.222,56.945,3.050,78 +LYS,CB,80280,-26.686,332.988,32.768,2.761,116 LYS,CD,43059,0.834,329.284,28.995,2.523,82 LYS,CE,41430,-0.130,342.334,41.927,2.900,73 LYS,CG,45835,12.109,325.487,24.953,2.980,98 -LYS,H,101256,0.002,123.7085,8.191,1.515,35 +LYS,H,101271,0.002,123.7085,8.191,1.514,35 LYS,HA,65320,-0.118,33.308,4.256,0.465,613 LYS,HB2,58534,-1.416,10.94,1.775,0.263,955 LYS,HB3,55023,-3.038,9.43,1.749,0.278,905 @@ -203,32 +203,32 @@ LYS,HE3,40543,-0.046,7.344,2.904,0.220,859 LYS,HG2,52735,-1.654,8.362,1.364,0.270,1059 LYS,HG3,48648,-1.83,5.575,1.349,0.279,1014 LYS,HZ,5,7.666,7.989,7.826,0.158,0 -LYS,N,95334,0.041,427.245,121.062,4.742,151 +LYS,N,95349,0.041,427.245,121.062,4.742,151 LYS,NZ,362,1.950,177.2,50.540,32.916,3 LYS,QZ,1815,-10.9,10.506,7.348,1.010,47 -MET,C,18895,2.200,185.212,176.201,3.189,7 -MET,CA,26546,25.7283,85.327,56.119,2.266,64 -MET,CB,24428,0.2,332.173,32.957,3.053,57 +MET,C,18912,2.200,185.212,176.201,3.187,7 +MET,CA,26564,25.7283,85.327,56.119,2.265,64 +MET,CB,24445,0.2,332.173,32.957,3.052,57 MET,CE,10988,0.000,317.645,17.238,3.994,56 MET,CG,13268,2.30,332.686,32.064,3.090,33 -MET,H,28398,-0.21,177,8.256,1.169,23 +MET,H,28412,-0.21,177,8.256,1.169,23 MET,HA,18634,-0.93,313.565,4.410,2.315,1 MET,HB2,16615,-27.312,33.750,2.026,0.561,93 MET,HB3,15610,-27.312,12.94,1.996,0.505,120 MET,HG2,15225,-33.86,32.7,2.382,1.393,49 MET,HG3,14379,-33.86,31.7,2.356,1.501,49 MET,ME,12022,-24.86,10.2000,1.787,1.470,89 -MET,N,27661,0.000,428.252,120.115,4.846,46 -PHE,C,32339,0.088,184.929,175.451,2.898,13 -PHE,CA,44837,4.917,363.618,58.105,3.635,42 -PHE,CB,41864,2.161,341.700,39.915,3.398,56 +MET,N,27675,0.000,428.252,120.116,4.844,46 +PHE,C,32351,0.088,184.929,175.451,2.897,13 +PHE,CA,44852,4.917,363.618,58.104,3.634,42 +PHE,CB,41879,2.161,341.700,39.915,3.398,56 PHE,CD1,15069,7.160,148.7280,131.202,5.763,73 PHE,CD2,10632,7.160,140.309,131.345,4.379,36 PHE,CE1,13082,0.000,149.609,130.349,5.710,63 PHE,CE2,9230,7.307,149.609,130.543,4.085,37 PHE,CG,524,7.229,156.3,137.477,10.486,4 PHE,CZ,9712,7.351,165.611,129.034,4.139,35 -PHE,H,51175,-0.5,12.357,8.330,0.730,327 +PHE,H,51190,-0.5,12.357,8.330,0.730,327 PHE,HA,32230,1.33,59.70,4.614,0.710,29 PHE,HB2,29943,-0.463,7.979,2.994,0.378,406 PHE,HB3,29172,-0.212,12.72,2.936,0.397,429 @@ -237,10 +237,10 @@ PHE,HD2,21064,0.603,12.154,7.041,0.404,206 PHE,HE1,21585,-2.838,14.080,7.065,0.443,181 PHE,HE2,18549,0,12.9,7.064,0.438,168 PHE,HZ,15039,-7.14,43.623,6.995,0.699,122 -PHE,N,48844,0.067,422.843,120.390,5.390,71 -PRO,C,35289,0,183.517,176.664,4.031,31 -PRO,CA,49658,0,363.087,63.328,3.380,93 -PRO,CB,46073,0,333.586,31.878,2.935,80 +PHE,N,48859,0.067,422.843,120.390,5.389,71 +PRO,C,35342,0,183.517,176.664,4.028,31 +PRO,CA,49716,0,363.087,63.328,3.378,93 +PRO,CB,46127,0,333.586,31.878,2.933,80 PRO,CD,27972,1.155,350.648,50.344,3.058,66 PRO,CG,27931,2.436,327.402,27.266,3.540,44 PRO,H,16,7.264,9.521,8.543,0.592,0 @@ -253,16 +253,16 @@ PRO,HD3,30268,-6.56,8.353,3.603,0.459,560 PRO,HG2,30516,-2.35,7.395,1.919,0.339,734 PRO,HG3,28347,-1.520,4.92,1.896,0.349,682 PRO,N,3005,0.140,430,134.832,21.007,39 -SER,C,57415,0.000,197.1,174.557,3.601,41 -SER,CA,80216,4.331,656.505,58.681,3.406,63 -SER,CB,74054,-939.2800,365.087,63.726,4.568,183 -SER,H,88563,-15.3,116.95709,8.275,0.693,392 +SER,C,57447,0.000,197.1,174.557,3.600,41 +SER,CA,80256,4.331,656.505,58.681,3.405,63 +SER,CB,74094,-939.2800,365.087,63.726,4.567,183 +SER,H,88601,-15.3,116.95709,8.275,0.692,394 SER,HA,56413,1.277,58.739,4.474,0.466,526 SER,HB2,51380,0.61,9.182,3.868,0.275,808 SER,HB3,47621,0.61,41.7,3.845,0.335,564 SER,HG,1085,0.13,11.36,5.387,1.176,26 TYR,CZ,350,6.839,165.718,155.878,12.466,3 -TYR,H,44069,0.02,12.34,8.285,0.734,223 +TYR,H,44102,0.02,12.34,8.285,0.734,223 TYR,HA,27672,0.442,7.160,4.608,0.558,230 TYR,HB2,25669,-21.230,23.28,2.898,0.457,219 TYR,HB3,25021,-21.230,23.28,2.835,0.474,266 @@ -271,16 +271,16 @@ TYR,HD2,18849,0.5522,10.499,6.918,0.369,227 TYR,HE1,20809,0.08,11.8,6.691,0.302,186 TYR,HE2,17964,0.43,11.7,6.692,0.312,161 TYR,HH,497,-0.788,31,9.051,2.090,5 -TYR,N,41457,0.2,818,120.671,10.944,38 -VAL,C,61183,1,205.699,175.647,3.253,36 -VAL,CA,83994,-17.046,362.057,62.497,3.140,116 -VAL,CB,77587,15.597025,331.747,32.696,2.209,164 +TYR,N,41490,0.2,818,120.673,10.940,38 +VAL,C,61198,1,205.699,175.647,3.253,36 +VAL,CA,84012,-17.046,362.057,62.497,3.140,116 +VAL,CB,77605,15.597025,331.747,32.696,2.209,164 VAL,CG1,50756,-7.4,321.185,21.528,2.331,94 VAL,CG2,49091,-5.648,320.420,21.344,2.427,96 -VAL,H,94673,-0.41,15.050,8.266,0.674,444 +VAL,H,94691,-0.41,15.050,8.266,0.674,444 VAL,H1,1,8.025,8.025,8.025,,0 VAL,HA,59892,-2.83,54.971,4.165,0.621,135 VAL,HB,55614,-27.480,31.75,1.981,0.437,438 VAL,MG1,56708,-27.2,24.20,0.819,0.330,645 VAL,MG2,55807,-27.2,56.56,0.802,0.417,318 -VAL,N,91797,0.2,529,121.138,6.949,100 +VAL,N,91815,0.2,529,121.138,6.949,100 diff --git a/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.pkl b/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.pkl index 1271a02c..ed6e391d 100644 Binary files a/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.pkl and b/wwpdb/utils/nmr/bmrb_cs_stat/aa_full.pkl differ diff --git a/wwpdb/utils/nmr/bmrb_cs_stat/others.csv b/wwpdb/utils/nmr/bmrb_cs_stat/others.csv index 2c816320..de14c3d2 100644 --- a/wwpdb/utils/nmr/bmrb_cs_stat/others.csv +++ b/wwpdb/utils/nmr/bmrb_cs_stat/others.csv @@ -1688,7 +1688,7 @@ ALY,HB2,17,1.334,2.05,1.697,0.177 ALY,HB3,15,1.478,2.05,1.758,0.153 ALY,HCA,12,3.120,4.663,3.940,0.472 ALY,HD1,4,1.471,1.629,1.525,0.075 -ALY,HD2,14,1.22,1.763,1.458,0.166 +ALY,HD2,14,1.220,1.763,1.458,0.166 ALY,HD3,12,1.220,1.700,1.475,0.158 ALY,HE1,4,3.126,3.163,3.139,0.017 ALY,HE2,14,2.78,3.360,3.025,0.174 @@ -3357,7 +3357,7 @@ DLY,HZ,1,8.4,8.4,8.400, DLY,HZ1,6,7.258,7.78,7.599,0.178 DLY,HZ2,5,7.614,7.78,7.667,0.069 DLY,HZ3,5,7.614,7.78,7.667,0.069 -DLY,N,6,113.0,121.8,118.587,3.331 +DLY,N,6,113.0,121.800,118.587,3.331 DLY,NZ,2,29.9,33.30,31.600,2.404 DMA,CH3,2,3.010,3.279,3.145,0.190 DMA,H1',2,5.539,6.279,5.909,0.523 @@ -3553,7 +3553,7 @@ DTR,HB2,30,2.659,3.37,2.980,0.187 DTR,HB3,24,2.663,3.660,3.082,0.298 DTR,HD1,29,6.850,7.423,7.077,0.163 DTR,HE1,29,9.316,10.918,10.345,0.395 -DTR,HE3,27,6.702,7.800,7.466,0.203 +DTR,HE3,27,6.702,7.80,7.466,0.203 DTR,HH2,25,6.920,7.44,7.113,0.138 DTR,HN,6,8.240,8.369,8.302,0.044 DTR,HZ2,26,7.15,7.690,7.370,0.129 @@ -7895,13 +7895,13 @@ SEC,HA,10,4.17,5.19,4.664,0.268 SEC,HB2,10,3.230,4.080,3.680,0.322 SEC,HB3,10,3.13,3.590,3.363,0.157 SEP,C,66,169.37636,176.943,173.846,1.022 -SEP,CA,96,55.108,63.701,57.507,1.397 -SEP,CB,96,62.443,72.065,65.645,1.094 -SEP,H,131,7.178,10.049,8.758,0.348 +SEP,CA,97,55.108,63.701,57.497,1.393 +SEP,CB,97,62.443,72.065,65.633,1.094 +SEP,H,132,7.178,10.049,8.758,0.347 SEP,HA,53,4.0670,4.833,4.490,0.157 SEP,HB2,43,3.641,4.84,4.058,0.176 SEP,HB3,40,3.601,4.217,4.010,0.132 -SEP,N,105,113.00,123.345,118.356,1.791 +SEP,N,106,113.00,123.345,118.375,1.793 SET,H,4,8.45,8.6,8.518,0.062 SET,HA,4,4.26,4.415,4.371,0.074 SET,HB2,4,3.83,3.92,3.864,0.039 @@ -8842,8 +8842,8 @@ TYC,H,2,8,8.210,8.105,0.148 TYC,HA,3,4.511,4.61,4.564,0.050 TYC,HB1,3,3.073,3.14,3.101,0.035 TYC,HB2,3,2.82,2.92,2.882,0.054 -TYC,HD1,3,7.13,7.15,7.137,0.012 -TYC,HD2,3,7.130,7.15,7.137,0.012 +TYC,HD1,3,7.130,7.15,7.137,0.012 +TYC,HD2,3,7.13,7.15,7.137,0.012 TYC,HE1,3,6.787,6.85,6.812,0.033 TYC,HE2,3,6.787,6.85,6.812,0.033 TYC,HT21,3,7.159,7.49,7.356,0.174 diff --git a/wwpdb/utils/nmr/bmrb_cs_stat/others.pkl b/wwpdb/utils/nmr/bmrb_cs_stat/others.pkl index bd5e8619..87b4e95d 100644 Binary files a/wwpdb/utils/nmr/bmrb_cs_stat/others.pkl and b/wwpdb/utils/nmr/bmrb_cs_stat/others.pkl differ diff --git a/wwpdb/utils/nmr/mr/AmberMRParserListener.py b/wwpdb/utils/nmr/mr/AmberMRParserListener.py index 03e6aca1..5ba0211b 100644 --- a/wwpdb/utils/nmr/mr/AmberMRParserListener.py +++ b/wwpdb/utils/nmr/mr/AmberMRParserListener.py @@ -6199,7 +6199,6 @@ def updateSanderAtomNumberDict(self, factor, cifCheck=True, useDefault=True, use and authAtomId in self.unambigAtomNameMapping[authCompId]: atomIds = self.unambigAtomNameMapping[authCompId][authAtomId] fixed = True - if not fixed: atomIds = self.__nefT.get_valid_star_atom_in_xplor(compId, authAtomId)[0] diff --git a/wwpdb/utils/nmr/mr/AriaMRParserListener.py b/wwpdb/utils/nmr/mr/AriaMRParserListener.py index d2ef178c..cd338093 100644 --- a/wwpdb/utils/nmr/mr/AriaMRParserListener.py +++ b/wwpdb/utils/nmr/mr/AriaMRParserListener.py @@ -1047,15 +1047,11 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId): """ chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False @@ -1622,15 +1618,11 @@ def assignCoordPolymerSequenceWithChainId(self, refChainId, seqId, compId, atomI _refChainId = refChainId chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False diff --git a/wwpdb/utils/nmr/mr/BiosymMRParserListener.py b/wwpdb/utils/nmr/mr/BiosymMRParserListener.py index 614f6dd3..4819129b 100644 --- a/wwpdb/utils/nmr/mr/BiosymMRParserListener.py +++ b/wwpdb/utils/nmr/mr/BiosymMRParserListener.py @@ -1186,15 +1186,11 @@ def assignCoordPolymerSequence(self, refChainId, seqId, compId, atomId): _refChainId = refChainId chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False diff --git a/wwpdb/utils/nmr/mr/CyanaMRParserListener.py b/wwpdb/utils/nmr/mr/CyanaMRParserListener.py index 6bc7eecc..ef89305b 100644 --- a/wwpdb/utils/nmr/mr/CyanaMRParserListener.py +++ b/wwpdb/utils/nmr/mr/CyanaMRParserListener.py @@ -2454,15 +2454,11 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId, enableWarning=True): """ chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None if self.__hasNonPoly: @@ -3077,15 +3073,11 @@ def assignCoordPolymerSequenceWithChainId(self, refChainId, seqId, compId, atomI _refChainId = refChainId chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None if self.__hasNonPoly: @@ -3765,9 +3757,7 @@ def assignCoordPolymerSequenceWithoutCompId(self, seqId, atomId=None): chainAssign = set() _seqId = seqId - fixedChainId = None - fixedSeqId = None - fixedCompId = None + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False @@ -3980,8 +3970,7 @@ def assignCoordPolymerSequenceWithChainIdWithoutCompId(self, fixedChainId, seqId chainAssign = set() _seqId = seqId - fixedSeqId = None - fixedCompId = None + fixedSeqId = fixedCompId = None self.__allow_ext_seq = False diff --git a/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py b/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py index bce9e7a6..fe754dc8 100644 --- a/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py +++ b/wwpdb/utils/nmr/mr/CyanaNOAParserListener.py @@ -1056,15 +1056,11 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId, enableWarning=True): """ chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None if self.__hasNonPoly: diff --git a/wwpdb/utils/nmr/mr/DynamoMRParserListener.py b/wwpdb/utils/nmr/mr/DynamoMRParserListener.py index 898eb957..f83270e0 100644 --- a/wwpdb/utils/nmr/mr/DynamoMRParserListener.py +++ b/wwpdb/utils/nmr/mr/DynamoMRParserListener.py @@ -1503,16 +1503,12 @@ def assignCoordPolymerSequence(self, refChainId, seqId, compId, atomId, index=No _refChainId = refChainId chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False diff --git a/wwpdb/utils/nmr/mr/IsdMRParserListener.py b/wwpdb/utils/nmr/mr/IsdMRParserListener.py index 5d7bf5d9..daecbf45 100644 --- a/wwpdb/utils/nmr/mr/IsdMRParserListener.py +++ b/wwpdb/utils/nmr/mr/IsdMRParserListener.py @@ -1004,15 +1004,11 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId): """ chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False diff --git a/wwpdb/utils/nmr/mr/ParserListenerUtil.py b/wwpdb/utils/nmr/mr/ParserListenerUtil.py index 17ffa604..e9cc7412 100644 --- a/wwpdb/utils/nmr/mr/ParserListenerUtil.py +++ b/wwpdb/utils/nmr/mr/ParserListenerUtil.py @@ -3650,7 +3650,7 @@ def translateToLigandName(compId: str, refCompId: str, ccU) -> str: def coordAssemblyChecker(verbose: bool = True, log: IO = sys.stdout, representativeModelId: int = REPRESENTATIVE_MODEL_ID, representativeAltId: str = REPRESENTATIVE_ALT_ID, - cR=None, ccU=None, prevResult: dict = None, + cR=None, ccU=None, prevResult: Optional[dict] = None, nmrPolySeq: Optional[list] = None, fullCheck: bool = True) -> dict: """ Check assembly of the coordinates for MR/PT parser listener. """ @@ -7026,7 +7026,8 @@ def contentSubtypeOf(mrSubtype: str) -> str: raise KeyError(f'Internal restraint subtype {mrSubtype!r} is not defined.') -def incListIdCounter(mrSubtype: str, listIdCounter: dict, reduced: bool = True) -> dict: +def incListIdCounter(mrSubtype: str, listIdCounter: dict, reduced: bool = True, + reservedListIds: Optional[dict] = None) -> dict: # for NMR data remediation upgrade to Phase 2 """ Increment list id counter for a given internal restraint subtype (default)/content subtype (reduced=False). """ @@ -7065,10 +7066,17 @@ def incListIdCounter(mrSubtype: str, listIdCounter: dict, reduced: bool = True) listIdCounter[contentSubtype] += 1 + if reservedListIds is not None and contentSubtype in reservedListIds: + while True: + if listIdCounter[contentSubtype] not in reservedListIds[contentSubtype]: + break + listIdCounter[contentSubtype] += 1 + return listIdCounter -def decListIdCounter(mrSubtype: str, listIdCounter: dict, reduced: bool = True) -> dict: +def decListIdCounter(mrSubtype: str, listIdCounter: dict, reduced: bool = True, + reservedListIds: Optional[dict] = None) -> dict: # for NMR data remediation upgrade to Phase 2 """ Decrement list id counter for a given internal restraint subtype (default)/content subtype (reduced=False). """ @@ -7107,6 +7115,12 @@ def decListIdCounter(mrSubtype: str, listIdCounter: dict, reduced: bool = True) listIdCounter[contentSubtype] -= 1 + if reservedListIds is not None and contentSubtype in reservedListIds: + while True: + if listIdCounter[contentSubtype] not in reservedListIds[contentSubtype]: + break + listIdCounter[contentSubtype] -= 1 + return listIdCounter @@ -7147,6 +7161,8 @@ def getSaveframe(mrSubtype: str, sf_framecode: str, sf.add_tag(tag_item_name, re.sub(r'-corrected$', '', fileName)) elif '-ignored-as' in fileName: sf.add_tag(tag_item_name, re.sub(r'-ignored-as.*', '', fileName)) + elif '-selected-as' in fileName: + sf.add_tag(tag_item_name, re.sub(r'-selected-as.*', '', fileName)) else: sf.add_tag(tag_item_name, fileName) elif tag_item_name == 'Constraint_type' and (mrSubtype == 'hbond' diff --git a/wwpdb/utils/nmr/mr/RosettaMRParserListener.py b/wwpdb/utils/nmr/mr/RosettaMRParserListener.py index 468434b2..52ef3e08 100644 --- a/wwpdb/utils/nmr/mr/RosettaMRParserListener.py +++ b/wwpdb/utils/nmr/mr/RosettaMRParserListener.py @@ -1449,8 +1449,7 @@ def assignCoordPolymerSequence(self, seqId, atomId=None, fixedChainId=None): chainAssign = set() _seqId = seqId - fixedSeqId = None - fixedCompId = None + fixedSeqId = fixedCompId = None self.__allow_ext_seq = False diff --git a/wwpdb/utils/nmr/mr/SybylMRParserListener.py b/wwpdb/utils/nmr/mr/SybylMRParserListener.py index 296a3b5c..6efede4a 100644 --- a/wwpdb/utils/nmr/mr/SybylMRParserListener.py +++ b/wwpdb/utils/nmr/mr/SybylMRParserListener.py @@ -1012,15 +1012,11 @@ def assignCoordPolymerSequence(self, seqId, compId, atomId): """ chainAssign = set() - asis = False + asis = preferNonPoly = False _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None - - preferNonPoly = False + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False diff --git a/wwpdb/utils/nmr/pk/AriaPKParserListener.py b/wwpdb/utils/nmr/pk/AriaPKParserListener.py index ca5b3233..d5dc5444 100644 --- a/wwpdb/utils/nmr/pk/AriaPKParserListener.py +++ b/wwpdb/utils/nmr/pk/AriaPKParserListener.py @@ -244,21 +244,11 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- cur_spectral_dim[2]['freq_hint'].append(ppm[1]) has_assignments = False - L1 = L2 = asis1 = asis2 = None + a1 = a2 = asis1 = asis2 = None if ass[0] is not None and ass[1] is not None: - assignments = [{}] * self.num_of_dim - - _a1, _a2 = ass[0][0], ass[1][0] - L1 = f"{_a1['chain_id']} {_a1['seq_id']} {_a1['atom_id']}" if 'chain_id' in _a1 else f"{_a1['seq_id']} {_a1['atom_id']}" - L2 = f"{_a2['chain_id']} {_a2['seq_id']} {_a2['atom_id']}" if 'chain_id' in _a2 else f"{_a2['seq_id']} {_a2['atom_id']}" - - assignment0 = self.extractPeakAssignment(1, L1, index) - if assignment0 is not None: - assignments[0] = assignment0[0] - assignment1 = self.extractPeakAssignment(1, L2, index) - if assignment1 is not None: - assignments[1] = assignment1[0] + a1, a2 = ass[0][0], ass[1][0] + assignments = [a1, a2] if all(len(a) > 0 for a in assignments): @@ -267,9 +257,6 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -292,15 +279,15 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf(self.__spectrum_name) if self.debug: print(f"subtype={self.cur_subtype} id={self.peaks2D} (index={index}) " - f"{L1}, {L2} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} {dstFunc}") + f"{a1}, {a2} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} {dstFunc}") if self.createSfDict__ and sf is not None: sf['id'] = index @@ -351,25 +338,11 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- cur_spectral_dim[3]['freq_hint'].append(ppm[2]) has_assignments = False - L1 = L2 = L3 = asis1 = asis2 = asis3 = None + a1 = a2 = a3 = asis1 = asis2 = asis3 = None if ass[0] is not None and ass[1] is not None and ass[2] is not None: - assignments = [{}] * self.num_of_dim - - _a1, _a2, _a3 = ass[0][0], ass[1][0], ass[2][0] - L1 = f"{_a1['chain_id']} {_a1['seq_id']} {_a1['atom_id']}" if 'chain_id' in _a1 else f"{_a1['seq_id']} {_a1['atom_id']}" - L2 = f"{_a2['chain_id']} {_a2['seq_id']} {_a2['atom_id']}" if 'chain_id' in _a2 else f"{_a2['seq_id']} {_a2['atom_id']}" - L3 = f"{_a3['chain_id']} {_a3['seq_id']} {_a3['atom_id']}" if 'chain_id' in _a3 else f"{_a3['seq_id']} {_a3['atom_id']}" - - assignment0 = self.extractPeakAssignment(1, L1, index) - if assignment0 is not None: - assignments[0] = assignment0[0] - assignment1 = self.extractPeakAssignment(1, L2, index) - if assignment1 is not None: - assignments[1] = assignment1[0] - assignment2 = self.extractPeakAssignment(1, L3, index) - if assignment2 is not None: - assignments[2] = assignment2[0] + a1, a2, a3 = ass[0][0], ass[1][0], ass[2][0] + assignments = [a1, a2, a3] if all(len(a) > 0 for a in assignments): @@ -378,10 +351,6 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -409,16 +378,17 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf(self.__spectrum_name) if self.debug: print(f"subtype={self.cur_subtype} id={self.peaks3D} (index={index}) " - f"{L1}, {L2}, {L3} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " + f"{a1}, {a2}, {a3} -> " + f"{self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " f"{self.atomSelectionSet[2] if has_assignments else None} {dstFunc}") if self.createSfDict__ and sf is not None: @@ -477,29 +447,11 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- cur_spectral_dim[4]['freq_hint'].append(ppm[3]) has_assignments = False - L1 = L2 = L3 = L4 = asis1 = asis2 = asis3 = asis4 = None + a1 = a2 = a3 = a4 = asis1 = asis2 = asis3 = asis4 = None if ass[0] is not None and ass[1] is not None and ass[2] is not None and ass[3] is not None: - assignments = [{}] * self.num_of_dim - - _a1, _a2, _a3, _a4 = ass[0][0], ass[1][0], ass[2][0], ass[3][0] - L1 = f"{_a1['chain_id']} {_a1['seq_id']} {_a1['atom_id']}" if 'chain_id' in _a1 else f"{_a1['seq_id']} {_a1['atom_id']}" - L2 = f"{_a2['chain_id']} {_a2['seq_id']} {_a2['atom_id']}" if 'chain_id' in _a2 else f"{_a2['seq_id']} {_a2['atom_id']}" - L3 = f"{_a3['chain_id']} {_a3['seq_id']} {_a3['atom_id']}" if 'chain_id' in _a3 else f"{_a3['seq_id']} {_a3['atom_id']}" - L4 = f"{_a4['chain_id']} {_a4['seq_id']} {_a4['atom_id']}" if 'chain_id' in _a4 else f"{_a4['seq_id']} {_a4['atom_id']}" - - assignment0 = self.extractPeakAssignment(1, L1, index) - if assignment0 is not None: - assignments[0] = assignment0[0] - assignment1 = self.extractPeakAssignment(1, L2, index) - if assignment1 is not None: - assignments[1] = assignment1[0] - assignment2 = self.extractPeakAssignment(1, L3, index) - if assignment2 is not None: - assignments[2] = assignment2[0] - assignment3 = self.extractPeakAssignment(1, L4, index) - if assignment3 is not None: - assignments[3] = assignment3[0] + a1, a2, a3, a4 = ass[0][0], ass[1][0], ass[2][0], ass[3][0] + assignments = [a1, a2, a3, a4] if all(len(a) > 0 for a in assignments): @@ -508,11 +460,6 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - a4 = assignments[3] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -545,17 +492,18 @@ def exitElement(self, ctx: XMLParser.ElementContext): # pylint: disable=unused- if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(4, a4['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(4, self.atomSelectionSet[3][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf(self.__spectrum_name) if self.debug: print(f"subtype={self.cur_subtype} id={self.peaks4D} (index={index}) " - f"{L1}, {L2}, {L3}, {L4} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " + f"{a1}, {a2}, {a3}, {a4} -> " + f"{self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " f"{self.atomSelectionSet[2] if has_assignments else None} {self.atomSelectionSet[3] if has_assignments else None} {dstFunc}") if self.createSfDict__ and sf is not None: @@ -731,15 +679,15 @@ def enterAttribute(self, ctx: XMLParser.AttributeContext): self.__hetero2_ass['atom_id'] = string # Exit a parse tree produced by XMLParser#attribute. - def exitAttribute(self, ctx: XMLParser.AttributeContext): + def exitAttribute(self, ctx: XMLParser.AttributeContext): # pylint: disable=unused-argument pass # Enter a parse tree produced by XMLParser#chardata. - def enterChardata(self, ctx: XMLParser.ChardataContext): + def enterChardata(self, ctx: XMLParser.ChardataContext): # pylint: disable=unused-argument pass # Exit a parse tree produced by XMLParser#chardata. - def exitChardata(self, ctx: XMLParser.ChardataContext): + def exitChardata(self, ctx: XMLParser.ChardataContext): # pylint: disable=unused-argument pass # Enter a parse tree produced by XMLParser#misc. diff --git a/wwpdb/utils/nmr/pk/AriaPKReader.py b/wwpdb/utils/nmr/pk/AriaPKReader.py index 68ac3a65..34fde5fc 100644 --- a/wwpdb/utils/nmr/pk/AriaPKReader.py +++ b/wwpdb/utils/nmr/pk/AriaPKReader.py @@ -92,7 +92,7 @@ def setParserMaxErrorReport(self, maxErrReport): self.__maxParserErrorReport = maxErrReport def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, - createSfDict=False, originalFileName=None, listIdCounter=None, entryId=None): + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): """ Parse ARIA PK file. @return: AriaPKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. """ @@ -172,6 +172,8 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, listener.setOriginaFileName(originalFileName) if listIdCounter is not None: listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) if entryId is not None: listener.setEntryId(entryId) walker.walk(listener, tree) diff --git a/wwpdb/utils/nmr/pk/BasePKParserListener.py b/wwpdb/utils/nmr/pk/BasePKParserListener.py index df567e5e..3c5e3c8a 100644 --- a/wwpdb/utils/nmr/pk/BasePKParserListener.py +++ b/wwpdb/utils/nmr/pk/BasePKParserListener.py @@ -164,6 +164,7 @@ class BasePKParserListener(): software_name = None debug = False + ass_expr_debug = False createSfDict__ = False @@ -289,6 +290,9 @@ class BasePKParserListener(): # list id counter __listIdCounter = {} + # reserved list ids for NMR data remediation Phase 2 + __reservedListIds = {} + listIdInternal = {} # entry ID @@ -421,6 +425,9 @@ def setOriginaFileName(self, originalFileName: str): def setListIdCounter(self, listIdCounter: dict): self.__listIdCounter = listIdCounter + def setReservedListIds(self, reservedListIds: dict): + self.__reservedListIds = reservedListIds + def setEntryId(self, entryId: str): self.entryId = entryId @@ -770,8 +777,17 @@ def initSpectralDim(self): def fillAtomTypeInCase(self, _dim_id: int, atom_type: str) -> bool: cur_spectral_dim = self.spectral_dim[self.num_of_dim][self.cur_list_id][_dim_id] if cur_spectral_dim['atom_type'] is not None: - return cur_spectral_dim['atom_type'] == atom_type + if cur_spectral_dim['atom_type'] == atom_type: + return True + if 'reset' in cur_spectral_dim: # XEASY INNAME label is not reliable (2kj5) + return False + if atom_type in ISOTOPE_NUMBERS_OF_NMR_OBS_NUCS: + cur_spectral_dim['reset'] = True + cur_spectral_dim['atom_type'] = None + cur_spectral_dim['axis_code'] = None + cur_spectral_dim['atom_isotope_number'] = None if atom_type in ISOTOPE_NUMBERS_OF_NMR_OBS_NUCS: + cur_spectral_dim['axis_code'] = atom_type cur_spectral_dim['atom_type'] = atom_type cur_spectral_dim['atom_isotope_number'] = ISOTOPE_NUMBERS_OF_NMR_OBS_NUCS[atom_type][0] return True @@ -983,7 +999,7 @@ def fillPkAuxLoops(self, spectrum_names: Optional[dict]): cur_spectral_dim_transfer.append(transfer) # jcoupling: 'Transfer via direct J coupling over one or more bonds' - if 'copy' in file_name or 'copy' in alt_file_name: + if 'cosy' in file_name or 'cosy' in alt_file_name: if d == 2: for _dim_id1, _dict1 in cur_spectral_dim.items(): _iso_num1 = _dict1['atom_isotope_number'] @@ -1133,8 +1149,8 @@ def fillPkAuxLoops(self, spectrum_names: Optional[dict]): # relayed-alternate: 'Relayed transfer where peaks from an odd resp. even number of transfer steps have opposite sign' # through-space: 'Any transfer that does not go through the covalent bonded skeleton - if 'noe' in file_name or 'roe' in file_name or 'rfdr' in file_name\ - or 'noe' in alt_file_name or 'roe' in alt_file_name or 'rfdr' in alt_file_name: + if 'noe' in file_name or 'roe' in file_name\ + or 'noe' in alt_file_name or 'roe' in alt_file_name: for _dim_id1, _dict1 in cur_spectral_dim.items(): _region1 = _dict1['spectral_region'] if _region1 in ('HN', 'H-aliphatic', 'H-aromatic', 'H-methyl') and d > 2: @@ -1149,18 +1165,34 @@ def fillPkAuxLoops(self, spectrum_names: Optional[dict]): cur_spectral_dim_transfer.append(transfer) if self.exptlMethod == 'SOLID-STATE NMR': - for _dim_id1, _dict1 in cur_spectral_dim.items(): - _iso_num1 = _dict1['atom_isotope_number'] - if _iso_num1 in (1, 13): - for _dim_id2, _dict2 in cur_spectral_dim.items(): - if _dim_id1 == _dim_id2 or _iso_num1 != _dict2['atom_isotope_number']: - continue - if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): - transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), - 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), - 'type': 'through-space', - 'indirect': 'yes'} - cur_spectral_dim_transfer.append(transfer) + if 'rfdr' in file_name or 'rfdr' in alt_file_name: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 in (1, 13): + for _dim_id2, _dict2 in cur_spectral_dim.items(): + if _dim_id1 == _dim_id2 or _iso_num1 != _dict2['atom_isotope_number']: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + + elif 'redor' in file_name or 'redor' in alt_file_name: + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 in (13, 15, 19, 31): + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _iso_num2 = _dict2['atom_isotope_number'] + if _dim_id1 == _dim_id2 or _iso_num2 not in (13, 15, 19, 31) or _iso_num1 == _iso_num2: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) for _dim_id1, _dict1 in cur_spectral_dim.items(): _region1 = _dict1['spectral_region'] @@ -1192,10 +1224,10 @@ def fillPkAuxLoops(self, spectrum_names: Optional[dict]): 'indirect': 'yes'} cur_spectral_dim_transfer.append(transfer) - if self.exptlMethod == 'SOLID-STATE NMR': + if self.exptlMethod == 'SOLID-STATE NMR' and d == 2: for _dim_id1, _dict1 in cur_spectral_dim.items(): _region1 = _dict1['spectral_region'] - if _region1 == 'C' and d == 2: # all + if _region1 == 'C': # all for _dim_id2, _dict2 in cur_spectral_dim.items(): if _dim_id1 == _dim_id2 or _dict1['spectral_region'] != _region1: continue @@ -1208,6 +1240,20 @@ def fillPkAuxLoops(self, spectrum_names: Optional[dict]): 'indirect': 'yes'} cur_spectral_dim_transfer.append(transfer) + for _dim_id1, _dict1 in cur_spectral_dim.items(): + _iso_num1 = _dict1['atom_isotope_number'] + if _iso_num1 in (13, 15, 19, 31): + for _dim_id2, _dict2 in cur_spectral_dim.items(): + _iso_num2 = _dict2['atom_isotope_number'] + if _dim_id1 == _dim_id2 or _iso_num2 not in (13, 15, 19, 31) or _iso_num1 == _iso_num2: + continue + if 'yes' in (_dict1['acquisition'], _dict2['acquisition']): + transfer = {'spectral_dim_id_1': min([_dim_id1, _dim_id2]), + 'spectral_dim_id_2': max([_dim_id1, _dim_id2]), + 'type': 'through-space', # optimistic inferencing? + 'indirect': 'yes'} + cur_spectral_dim_transfer.append(transfer) + for __v in cur_spectral_dim.values(): if 'freq_hint' in __v: del __v['freq_hint'] @@ -1376,14 +1422,14 @@ def validatePeak2D(self, index: int, pos_1: float, pos_2: float, "Neither height nor volume value is set.") return None - if pos_unc_1 is not None: + if pos_unc_1 is not None and pos_unc_1 != 0.0: dstFunc['position_uncertainty_1'] = str(pos_unc_1) - if pos_unc_2 is not None: + if pos_unc_2 is not None and pos_unc_2 != 0.0: dstFunc['position_uncertainty_2'] = str(pos_unc_2) - if lw_1 is not None: + if lw_1 is not None and lw_1 != 0.0: dstFunc['line_width_1'] = str(lw_1) - if lw_2 is not None: + if lw_2 is not None and lw_2 != 0.0: dstFunc['line_width_2'] = str(lw_2) if (lw_1 is None and lw_hz_1 is not None) or (lw_2 is None and lw_hz_2 is not None): @@ -1474,18 +1520,18 @@ def validatePeak3D(self, index: int, pos_1: float, pos_2: float, pos_3: float, "Neither height nor volume value is set.") return None - if pos_unc_1 is not None: + if pos_unc_1 is not None and pos_unc_1 != 0.0: dstFunc['position_uncertainty_1'] = str(pos_unc_1) - if pos_unc_2 is not None: + if pos_unc_2 is not None and pos_unc_2 != 0.0: dstFunc['position_uncertainty_2'] = str(pos_unc_2) - if pos_unc_3 is not None: + if pos_unc_3 is not None and pos_unc_3 != 0.0: dstFunc['position_uncertainty_3'] = str(pos_unc_3) - if lw_1 is not None: + if lw_1 is not None and lw_1 != 0.0: dstFunc['line_width_1'] = str(lw_1) - if lw_2 is not None: + if lw_2 is not None and lw_2 != 0.0: dstFunc['line_width_2'] = str(lw_2) - if lw_3 is not None: + if lw_3 is not None and lw_3 != 0.0: dstFunc['line_width_3'] = str(lw_3) if (lw_1 is None and lw_hz_1 is not None) or (lw_2 is None and lw_hz_2 is not None)\ @@ -1601,22 +1647,22 @@ def validatePeak4D(self, index: int, pos_1: float, pos_2: float, pos_3: float, p "Neither height nor volume value is set.") return None - if pos_unc_1 is not None: + if pos_unc_1 is not None and pos_unc_1 != 0.0: dstFunc['position_uncertainty_1'] = str(pos_unc_1) - if pos_unc_2 is not None: + if pos_unc_2 is not None and pos_unc_2 != 0.0: dstFunc['position_uncertainty_2'] = str(pos_unc_2) - if pos_unc_3 is not None: + if pos_unc_3 is not None and pos_unc_3 != 0.0: dstFunc['position_uncertainty_3'] = str(pos_unc_3) - if pos_unc_4 is not None: + if pos_unc_4 is not None and pos_unc_4 != 0.0: dstFunc['position_uncertainty_4'] = str(pos_unc_4) - if lw_1 is not None: + if lw_1 is not None and lw_1 != 0.0: dstFunc['line_width_1'] = str(lw_1) - if lw_2 is not None: + if lw_2 is not None and lw_2 != 0.0: dstFunc['line_width_2'] = str(lw_2) - if lw_3 is not None: + if lw_3 is not None and lw_3 != 0.0: dstFunc['line_width_3'] = str(lw_3) - if lw_4 is not None: + if lw_4 is not None and lw_4 != 0.0: dstFunc['line_width_4'] = str(lw_4) if (lw_1 is None and lw_hz_1 is not None) or (lw_2 is None and lw_hz_2 is not None)\ @@ -1820,6 +1866,10 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int) -> O if ___atomNameLike[idx]: break + if self.ass_expr_debug: + print(f'{idx} {term!r} segid:{segIdLike[idx]}, resid:{resIdLike[idx]}, resname:{resNameLike[idx]}, ' + f'atomname:{atomNameLike[idx]}, _atomname:{_atomNameLike[idx]}, __atomname:{__atomNameLike[idx]}, ___atomname:{___atomNameLike[idx]}') + atomNameCount = 0 for idx in range(lenStr): if atomNameLike[idx]: @@ -1905,6 +1955,10 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int) -> O else: resNameLike[idx] = False + if self.ass_expr_debug: + print(f' -> {idx} segid:{segIdLike[idx]}, resid:{resIdLike[idx]}, resname:{resNameLike[idx]}, ' + f'atomname:{atomNameLike[idx]}, _atomname:{_atomNameLike[idx]}, __atomname:{__atomNameLike[idx]}, ___atomname:{___atomNameLike[idx]}') + resIdCount = 0 for idx in range(lenStr): if resIdLike[idx]: @@ -1913,10 +1967,30 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int) -> O if resIdCount == 0: return None + resIdLater = resIdCount == numOfDim + if resIdLater: + atomNameCount = 0 + for idx in range(lenStr): + if atomNameLike[idx]: + atomNameCount += 1 + resIdLater = atomNameCount == numOfDim + if resIdLater: + anyResId = False + for idx in range(lenStr): + if resIdLike[idx]: + anyResId = True + if atomNameLike[idx]: + if anyResId: + resIdLater = False + break + + if self.ass_expr_debug: + print(f'num_of_dim: {numOfDim}, resid_count: {resIdCount}, resid_later:{resIdLater}') + ret = [] segId = resId = resName = atomName = None - dimId = 0 + dimId = 1 for idx, term in enumerate(_str): if segIdLike[idx]: segId = term[segIdSpan[idx][0]:segIdSpan[idx][1]] @@ -1927,6 +2001,12 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int) -> O if len(resName) == 1 and aaOnly: resName = next(k for k, v in monDict3.items() if v == resName) if ___atomNameLike[idx]: + if resIdLater: + for _idx, _term in enumerate(_str): + if _idx > idx and resIdLike[_idx]: + resId = int(_term[resIdSpan[_idx][0]:resIdSpan[_idx][1]]) + segId = resName = None + break if resId is None: return None atomName = term[___atomNameSpan[idx][0]:___atomNameSpan[idx][1]] @@ -1955,6 +2035,12 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int) -> O ret.append(ass) dimId += 1 if __atomNameLike[idx]: + if resIdLater: + for _idx, _term in enumerate(_str): + if _idx > idx and resIdLike[_idx]: + resId = int(_term[resIdSpan[_idx][0]:resIdSpan[_idx][1]]) + segId = resName = None + break if resId is None: return None atomName = term[__atomNameSpan[idx][0]:__atomNameSpan[idx][1]] @@ -1983,6 +2069,12 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int) -> O ret.append(ass) dimId += 1 if _atomNameLike[idx]: + if resIdLater: + for _idx, _term in enumerate(_str): + if _idx > idx and resIdLike[_idx]: + resId = int(_term[resIdSpan[_idx][0]:resIdSpan[_idx][1]]) + segId = resName = None + break if resId is None: return None atomName = term[_atomNameSpan[idx][0]:_atomNameSpan[idx][1]] @@ -2011,6 +2103,12 @@ def extractPeakAssignment(self, numOfDim: int, string: str, src_index: int) -> O ret.append(ass) dimId += 1 if atomNameLike[idx]: + if resIdLater: + for _idx, _term in enumerate(_str): + if _idx > idx and resIdLike[_idx]: + resId = int(_term[resIdSpan[_idx][0]:resIdSpan[_idx][1]]) + segId = resName = None + break if resId is None: return None atomName = term[atomNameSpan[idx][0]:atomNameSpan[idx][1]] @@ -2107,9 +2205,7 @@ def assignCoordPolymerSequence(self, refChainId: str, seqId: int, compId: str, a _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None + fixedChainId = fixedSeqId = fixedCompId = None preferNonPoly = False @@ -2762,9 +2858,7 @@ def assignCoordPolymerSequenceWithChainId(self, refChainId: str, seqId: int, com _seqId = seqId _compId = compId - fixedChainId = None - fixedSeqId = None - fixedCompId = None + fixedChainId = fixedSeqId = fixedCompId = None preferNonPoly = False @@ -3418,9 +3512,7 @@ def assignCoordPolymerSequenceWithoutCompId(self, seqId: int, atomId: str, index chainAssign = set() _seqId = seqId - fixedChainId = None - fixedSeqId = None - fixedCompId = None + fixedChainId = fixedSeqId = fixedCompId = None self.__allow_ext_seq = False @@ -3631,8 +3723,7 @@ def assignCoordPolymerSequenceWithChainIdWithoutCompId(self, fixedChainId: str, chainAssign = set() _seqId = seqId - fixedSeqId = None - fixedCompId = None + fixedSeqId = fixedCompId = None self.__allow_ext_seq = False @@ -4380,13 +4471,13 @@ def __addSf(self, spectrumName: Optional[str] = None): if content_subtype is None: return - self.__listIdCounter = incListIdCounter(self.cur_subtype, self.__listIdCounter) + self.__listIdCounter = incListIdCounter(self.cur_subtype, self.__listIdCounter, reservedListIds=self.__reservedListIds) key = (self.cur_subtype, self.cur_list_id) if key in self.sfDict: if len(self.sfDict[key]) > 0: - decListIdCounter(self.cur_subtype, self.__listIdCounter) + decListIdCounter(self.cur_subtype, self.__listIdCounter, reservedListIds=self.__reservedListIds) return else: self.sfDict[key] = [] @@ -4456,7 +4547,7 @@ def getSfDict(self) -> Tuple[dict, Optional[dict]]: v.remove(item) if len(v) == 0: ign_keys.append(k) - self.__listIdCounter = decListIdCounter(k[0], self.__listIdCounter) + self.__listIdCounter = decListIdCounter(k[0], self.__listIdCounter, reservedListIds=self.__reservedListIds) for k in ign_keys: del self.sfDict[k] return self.__listIdCounter, None if len(self.sfDict) == 0 else self.sfDict diff --git a/wwpdb/utils/nmr/pk/NmrPipePKLexer.py b/wwpdb/utils/nmr/pk/NmrPipePKLexer.py index 37c382a2..8eabbef8 100644 --- a/wwpdb/utils/nmr/pk/NmrPipePKLexer.py +++ b/wwpdb/utils/nmr/pk/NmrPipePKLexer.py @@ -109,63 +109,63 @@ def serializedATN(): 166,73,168,74,170,75,172,76,174,77,176,78,178,79,180,80,182,81,184, 82,186,83,188,84,190,85,192,86,194,87,196,88,6,0,1,2,3,4,5,11,2, 0,43,43,45,45,2,0,69,69,101,101,1,0,48,57,2,0,10,10,13,13,3,0,9, - 10,13,13,32,32,2,0,65,90,97,122,5,0,35,35,42,43,45,46,63,63,95,95, - 2,0,34,34,39,39,2,0,9,9,32,32,5,0,33,33,35,35,38,38,59,59,92,92, - 2,0,100,100,115,115,1122,0,6,1,0,0,0,0,8,1,0,0,0,0,10,1,0,0,0,0, - 12,1,0,0,0,0,14,1,0,0,0,0,16,1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,0,0, - 28,1,0,0,0,0,30,1,0,0,0,0,32,1,0,0,0,0,34,1,0,0,0,0,46,1,0,0,0,0, - 48,1,0,0,0,0,50,1,0,0,0,0,52,1,0,0,0,0,54,1,0,0,0,1,56,1,0,0,0,1, - 58,1,0,0,0,1,60,1,0,0,0,1,62,1,0,0,0,1,64,1,0,0,0,1,66,1,0,0,0,1, - 68,1,0,0,0,1,70,1,0,0,0,1,72,1,0,0,0,1,74,1,0,0,0,1,76,1,0,0,0,1, - 78,1,0,0,0,2,80,1,0,0,0,2,82,1,0,0,0,2,84,1,0,0,0,2,86,1,0,0,0,2, - 88,1,0,0,0,2,90,1,0,0,0,2,92,1,0,0,0,2,94,1,0,0,0,2,96,1,0,0,0,2, - 98,1,0,0,0,2,100,1,0,0,0,2,102,1,0,0,0,2,104,1,0,0,0,2,106,1,0,0, - 0,2,108,1,0,0,0,2,110,1,0,0,0,2,112,1,0,0,0,2,114,1,0,0,0,2,116, - 1,0,0,0,2,118,1,0,0,0,2,120,1,0,0,0,2,122,1,0,0,0,2,124,1,0,0,0, - 2,126,1,0,0,0,2,128,1,0,0,0,2,130,1,0,0,0,2,132,1,0,0,0,2,134,1, - 0,0,0,2,136,1,0,0,0,2,138,1,0,0,0,2,140,1,0,0,0,2,142,1,0,0,0,2, - 144,1,0,0,0,2,146,1,0,0,0,2,148,1,0,0,0,2,150,1,0,0,0,2,152,1,0, - 0,0,2,154,1,0,0,0,2,156,1,0,0,0,2,158,1,0,0,0,2,160,1,0,0,0,2,162, - 1,0,0,0,2,164,1,0,0,0,2,166,1,0,0,0,2,168,1,0,0,0,2,170,1,0,0,0, - 2,172,1,0,0,0,2,174,1,0,0,0,2,176,1,0,0,0,3,178,1,0,0,0,3,180,1, - 0,0,0,3,182,1,0,0,0,3,184,1,0,0,0,4,186,1,0,0,0,4,188,1,0,0,0,4, - 190,1,0,0,0,5,192,1,0,0,0,5,194,1,0,0,0,5,196,1,0,0,0,6,198,1,0, - 0,0,8,205,1,0,0,0,10,212,1,0,0,0,12,221,1,0,0,0,14,233,1,0,0,0,16, - 247,1,0,0,0,18,252,1,0,0,0,20,259,1,0,0,0,22,278,1,0,0,0,24,280, - 1,0,0,0,26,283,1,0,0,0,28,288,1,0,0,0,30,313,1,0,0,0,32,338,1,0, - 0,0,34,363,1,0,0,0,36,367,1,0,0,0,38,371,1,0,0,0,40,375,1,0,0,0, - 42,379,1,0,0,0,44,381,1,0,0,0,46,389,1,0,0,0,48,396,1,0,0,0,50,400, - 1,0,0,0,52,437,1,0,0,0,54,474,1,0,0,0,56,486,1,0,0,0,58,493,1,0, - 0,0,60,500,1,0,0,0,62,507,1,0,0,0,64,514,1,0,0,0,66,520,1,0,0,0, - 68,525,1,0,0,0,70,532,1,0,0,0,72,545,1,0,0,0,74,548,1,0,0,0,76,555, - 1,0,0,0,78,598,1,0,0,0,80,610,1,0,0,0,82,616,1,0,0,0,84,623,1,0, - 0,0,86,630,1,0,0,0,88,637,1,0,0,0,90,644,1,0,0,0,92,647,1,0,0,0, - 94,650,1,0,0,0,96,653,1,0,0,0,98,656,1,0,0,0,100,662,1,0,0,0,102, - 668,1,0,0,0,104,674,1,0,0,0,106,680,1,0,0,0,108,685,1,0,0,0,110, - 690,1,0,0,0,112,695,1,0,0,0,114,700,1,0,0,0,116,703,1,0,0,0,118, - 706,1,0,0,0,120,709,1,0,0,0,122,712,1,0,0,0,124,718,1,0,0,0,126, - 724,1,0,0,0,128,730,1,0,0,0,130,736,1,0,0,0,132,739,1,0,0,0,134, - 742,1,0,0,0,136,745,1,0,0,0,138,748,1,0,0,0,140,751,1,0,0,0,142, - 754,1,0,0,0,144,757,1,0,0,0,146,760,1,0,0,0,148,767,1,0,0,0,150, - 775,1,0,0,0,152,779,1,0,0,0,154,785,1,0,0,0,156,790,1,0,0,0,158, - 794,1,0,0,0,160,802,1,0,0,0,162,809,1,0,0,0,164,818,1,0,0,0,166, - 823,1,0,0,0,168,830,1,0,0,0,170,843,1,0,0,0,172,846,1,0,0,0,174, - 853,1,0,0,0,176,896,1,0,0,0,178,908,1,0,0,0,180,924,1,0,0,0,182, - 931,1,0,0,0,184,974,1,0,0,0,186,987,1,0,0,0,188,992,1,0,0,0,190, - 999,1,0,0,0,192,1006,1,0,0,0,194,1011,1,0,0,0,196,1018,1,0,0,0,198, - 199,5,68,0,0,199,200,5,65,0,0,200,201,5,84,0,0,201,202,5,65,0,0, - 202,203,1,0,0,0,203,204,6,0,0,0,204,7,1,0,0,0,205,206,5,86,0,0,206, - 207,5,65,0,0,207,208,5,82,0,0,208,209,5,83,0,0,209,210,1,0,0,0,210, - 211,6,1,1,0,211,9,1,0,0,0,212,213,5,70,0,0,213,214,5,79,0,0,214, - 215,5,82,0,0,215,216,5,77,0,0,216,217,5,65,0,0,217,218,5,84,0,0, - 218,219,1,0,0,0,219,220,6,2,2,0,220,11,1,0,0,0,221,222,5,78,0,0, - 222,223,5,85,0,0,223,224,5,76,0,0,224,225,5,76,0,0,225,226,5,86, - 0,0,226,227,5,65,0,0,227,228,5,76,0,0,228,229,5,85,0,0,229,230,5, - 69,0,0,230,231,1,0,0,0,231,232,6,3,3,0,232,13,1,0,0,0,233,234,5, - 78,0,0,234,235,5,85,0,0,235,236,5,76,0,0,236,237,5,76,0,0,237,238, - 5,83,0,0,238,239,5,84,0,0,239,240,5,82,0,0,240,241,5,73,0,0,241, - 242,5,78,0,0,242,243,5,71,0,0,243,244,1,0,0,0,244,245,6,4,4,0,245, - 15,1,0,0,0,246,248,7,0,0,0,247,246,1,0,0,0,247,248,1,0,0,0,248,249, + 10,13,13,32,32,2,0,65,90,97,122,4,0,42,43,45,46,63,63,95,95,2,0, + 34,34,39,39,2,0,9,9,32,32,5,0,33,33,35,35,38,38,59,59,92,92,2,0, + 100,100,115,115,1122,0,6,1,0,0,0,0,8,1,0,0,0,0,10,1,0,0,0,0,12,1, + 0,0,0,0,14,1,0,0,0,0,16,1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,0,0,28,1, + 0,0,0,0,30,1,0,0,0,0,32,1,0,0,0,0,34,1,0,0,0,0,46,1,0,0,0,0,48,1, + 0,0,0,0,50,1,0,0,0,0,52,1,0,0,0,0,54,1,0,0,0,1,56,1,0,0,0,1,58,1, + 0,0,0,1,60,1,0,0,0,1,62,1,0,0,0,1,64,1,0,0,0,1,66,1,0,0,0,1,68,1, + 0,0,0,1,70,1,0,0,0,1,72,1,0,0,0,1,74,1,0,0,0,1,76,1,0,0,0,1,78,1, + 0,0,0,2,80,1,0,0,0,2,82,1,0,0,0,2,84,1,0,0,0,2,86,1,0,0,0,2,88,1, + 0,0,0,2,90,1,0,0,0,2,92,1,0,0,0,2,94,1,0,0,0,2,96,1,0,0,0,2,98,1, + 0,0,0,2,100,1,0,0,0,2,102,1,0,0,0,2,104,1,0,0,0,2,106,1,0,0,0,2, + 108,1,0,0,0,2,110,1,0,0,0,2,112,1,0,0,0,2,114,1,0,0,0,2,116,1,0, + 0,0,2,118,1,0,0,0,2,120,1,0,0,0,2,122,1,0,0,0,2,124,1,0,0,0,2,126, + 1,0,0,0,2,128,1,0,0,0,2,130,1,0,0,0,2,132,1,0,0,0,2,134,1,0,0,0, + 2,136,1,0,0,0,2,138,1,0,0,0,2,140,1,0,0,0,2,142,1,0,0,0,2,144,1, + 0,0,0,2,146,1,0,0,0,2,148,1,0,0,0,2,150,1,0,0,0,2,152,1,0,0,0,2, + 154,1,0,0,0,2,156,1,0,0,0,2,158,1,0,0,0,2,160,1,0,0,0,2,162,1,0, + 0,0,2,164,1,0,0,0,2,166,1,0,0,0,2,168,1,0,0,0,2,170,1,0,0,0,2,172, + 1,0,0,0,2,174,1,0,0,0,2,176,1,0,0,0,3,178,1,0,0,0,3,180,1,0,0,0, + 3,182,1,0,0,0,3,184,1,0,0,0,4,186,1,0,0,0,4,188,1,0,0,0,4,190,1, + 0,0,0,5,192,1,0,0,0,5,194,1,0,0,0,5,196,1,0,0,0,6,198,1,0,0,0,8, + 205,1,0,0,0,10,212,1,0,0,0,12,221,1,0,0,0,14,233,1,0,0,0,16,247, + 1,0,0,0,18,252,1,0,0,0,20,259,1,0,0,0,22,278,1,0,0,0,24,280,1,0, + 0,0,26,283,1,0,0,0,28,288,1,0,0,0,30,313,1,0,0,0,32,338,1,0,0,0, + 34,363,1,0,0,0,36,367,1,0,0,0,38,371,1,0,0,0,40,375,1,0,0,0,42,379, + 1,0,0,0,44,381,1,0,0,0,46,389,1,0,0,0,48,396,1,0,0,0,50,400,1,0, + 0,0,52,437,1,0,0,0,54,474,1,0,0,0,56,486,1,0,0,0,58,493,1,0,0,0, + 60,500,1,0,0,0,62,507,1,0,0,0,64,514,1,0,0,0,66,520,1,0,0,0,68,525, + 1,0,0,0,70,532,1,0,0,0,72,545,1,0,0,0,74,548,1,0,0,0,76,555,1,0, + 0,0,78,598,1,0,0,0,80,610,1,0,0,0,82,616,1,0,0,0,84,623,1,0,0,0, + 86,630,1,0,0,0,88,637,1,0,0,0,90,644,1,0,0,0,92,647,1,0,0,0,94,650, + 1,0,0,0,96,653,1,0,0,0,98,656,1,0,0,0,100,662,1,0,0,0,102,668,1, + 0,0,0,104,674,1,0,0,0,106,680,1,0,0,0,108,685,1,0,0,0,110,690,1, + 0,0,0,112,695,1,0,0,0,114,700,1,0,0,0,116,703,1,0,0,0,118,706,1, + 0,0,0,120,709,1,0,0,0,122,712,1,0,0,0,124,718,1,0,0,0,126,724,1, + 0,0,0,128,730,1,0,0,0,130,736,1,0,0,0,132,739,1,0,0,0,134,742,1, + 0,0,0,136,745,1,0,0,0,138,748,1,0,0,0,140,751,1,0,0,0,142,754,1, + 0,0,0,144,757,1,0,0,0,146,760,1,0,0,0,148,767,1,0,0,0,150,775,1, + 0,0,0,152,779,1,0,0,0,154,785,1,0,0,0,156,790,1,0,0,0,158,794,1, + 0,0,0,160,802,1,0,0,0,162,809,1,0,0,0,164,818,1,0,0,0,166,823,1, + 0,0,0,168,830,1,0,0,0,170,843,1,0,0,0,172,846,1,0,0,0,174,853,1, + 0,0,0,176,896,1,0,0,0,178,908,1,0,0,0,180,924,1,0,0,0,182,931,1, + 0,0,0,184,974,1,0,0,0,186,987,1,0,0,0,188,992,1,0,0,0,190,999,1, + 0,0,0,192,1006,1,0,0,0,194,1011,1,0,0,0,196,1018,1,0,0,0,198,199, + 5,68,0,0,199,200,5,65,0,0,200,201,5,84,0,0,201,202,5,65,0,0,202, + 203,1,0,0,0,203,204,6,0,0,0,204,7,1,0,0,0,205,206,5,86,0,0,206,207, + 5,65,0,0,207,208,5,82,0,0,208,209,5,83,0,0,209,210,1,0,0,0,210,211, + 6,1,1,0,211,9,1,0,0,0,212,213,5,70,0,0,213,214,5,79,0,0,214,215, + 5,82,0,0,215,216,5,77,0,0,216,217,5,65,0,0,217,218,5,84,0,0,218, + 219,1,0,0,0,219,220,6,2,2,0,220,11,1,0,0,0,221,222,5,78,0,0,222, + 223,5,85,0,0,223,224,5,76,0,0,224,225,5,76,0,0,225,226,5,86,0,0, + 226,227,5,65,0,0,227,228,5,76,0,0,228,229,5,85,0,0,229,230,5,69, + 0,0,230,231,1,0,0,0,231,232,6,3,3,0,232,13,1,0,0,0,233,234,5,78, + 0,0,234,235,5,85,0,0,235,236,5,76,0,0,236,237,5,76,0,0,237,238,5, + 83,0,0,238,239,5,84,0,0,239,240,5,82,0,0,240,241,5,73,0,0,241,242, + 5,78,0,0,242,243,5,71,0,0,243,244,1,0,0,0,244,245,6,4,4,0,245,15, + 1,0,0,0,246,248,7,0,0,0,247,246,1,0,0,0,247,248,1,0,0,0,248,249, 1,0,0,0,249,250,3,26,10,0,250,17,1,0,0,0,251,253,7,0,0,0,252,251, 1,0,0,0,252,253,1,0,0,0,253,256,1,0,0,0,254,257,3,26,10,0,255,257, 3,22,8,0,256,254,1,0,0,0,256,255,1,0,0,0,257,19,1,0,0,0,258,260, diff --git a/wwpdb/utils/nmr/pk/NmrPipePKParser.py b/wwpdb/utils/nmr/pk/NmrPipePKParser.py index ccbfc97c..ce5896b2 100644 --- a/wwpdb/utils/nmr/pk/NmrPipePKParser.py +++ b/wwpdb/utils/nmr/pk/NmrPipePKParser.py @@ -10,156 +10,157 @@ def serializedATN(): return [ - 4,1,88,446,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, - 6,2,7,7,7,2,8,7,8,1,0,1,0,1,0,1,0,5,0,23,8,0,10,0,12,0,26,9,0,1, - 0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1, - 2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1, - 2,1,2,1,2,3,2,63,8,2,1,2,1,2,1,2,3,2,68,8,2,1,2,1,2,1,2,1,2,1,2, + 4,1,88,449,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,2,8,7,8,1,0,3,0,20,8,0,1,0,1,0,1,0,1,0,5,0,26,8,0,10,0, + 12,0,29,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2, 1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2, - 1,2,1,2,1,2,1,2,3,2,95,8,2,1,2,1,2,1,2,3,2,100,8,2,1,2,1,2,1,2,1, - 2,3,2,106,8,2,1,2,1,2,1,2,3,2,111,8,2,1,2,4,2,114,8,2,11,2,12,2, - 115,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, - 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,141,8,3,1,3,1,3,1,3,3,3,146, - 8,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, - 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, - 1,4,1,4,1,4,3,4,182,8,4,1,4,1,4,1,4,3,4,187,8,4,1,4,1,4,1,4,1,4, - 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, - 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,3,4,222,8,4, - 1,4,1,4,1,4,3,4,227,8,4,1,4,1,4,1,4,1,4,3,4,233,8,4,1,4,1,4,1,4, - 3,4,238,8,4,1,4,4,4,241,8,4,11,4,12,4,242,1,5,1,5,1,5,1,5,1,5,1, - 5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1, - 5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,276,8,5,1,5,1,5,1,5,3, - 5,281,8,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1, - 6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1, - 6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,3,6,325,8,6,1, - 6,1,6,1,6,3,6,330,8,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1, - 6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1, - 6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,3,6,373, - 8,6,1,6,1,6,1,6,3,6,378,8,6,1,6,1,6,1,6,1,6,3,6,384,8,6,1,6,1,6, - 1,6,3,6,389,8,6,1,6,4,6,392,8,6,11,6,12,6,393,1,7,1,7,1,7,1,7,1, + 1,2,1,2,1,2,1,2,1,2,1,2,3,2,66,8,2,1,2,1,2,1,2,3,2,71,8,2,1,2,1, + 2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1, + 2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,98,8,2,1,2,1,2,1,2,3,2,103,8,2, + 1,2,1,2,1,2,1,2,3,2,109,8,2,1,2,1,2,1,2,3,2,114,8,2,1,2,4,2,117, + 8,2,11,2,12,2,118,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1, + 3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,144,8,3,1,3,1, + 3,1,3,3,3,149,8,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1, + 4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1, + 4,1,4,1,4,1,4,1,4,1,4,1,4,3,4,185,8,4,1,4,1,4,1,4,3,4,190,8,4,1, + 4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1, + 4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1, + 4,3,4,225,8,4,1,4,1,4,1,4,3,4,230,8,4,1,4,1,4,1,4,1,4,3,4,236,8, + 4,1,4,1,4,1,4,3,4,241,8,4,1,4,4,4,244,8,4,11,4,12,4,245,1,5,1,5, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,279,8,5, + 1,5,1,5,1,5,3,5,284,8,5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6, + 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6, + 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6, + 3,6,328,8,6,1,6,1,6,1,6,3,6,333,8,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6, + 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6, + 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6, + 1,6,1,6,3,6,376,8,6,1,6,1,6,1,6,3,6,381,8,6,1,6,1,6,1,6,1,6,3,6, + 387,8,6,1,6,1,6,1,6,3,6,392,8,6,1,6,4,6,395,8,6,11,6,12,6,396,1, 7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, 7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, - 7,1,7,1,7,3,7,435,8,7,1,7,1,7,1,7,3,7,440,8,7,1,7,1,7,1,8,1,8,1, - 8,0,0,9,0,2,4,6,8,10,12,14,16,0,2,1,0,18,21,2,0,7,8,12,12,467,0, - 24,1,0,0,0,2,29,1,0,0,0,4,38,1,0,0,0,6,117,1,0,0,0,8,149,1,0,0,0, - 10,244,1,0,0,0,12,284,1,0,0,0,14,395,1,0,0,0,16,443,1,0,0,0,18,23, - 3,2,1,0,19,23,3,4,2,0,20,23,3,8,4,0,21,23,3,12,6,0,22,18,1,0,0,0, - 22,19,1,0,0,0,22,20,1,0,0,0,22,21,1,0,0,0,23,26,1,0,0,0,24,22,1, - 0,0,0,24,25,1,0,0,0,25,27,1,0,0,0,26,24,1,0,0,0,27,28,5,0,0,1,28, - 1,1,0,0,0,29,30,5,1,0,0,30,31,7,0,0,0,31,32,5,26,0,0,32,33,5,23, - 0,0,33,34,5,23,0,0,34,35,5,22,0,0,35,36,5,22,0,0,36,37,5,28,0,0, - 37,3,1,0,0,0,38,39,5,2,0,0,39,40,5,30,0,0,40,41,5,31,0,0,41,42,5, - 32,0,0,42,43,5,35,0,0,43,44,5,36,0,0,44,45,5,39,0,0,45,46,5,40,0, - 0,46,47,5,43,0,0,47,48,5,44,0,0,48,49,5,47,0,0,49,50,5,48,0,0,50, - 51,5,51,0,0,51,52,5,52,0,0,52,53,5,55,0,0,53,54,5,56,0,0,54,55,5, - 57,0,0,55,56,5,58,0,0,56,57,5,63,0,0,57,58,5,64,0,0,58,59,5,65,0, - 0,59,60,5,66,0,0,60,62,5,67,0,0,61,63,5,68,0,0,62,61,1,0,0,0,62, - 63,1,0,0,0,63,64,1,0,0,0,64,65,5,69,0,0,65,67,5,70,0,0,66,68,5,71, - 0,0,67,66,1,0,0,0,67,68,1,0,0,0,68,69,1,0,0,0,69,70,5,77,0,0,70, - 71,5,3,0,0,71,72,5,79,0,0,72,73,5,79,0,0,73,74,5,79,0,0,74,75,5, - 79,0,0,75,76,5,79,0,0,76,77,5,79,0,0,77,78,5,79,0,0,78,79,5,79,0, - 0,79,80,5,79,0,0,80,81,5,79,0,0,81,82,5,79,0,0,82,83,5,79,0,0,83, - 84,5,79,0,0,84,85,5,79,0,0,85,86,5,79,0,0,86,87,5,79,0,0,87,88,5, - 79,0,0,88,89,5,79,0,0,89,90,5,79,0,0,90,91,5,79,0,0,91,92,5,79,0, - 0,92,94,5,79,0,0,93,95,5,79,0,0,94,93,1,0,0,0,94,95,1,0,0,0,95,96, - 1,0,0,0,96,97,5,79,0,0,97,99,5,79,0,0,98,100,5,79,0,0,99,98,1,0, - 0,0,99,100,1,0,0,0,100,101,1,0,0,0,101,105,5,81,0,0,102,103,5,4, - 0,0,103,104,5,83,0,0,104,106,5,85,0,0,105,102,1,0,0,0,105,106,1, - 0,0,0,106,110,1,0,0,0,107,108,5,5,0,0,108,109,5,86,0,0,109,111,5, - 88,0,0,110,107,1,0,0,0,110,111,1,0,0,0,111,113,1,0,0,0,112,114,3, - 6,3,0,113,112,1,0,0,0,114,115,1,0,0,0,115,113,1,0,0,0,115,116,1, - 0,0,0,116,5,1,0,0,0,117,118,5,6,0,0,118,119,3,16,8,0,119,120,3,16, - 8,0,120,121,3,16,8,0,121,122,3,16,8,0,122,123,3,16,8,0,123,124,3, - 16,8,0,124,125,3,16,8,0,125,126,3,16,8,0,126,127,3,16,8,0,127,128, - 3,16,8,0,128,129,3,16,8,0,129,130,3,16,8,0,130,131,5,6,0,0,131,132, - 5,6,0,0,132,133,5,6,0,0,133,134,5,6,0,0,134,135,3,16,8,0,135,136, - 3,16,8,0,136,137,3,16,8,0,137,138,3,16,8,0,138,140,5,6,0,0,139,141, - 5,12,0,0,140,139,1,0,0,0,140,141,1,0,0,0,141,142,1,0,0,0,142,143, - 5,6,0,0,143,145,5,6,0,0,144,146,5,6,0,0,145,144,1,0,0,0,145,146, - 1,0,0,0,146,147,1,0,0,0,147,148,5,14,0,0,148,7,1,0,0,0,149,150,5, - 2,0,0,150,151,5,30,0,0,151,152,5,31,0,0,152,153,5,32,0,0,153,154, - 5,33,0,0,154,155,5,35,0,0,155,156,5,36,0,0,156,157,5,37,0,0,157, - 158,5,39,0,0,158,159,5,40,0,0,159,160,5,41,0,0,160,161,5,43,0,0, - 161,162,5,44,0,0,162,163,5,45,0,0,163,164,5,47,0,0,164,165,5,48, - 0,0,165,166,5,49,0,0,166,167,5,51,0,0,167,168,5,52,0,0,168,169,5, - 53,0,0,169,170,5,55,0,0,170,171,5,56,0,0,171,172,5,57,0,0,172,173, - 5,58,0,0,173,174,5,59,0,0,174,175,5,60,0,0,175,176,5,63,0,0,176, - 177,5,64,0,0,177,178,5,65,0,0,178,179,5,66,0,0,179,181,5,67,0,0, - 180,182,5,68,0,0,181,180,1,0,0,0,181,182,1,0,0,0,182,183,1,0,0,0, - 183,184,5,69,0,0,184,186,5,70,0,0,185,187,5,71,0,0,186,185,1,0,0, - 0,186,187,1,0,0,0,187,188,1,0,0,0,188,189,5,77,0,0,189,190,5,3,0, - 0,190,191,5,79,0,0,191,192,5,79,0,0,192,193,5,79,0,0,193,194,5,79, - 0,0,194,195,5,79,0,0,195,196,5,79,0,0,196,197,5,79,0,0,197,198,5, - 79,0,0,198,199,5,79,0,0,199,200,5,79,0,0,200,201,5,79,0,0,201,202, - 5,79,0,0,202,203,5,79,0,0,203,204,5,79,0,0,204,205,5,79,0,0,205, - 206,5,79,0,0,206,207,5,79,0,0,207,208,5,79,0,0,208,209,5,79,0,0, - 209,210,5,79,0,0,210,211,5,79,0,0,211,212,5,79,0,0,212,213,5,79, - 0,0,213,214,5,79,0,0,214,215,5,79,0,0,215,216,5,79,0,0,216,217,5, - 79,0,0,217,218,5,79,0,0,218,219,5,79,0,0,219,221,5,79,0,0,220,222, - 5,79,0,0,221,220,1,0,0,0,221,222,1,0,0,0,222,223,1,0,0,0,223,224, - 5,79,0,0,224,226,5,79,0,0,225,227,5,79,0,0,226,225,1,0,0,0,226,227, - 1,0,0,0,227,228,1,0,0,0,228,232,5,81,0,0,229,230,5,4,0,0,230,231, - 5,83,0,0,231,233,5,85,0,0,232,229,1,0,0,0,232,233,1,0,0,0,233,237, - 1,0,0,0,234,235,5,5,0,0,235,236,5,86,0,0,236,238,5,88,0,0,237,234, - 1,0,0,0,237,238,1,0,0,0,238,240,1,0,0,0,239,241,3,10,5,0,240,239, - 1,0,0,0,241,242,1,0,0,0,242,240,1,0,0,0,242,243,1,0,0,0,243,9,1, - 0,0,0,244,245,5,6,0,0,245,246,3,16,8,0,246,247,3,16,8,0,247,248, - 3,16,8,0,248,249,3,16,8,0,249,250,3,16,8,0,250,251,3,16,8,0,251, - 252,3,16,8,0,252,253,3,16,8,0,253,254,3,16,8,0,254,255,3,16,8,0, - 255,256,3,16,8,0,256,257,3,16,8,0,257,258,3,16,8,0,258,259,3,16, - 8,0,259,260,3,16,8,0,260,261,3,16,8,0,261,262,3,16,8,0,262,263,3, - 16,8,0,263,264,5,6,0,0,264,265,5,6,0,0,265,266,5,6,0,0,266,267,5, - 6,0,0,267,268,5,6,0,0,268,269,5,6,0,0,269,270,3,16,8,0,270,271,3, - 16,8,0,271,272,3,16,8,0,272,273,3,16,8,0,273,275,5,6,0,0,274,276, - 5,12,0,0,275,274,1,0,0,0,275,276,1,0,0,0,276,277,1,0,0,0,277,278, - 5,6,0,0,278,280,5,6,0,0,279,281,5,6,0,0,280,279,1,0,0,0,280,281, - 1,0,0,0,281,282,1,0,0,0,282,283,5,14,0,0,283,11,1,0,0,0,284,285, - 5,2,0,0,285,286,5,30,0,0,286,287,5,31,0,0,287,288,5,32,0,0,288,289, - 5,33,0,0,289,290,5,34,0,0,290,291,5,35,0,0,291,292,5,36,0,0,292, - 293,5,37,0,0,293,294,5,37,0,0,294,295,5,39,0,0,295,296,5,40,0,0, - 296,297,5,41,0,0,297,298,5,42,0,0,298,299,5,43,0,0,299,300,5,44, - 0,0,300,301,5,45,0,0,301,302,5,46,0,0,302,303,5,47,0,0,303,304,5, - 48,0,0,304,305,5,49,0,0,305,306,5,50,0,0,306,307,5,51,0,0,307,308, - 5,52,0,0,308,309,5,53,0,0,309,310,5,54,0,0,310,311,5,55,0,0,311, - 312,5,56,0,0,312,313,5,57,0,0,313,314,5,58,0,0,314,315,5,59,0,0, - 315,316,5,60,0,0,316,317,5,61,0,0,317,318,5,62,0,0,318,319,5,63, - 0,0,319,320,5,64,0,0,320,321,5,65,0,0,321,322,5,66,0,0,322,324,5, - 67,0,0,323,325,5,68,0,0,324,323,1,0,0,0,324,325,1,0,0,0,325,326, - 1,0,0,0,326,327,5,69,0,0,327,329,5,70,0,0,328,330,5,71,0,0,329,328, - 1,0,0,0,329,330,1,0,0,0,330,331,1,0,0,0,331,332,5,77,0,0,332,333, - 5,3,0,0,333,334,5,79,0,0,334,335,5,79,0,0,335,336,5,79,0,0,336,337, - 5,79,0,0,337,338,5,79,0,0,338,339,5,79,0,0,339,340,5,79,0,0,340, - 341,5,79,0,0,341,342,5,79,0,0,342,343,5,79,0,0,343,344,5,79,0,0, - 344,345,5,79,0,0,345,346,5,79,0,0,346,347,5,79,0,0,347,348,5,79, - 0,0,348,349,5,79,0,0,349,350,5,79,0,0,350,351,5,79,0,0,351,352,5, - 79,0,0,352,353,5,79,0,0,353,354,5,79,0,0,354,355,5,79,0,0,355,356, - 5,79,0,0,356,357,5,79,0,0,357,358,5,79,0,0,358,359,5,79,0,0,359, - 360,5,79,0,0,360,361,5,79,0,0,361,362,5,79,0,0,362,363,5,79,0,0, - 363,364,5,79,0,0,364,365,5,79,0,0,365,366,5,79,0,0,366,367,5,79, - 0,0,367,368,5,79,0,0,368,369,5,79,0,0,369,370,5,79,0,0,370,372,5, - 79,0,0,371,373,5,79,0,0,372,371,1,0,0,0,372,373,1,0,0,0,373,374, - 1,0,0,0,374,375,5,79,0,0,375,377,5,79,0,0,376,378,5,79,0,0,377,376, - 1,0,0,0,377,378,1,0,0,0,378,379,1,0,0,0,379,383,5,81,0,0,380,381, - 5,4,0,0,381,382,5,83,0,0,382,384,5,85,0,0,383,380,1,0,0,0,383,384, - 1,0,0,0,384,388,1,0,0,0,385,386,5,5,0,0,386,387,5,86,0,0,387,389, - 5,88,0,0,388,385,1,0,0,0,388,389,1,0,0,0,389,391,1,0,0,0,390,392, - 3,14,7,0,391,390,1,0,0,0,392,393,1,0,0,0,393,391,1,0,0,0,393,394, - 1,0,0,0,394,13,1,0,0,0,395,396,5,6,0,0,396,397,3,16,8,0,397,398, - 3,16,8,0,398,399,3,16,8,0,399,400,3,16,8,0,400,401,3,16,8,0,401, - 402,3,16,8,0,402,403,3,16,8,0,403,404,3,16,8,0,404,405,3,16,8,0, - 405,406,3,16,8,0,406,407,3,16,8,0,407,408,3,16,8,0,408,409,3,16, - 8,0,409,410,3,16,8,0,410,411,3,16,8,0,411,412,3,16,8,0,412,413,3, - 16,8,0,413,414,3,16,8,0,414,415,3,16,8,0,415,416,3,16,8,0,416,417, - 3,16,8,0,417,418,3,16,8,0,418,419,3,16,8,0,419,420,3,16,8,0,420, - 421,5,6,0,0,421,422,5,6,0,0,422,423,5,6,0,0,423,424,5,6,0,0,424, - 425,5,6,0,0,425,426,5,6,0,0,426,427,5,6,0,0,427,428,5,6,0,0,428, - 429,3,16,8,0,429,430,3,16,8,0,430,431,3,16,8,0,431,432,3,16,8,0, - 432,434,5,6,0,0,433,435,5,12,0,0,434,433,1,0,0,0,434,435,1,0,0,0, - 435,436,1,0,0,0,436,437,5,6,0,0,437,439,5,6,0,0,438,440,5,6,0,0, - 439,438,1,0,0,0,439,440,1,0,0,0,440,441,1,0,0,0,441,442,5,14,0,0, - 442,15,1,0,0,0,443,444,7,1,0,0,444,17,1,0,0,0,29,22,24,62,67,94, - 99,105,110,115,140,145,181,186,221,226,232,237,242,275,280,324,329, - 372,377,383,388,393,434,439 + 7,1,7,1,7,1,7,1,7,1,7,1,7,3,7,438,8,7,1,7,1,7,1,7,3,7,443,8,7,1, + 7,1,7,1,8,1,8,1,8,0,0,9,0,2,4,6,8,10,12,14,16,0,2,1,0,18,21,2,0, + 7,8,12,12,471,0,19,1,0,0,0,2,32,1,0,0,0,4,41,1,0,0,0,6,120,1,0,0, + 0,8,152,1,0,0,0,10,247,1,0,0,0,12,287,1,0,0,0,14,398,1,0,0,0,16, + 446,1,0,0,0,18,20,5,14,0,0,19,18,1,0,0,0,19,20,1,0,0,0,20,27,1,0, + 0,0,21,26,3,2,1,0,22,26,3,4,2,0,23,26,3,8,4,0,24,26,3,12,6,0,25, + 21,1,0,0,0,25,22,1,0,0,0,25,23,1,0,0,0,25,24,1,0,0,0,26,29,1,0,0, + 0,27,25,1,0,0,0,27,28,1,0,0,0,28,30,1,0,0,0,29,27,1,0,0,0,30,31, + 5,0,0,1,31,1,1,0,0,0,32,33,5,1,0,0,33,34,7,0,0,0,34,35,5,26,0,0, + 35,36,5,23,0,0,36,37,5,23,0,0,37,38,5,22,0,0,38,39,5,22,0,0,39,40, + 5,28,0,0,40,3,1,0,0,0,41,42,5,2,0,0,42,43,5,30,0,0,43,44,5,31,0, + 0,44,45,5,32,0,0,45,46,5,35,0,0,46,47,5,36,0,0,47,48,5,39,0,0,48, + 49,5,40,0,0,49,50,5,43,0,0,50,51,5,44,0,0,51,52,5,47,0,0,52,53,5, + 48,0,0,53,54,5,51,0,0,54,55,5,52,0,0,55,56,5,55,0,0,56,57,5,56,0, + 0,57,58,5,57,0,0,58,59,5,58,0,0,59,60,5,63,0,0,60,61,5,64,0,0,61, + 62,5,65,0,0,62,63,5,66,0,0,63,65,5,67,0,0,64,66,5,68,0,0,65,64,1, + 0,0,0,65,66,1,0,0,0,66,67,1,0,0,0,67,68,5,69,0,0,68,70,5,70,0,0, + 69,71,5,71,0,0,70,69,1,0,0,0,70,71,1,0,0,0,71,72,1,0,0,0,72,73,5, + 77,0,0,73,74,5,3,0,0,74,75,5,79,0,0,75,76,5,79,0,0,76,77,5,79,0, + 0,77,78,5,79,0,0,78,79,5,79,0,0,79,80,5,79,0,0,80,81,5,79,0,0,81, + 82,5,79,0,0,82,83,5,79,0,0,83,84,5,79,0,0,84,85,5,79,0,0,85,86,5, + 79,0,0,86,87,5,79,0,0,87,88,5,79,0,0,88,89,5,79,0,0,89,90,5,79,0, + 0,90,91,5,79,0,0,91,92,5,79,0,0,92,93,5,79,0,0,93,94,5,79,0,0,94, + 95,5,79,0,0,95,97,5,79,0,0,96,98,5,79,0,0,97,96,1,0,0,0,97,98,1, + 0,0,0,98,99,1,0,0,0,99,100,5,79,0,0,100,102,5,79,0,0,101,103,5,79, + 0,0,102,101,1,0,0,0,102,103,1,0,0,0,103,104,1,0,0,0,104,108,5,81, + 0,0,105,106,5,4,0,0,106,107,5,83,0,0,107,109,5,85,0,0,108,105,1, + 0,0,0,108,109,1,0,0,0,109,113,1,0,0,0,110,111,5,5,0,0,111,112,5, + 86,0,0,112,114,5,88,0,0,113,110,1,0,0,0,113,114,1,0,0,0,114,116, + 1,0,0,0,115,117,3,6,3,0,116,115,1,0,0,0,117,118,1,0,0,0,118,116, + 1,0,0,0,118,119,1,0,0,0,119,5,1,0,0,0,120,121,5,6,0,0,121,122,3, + 16,8,0,122,123,3,16,8,0,123,124,3,16,8,0,124,125,3,16,8,0,125,126, + 3,16,8,0,126,127,3,16,8,0,127,128,3,16,8,0,128,129,3,16,8,0,129, + 130,3,16,8,0,130,131,3,16,8,0,131,132,3,16,8,0,132,133,3,16,8,0, + 133,134,5,6,0,0,134,135,5,6,0,0,135,136,5,6,0,0,136,137,5,6,0,0, + 137,138,3,16,8,0,138,139,3,16,8,0,139,140,3,16,8,0,140,141,3,16, + 8,0,141,143,5,6,0,0,142,144,5,12,0,0,143,142,1,0,0,0,143,144,1,0, + 0,0,144,145,1,0,0,0,145,146,5,6,0,0,146,148,5,6,0,0,147,149,5,6, + 0,0,148,147,1,0,0,0,148,149,1,0,0,0,149,150,1,0,0,0,150,151,5,14, + 0,0,151,7,1,0,0,0,152,153,5,2,0,0,153,154,5,30,0,0,154,155,5,31, + 0,0,155,156,5,32,0,0,156,157,5,33,0,0,157,158,5,35,0,0,158,159,5, + 36,0,0,159,160,5,37,0,0,160,161,5,39,0,0,161,162,5,40,0,0,162,163, + 5,41,0,0,163,164,5,43,0,0,164,165,5,44,0,0,165,166,5,45,0,0,166, + 167,5,47,0,0,167,168,5,48,0,0,168,169,5,49,0,0,169,170,5,51,0,0, + 170,171,5,52,0,0,171,172,5,53,0,0,172,173,5,55,0,0,173,174,5,56, + 0,0,174,175,5,57,0,0,175,176,5,58,0,0,176,177,5,59,0,0,177,178,5, + 60,0,0,178,179,5,63,0,0,179,180,5,64,0,0,180,181,5,65,0,0,181,182, + 5,66,0,0,182,184,5,67,0,0,183,185,5,68,0,0,184,183,1,0,0,0,184,185, + 1,0,0,0,185,186,1,0,0,0,186,187,5,69,0,0,187,189,5,70,0,0,188,190, + 5,71,0,0,189,188,1,0,0,0,189,190,1,0,0,0,190,191,1,0,0,0,191,192, + 5,77,0,0,192,193,5,3,0,0,193,194,5,79,0,0,194,195,5,79,0,0,195,196, + 5,79,0,0,196,197,5,79,0,0,197,198,5,79,0,0,198,199,5,79,0,0,199, + 200,5,79,0,0,200,201,5,79,0,0,201,202,5,79,0,0,202,203,5,79,0,0, + 203,204,5,79,0,0,204,205,5,79,0,0,205,206,5,79,0,0,206,207,5,79, + 0,0,207,208,5,79,0,0,208,209,5,79,0,0,209,210,5,79,0,0,210,211,5, + 79,0,0,211,212,5,79,0,0,212,213,5,79,0,0,213,214,5,79,0,0,214,215, + 5,79,0,0,215,216,5,79,0,0,216,217,5,79,0,0,217,218,5,79,0,0,218, + 219,5,79,0,0,219,220,5,79,0,0,220,221,5,79,0,0,221,222,5,79,0,0, + 222,224,5,79,0,0,223,225,5,79,0,0,224,223,1,0,0,0,224,225,1,0,0, + 0,225,226,1,0,0,0,226,227,5,79,0,0,227,229,5,79,0,0,228,230,5,79, + 0,0,229,228,1,0,0,0,229,230,1,0,0,0,230,231,1,0,0,0,231,235,5,81, + 0,0,232,233,5,4,0,0,233,234,5,83,0,0,234,236,5,85,0,0,235,232,1, + 0,0,0,235,236,1,0,0,0,236,240,1,0,0,0,237,238,5,5,0,0,238,239,5, + 86,0,0,239,241,5,88,0,0,240,237,1,0,0,0,240,241,1,0,0,0,241,243, + 1,0,0,0,242,244,3,10,5,0,243,242,1,0,0,0,244,245,1,0,0,0,245,243, + 1,0,0,0,245,246,1,0,0,0,246,9,1,0,0,0,247,248,5,6,0,0,248,249,3, + 16,8,0,249,250,3,16,8,0,250,251,3,16,8,0,251,252,3,16,8,0,252,253, + 3,16,8,0,253,254,3,16,8,0,254,255,3,16,8,0,255,256,3,16,8,0,256, + 257,3,16,8,0,257,258,3,16,8,0,258,259,3,16,8,0,259,260,3,16,8,0, + 260,261,3,16,8,0,261,262,3,16,8,0,262,263,3,16,8,0,263,264,3,16, + 8,0,264,265,3,16,8,0,265,266,3,16,8,0,266,267,5,6,0,0,267,268,5, + 6,0,0,268,269,5,6,0,0,269,270,5,6,0,0,270,271,5,6,0,0,271,272,5, + 6,0,0,272,273,3,16,8,0,273,274,3,16,8,0,274,275,3,16,8,0,275,276, + 3,16,8,0,276,278,5,6,0,0,277,279,5,12,0,0,278,277,1,0,0,0,278,279, + 1,0,0,0,279,280,1,0,0,0,280,281,5,6,0,0,281,283,5,6,0,0,282,284, + 5,6,0,0,283,282,1,0,0,0,283,284,1,0,0,0,284,285,1,0,0,0,285,286, + 5,14,0,0,286,11,1,0,0,0,287,288,5,2,0,0,288,289,5,30,0,0,289,290, + 5,31,0,0,290,291,5,32,0,0,291,292,5,33,0,0,292,293,5,34,0,0,293, + 294,5,35,0,0,294,295,5,36,0,0,295,296,5,37,0,0,296,297,5,37,0,0, + 297,298,5,39,0,0,298,299,5,40,0,0,299,300,5,41,0,0,300,301,5,42, + 0,0,301,302,5,43,0,0,302,303,5,44,0,0,303,304,5,45,0,0,304,305,5, + 46,0,0,305,306,5,47,0,0,306,307,5,48,0,0,307,308,5,49,0,0,308,309, + 5,50,0,0,309,310,5,51,0,0,310,311,5,52,0,0,311,312,5,53,0,0,312, + 313,5,54,0,0,313,314,5,55,0,0,314,315,5,56,0,0,315,316,5,57,0,0, + 316,317,5,58,0,0,317,318,5,59,0,0,318,319,5,60,0,0,319,320,5,61, + 0,0,320,321,5,62,0,0,321,322,5,63,0,0,322,323,5,64,0,0,323,324,5, + 65,0,0,324,325,5,66,0,0,325,327,5,67,0,0,326,328,5,68,0,0,327,326, + 1,0,0,0,327,328,1,0,0,0,328,329,1,0,0,0,329,330,5,69,0,0,330,332, + 5,70,0,0,331,333,5,71,0,0,332,331,1,0,0,0,332,333,1,0,0,0,333,334, + 1,0,0,0,334,335,5,77,0,0,335,336,5,3,0,0,336,337,5,79,0,0,337,338, + 5,79,0,0,338,339,5,79,0,0,339,340,5,79,0,0,340,341,5,79,0,0,341, + 342,5,79,0,0,342,343,5,79,0,0,343,344,5,79,0,0,344,345,5,79,0,0, + 345,346,5,79,0,0,346,347,5,79,0,0,347,348,5,79,0,0,348,349,5,79, + 0,0,349,350,5,79,0,0,350,351,5,79,0,0,351,352,5,79,0,0,352,353,5, + 79,0,0,353,354,5,79,0,0,354,355,5,79,0,0,355,356,5,79,0,0,356,357, + 5,79,0,0,357,358,5,79,0,0,358,359,5,79,0,0,359,360,5,79,0,0,360, + 361,5,79,0,0,361,362,5,79,0,0,362,363,5,79,0,0,363,364,5,79,0,0, + 364,365,5,79,0,0,365,366,5,79,0,0,366,367,5,79,0,0,367,368,5,79, + 0,0,368,369,5,79,0,0,369,370,5,79,0,0,370,371,5,79,0,0,371,372,5, + 79,0,0,372,373,5,79,0,0,373,375,5,79,0,0,374,376,5,79,0,0,375,374, + 1,0,0,0,375,376,1,0,0,0,376,377,1,0,0,0,377,378,5,79,0,0,378,380, + 5,79,0,0,379,381,5,79,0,0,380,379,1,0,0,0,380,381,1,0,0,0,381,382, + 1,0,0,0,382,386,5,81,0,0,383,384,5,4,0,0,384,385,5,83,0,0,385,387, + 5,85,0,0,386,383,1,0,0,0,386,387,1,0,0,0,387,391,1,0,0,0,388,389, + 5,5,0,0,389,390,5,86,0,0,390,392,5,88,0,0,391,388,1,0,0,0,391,392, + 1,0,0,0,392,394,1,0,0,0,393,395,3,14,7,0,394,393,1,0,0,0,395,396, + 1,0,0,0,396,394,1,0,0,0,396,397,1,0,0,0,397,13,1,0,0,0,398,399,5, + 6,0,0,399,400,3,16,8,0,400,401,3,16,8,0,401,402,3,16,8,0,402,403, + 3,16,8,0,403,404,3,16,8,0,404,405,3,16,8,0,405,406,3,16,8,0,406, + 407,3,16,8,0,407,408,3,16,8,0,408,409,3,16,8,0,409,410,3,16,8,0, + 410,411,3,16,8,0,411,412,3,16,8,0,412,413,3,16,8,0,413,414,3,16, + 8,0,414,415,3,16,8,0,415,416,3,16,8,0,416,417,3,16,8,0,417,418,3, + 16,8,0,418,419,3,16,8,0,419,420,3,16,8,0,420,421,3,16,8,0,421,422, + 3,16,8,0,422,423,3,16,8,0,423,424,5,6,0,0,424,425,5,6,0,0,425,426, + 5,6,0,0,426,427,5,6,0,0,427,428,5,6,0,0,428,429,5,6,0,0,429,430, + 5,6,0,0,430,431,5,6,0,0,431,432,3,16,8,0,432,433,3,16,8,0,433,434, + 3,16,8,0,434,435,3,16,8,0,435,437,5,6,0,0,436,438,5,12,0,0,437,436, + 1,0,0,0,437,438,1,0,0,0,438,439,1,0,0,0,439,440,5,6,0,0,440,442, + 5,6,0,0,441,443,5,6,0,0,442,441,1,0,0,0,442,443,1,0,0,0,443,444, + 1,0,0,0,444,445,5,14,0,0,445,15,1,0,0,0,446,447,7,1,0,0,447,17,1, + 0,0,0,30,19,25,27,65,70,97,102,108,113,118,143,148,184,189,224,229, + 235,240,245,278,283,327,332,375,380,386,391,396,437,442 ] class NmrPipePKParser ( Parser ): @@ -330,6 +331,9 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): def EOF(self): return self.getToken(NmrPipePKParser.EOF, 0) + def RETURN(self): + return self.getToken(NmrPipePKParser.RETURN, 0) + def data_label(self, i:int=None): if i is None: return self.getTypedRuleContexts(NmrPipePKParser.Data_labelContext) @@ -379,39 +383,47 @@ def nmrpipe_pk(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 24 + self.state = 19 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==14: + self.state = 18 + self.match(NmrPipePKParser.RETURN) + + + self.state = 27 self._errHandler.sync(self) _la = self._input.LA(1) while _la==1 or _la==2: - self.state = 22 + self.state = 25 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,0,self._ctx) + la_ = self._interp.adaptivePredict(self._input,1,self._ctx) if la_ == 1: - self.state = 18 + self.state = 21 self.data_label() pass elif la_ == 2: - self.state = 19 + self.state = 22 self.peak_list_2d() pass elif la_ == 3: - self.state = 20 + self.state = 23 self.peak_list_3d() pass elif la_ == 4: - self.state = 21 + self.state = 24 self.peak_list_4d() pass - self.state = 26 + self.state = 29 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 27 + self.state = 30 self.match(NmrPipePKParser.EOF) except RecognitionException as re: localctx.exception = re @@ -483,26 +495,26 @@ def data_label(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 29 + self.state = 32 self.match(NmrPipePKParser.Data) - self.state = 30 + self.state = 33 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 3932160) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() - self.state = 31 + self.state = 34 self.match(NmrPipePKParser.Simple_name_DA) - self.state = 32 + self.state = 35 self.match(NmrPipePKParser.Integer_DA) - self.state = 33 + self.state = 36 self.match(NmrPipePKParser.Integer_DA) - self.state = 34 + self.state = 37 self.match(NmrPipePKParser.Ppm_value_DA) - self.state = 35 + self.state = 38 self.match(NmrPipePKParser.Ppm_value_DA) - self.state = 36 + self.state = 39 self.match(NmrPipePKParser.RETURN_DA) except RecognitionException as re: localctx.exception = re @@ -662,82 +674,76 @@ def peak_list_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 38 + self.state = 41 self.match(NmrPipePKParser.Vars) - self.state = 39 + self.state = 42 self.match(NmrPipePKParser.Index) - self.state = 40 + self.state = 43 self.match(NmrPipePKParser.X_axis) - self.state = 41 + self.state = 44 self.match(NmrPipePKParser.Y_axis) - self.state = 42 + self.state = 45 self.match(NmrPipePKParser.Dx) - self.state = 43 + self.state = 46 self.match(NmrPipePKParser.Dy) - self.state = 44 + self.state = 47 self.match(NmrPipePKParser.X_ppm) - self.state = 45 + self.state = 48 self.match(NmrPipePKParser.Y_ppm) - self.state = 46 + self.state = 49 self.match(NmrPipePKParser.X_hz) - self.state = 47 + self.state = 50 self.match(NmrPipePKParser.Y_hz) - self.state = 48 + self.state = 51 self.match(NmrPipePKParser.Xw) - self.state = 49 + self.state = 52 self.match(NmrPipePKParser.Yw) - self.state = 50 + self.state = 53 self.match(NmrPipePKParser.Xw_hz) - self.state = 51 + self.state = 54 self.match(NmrPipePKParser.Yw_hz) - self.state = 52 + self.state = 55 self.match(NmrPipePKParser.X1) - self.state = 53 + self.state = 56 self.match(NmrPipePKParser.X3) - self.state = 54 + self.state = 57 self.match(NmrPipePKParser.Y1) - self.state = 55 + self.state = 58 self.match(NmrPipePKParser.Y3) - self.state = 56 + self.state = 59 self.match(NmrPipePKParser.Height) - self.state = 57 + self.state = 60 self.match(NmrPipePKParser.DHeight) - self.state = 58 + self.state = 61 self.match(NmrPipePKParser.Vol) - self.state = 59 + self.state = 62 self.match(NmrPipePKParser.Pchi2) - self.state = 60 + self.state = 63 self.match(NmrPipePKParser.Type) - self.state = 62 + self.state = 65 self._errHandler.sync(self) _la = self._input.LA(1) if _la==68: - self.state = 61 + self.state = 64 self.match(NmrPipePKParser.Ass) - self.state = 64 + self.state = 67 self.match(NmrPipePKParser.ClustId) - self.state = 65 + self.state = 68 self.match(NmrPipePKParser.Memcnt) - self.state = 67 + self.state = 70 self._errHandler.sync(self) _la = self._input.LA(1) if _la==71: - self.state = 66 + self.state = 69 self.match(NmrPipePKParser.Trouble) - self.state = 69 - self.match(NmrPipePKParser.RETURN_VA) - self.state = 70 - self.match(NmrPipePKParser.Format) - self.state = 71 - self.match(NmrPipePKParser.Format_code) self.state = 72 - self.match(NmrPipePKParser.Format_code) + self.match(NmrPipePKParser.RETURN_VA) self.state = 73 - self.match(NmrPipePKParser.Format_code) + self.match(NmrPipePKParser.Format) self.state = 74 self.match(NmrPipePKParser.Format_code) self.state = 75 @@ -776,59 +782,65 @@ def peak_list_2d(self): self.match(NmrPipePKParser.Format_code) self.state = 92 self.match(NmrPipePKParser.Format_code) + self.state = 93 + self.match(NmrPipePKParser.Format_code) self.state = 94 + self.match(NmrPipePKParser.Format_code) + self.state = 95 + self.match(NmrPipePKParser.Format_code) + self.state = 97 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,4,self._ctx) + la_ = self._interp.adaptivePredict(self._input,5,self._ctx) if la_ == 1: - self.state = 93 + self.state = 96 self.match(NmrPipePKParser.Format_code) - self.state = 96 + self.state = 99 self.match(NmrPipePKParser.Format_code) - self.state = 97 + self.state = 100 self.match(NmrPipePKParser.Format_code) - self.state = 99 + self.state = 102 self._errHandler.sync(self) _la = self._input.LA(1) if _la==79: - self.state = 98 + self.state = 101 self.match(NmrPipePKParser.Format_code) - self.state = 101 + self.state = 104 self.match(NmrPipePKParser.RETURN_FO) - self.state = 105 + self.state = 108 self._errHandler.sync(self) _la = self._input.LA(1) if _la==4: - self.state = 102 + self.state = 105 self.match(NmrPipePKParser.Null_value) - self.state = 103 + self.state = 106 self.match(NmrPipePKParser.Any_name_NV) - self.state = 104 + self.state = 107 self.match(NmrPipePKParser.RETURN_NV) - self.state = 110 + self.state = 113 self._errHandler.sync(self) _la = self._input.LA(1) if _la==5: - self.state = 107 + self.state = 110 self.match(NmrPipePKParser.Null_string) - self.state = 108 + self.state = 111 self.match(NmrPipePKParser.Any_name_NS) - self.state = 109 + self.state = 112 self.match(NmrPipePKParser.RETURN_NS) - self.state = 113 + self.state = 116 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 112 + self.state = 115 self.peak_2d() - self.state = 115 + self.state = 118 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==6): @@ -890,14 +902,8 @@ def peak_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 117 - self.match(NmrPipePKParser.Integer) - self.state = 118 - self.number() - self.state = 119 - self.number() self.state = 120 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 121 self.number() self.state = 122 @@ -917,44 +923,50 @@ def peak_2d(self): self.state = 129 self.number() self.state = 130 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 131 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 132 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 133 self.match(NmrPipePKParser.Integer) self.state = 134 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 135 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 136 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 137 self.number() self.state = 138 - self.match(NmrPipePKParser.Integer) + self.number() + self.state = 139 + self.number() self.state = 140 + self.number() + self.state = 141 + self.match(NmrPipePKParser.Integer) + self.state = 143 self._errHandler.sync(self) _la = self._input.LA(1) if _la==12: - self.state = 139 + self.state = 142 self.match(NmrPipePKParser.Any_name) - self.state = 142 + self.state = 145 self.match(NmrPipePKParser.Integer) - self.state = 143 + self.state = 146 self.match(NmrPipePKParser.Integer) - self.state = 145 + self.state = 148 self._errHandler.sync(self) _la = self._input.LA(1) if _la==6: - self.state = 144 + self.state = 147 self.match(NmrPipePKParser.Integer) - self.state = 147 + self.state = 150 self.match(NmrPipePKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -1138,98 +1150,92 @@ def peak_list_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 149 + self.state = 152 self.match(NmrPipePKParser.Vars) - self.state = 150 + self.state = 153 self.match(NmrPipePKParser.Index) - self.state = 151 + self.state = 154 self.match(NmrPipePKParser.X_axis) - self.state = 152 + self.state = 155 self.match(NmrPipePKParser.Y_axis) - self.state = 153 + self.state = 156 self.match(NmrPipePKParser.Z_axis) - self.state = 154 + self.state = 157 self.match(NmrPipePKParser.Dx) - self.state = 155 + self.state = 158 self.match(NmrPipePKParser.Dy) - self.state = 156 + self.state = 159 self.match(NmrPipePKParser.Dz) - self.state = 157 + self.state = 160 self.match(NmrPipePKParser.X_ppm) - self.state = 158 + self.state = 161 self.match(NmrPipePKParser.Y_ppm) - self.state = 159 + self.state = 162 self.match(NmrPipePKParser.Z_ppm) - self.state = 160 + self.state = 163 self.match(NmrPipePKParser.X_hz) - self.state = 161 + self.state = 164 self.match(NmrPipePKParser.Y_hz) - self.state = 162 + self.state = 165 self.match(NmrPipePKParser.Z_hz) - self.state = 163 + self.state = 166 self.match(NmrPipePKParser.Xw) - self.state = 164 + self.state = 167 self.match(NmrPipePKParser.Yw) - self.state = 165 + self.state = 168 self.match(NmrPipePKParser.Zw) - self.state = 166 + self.state = 169 self.match(NmrPipePKParser.Xw_hz) - self.state = 167 + self.state = 170 self.match(NmrPipePKParser.Yw_hz) - self.state = 168 + self.state = 171 self.match(NmrPipePKParser.Zw_hz) - self.state = 169 + self.state = 172 self.match(NmrPipePKParser.X1) - self.state = 170 + self.state = 173 self.match(NmrPipePKParser.X3) - self.state = 171 + self.state = 174 self.match(NmrPipePKParser.Y1) - self.state = 172 + self.state = 175 self.match(NmrPipePKParser.Y3) - self.state = 173 + self.state = 176 self.match(NmrPipePKParser.Z1) - self.state = 174 + self.state = 177 self.match(NmrPipePKParser.Z3) - self.state = 175 + self.state = 178 self.match(NmrPipePKParser.Height) - self.state = 176 + self.state = 179 self.match(NmrPipePKParser.DHeight) - self.state = 177 + self.state = 180 self.match(NmrPipePKParser.Vol) - self.state = 178 + self.state = 181 self.match(NmrPipePKParser.Pchi2) - self.state = 179 + self.state = 182 self.match(NmrPipePKParser.Type) - self.state = 181 + self.state = 184 self._errHandler.sync(self) _la = self._input.LA(1) if _la==68: - self.state = 180 + self.state = 183 self.match(NmrPipePKParser.Ass) - self.state = 183 + self.state = 186 self.match(NmrPipePKParser.ClustId) - self.state = 184 + self.state = 187 self.match(NmrPipePKParser.Memcnt) - self.state = 186 + self.state = 189 self._errHandler.sync(self) _la = self._input.LA(1) if _la==71: - self.state = 185 + self.state = 188 self.match(NmrPipePKParser.Trouble) - self.state = 188 - self.match(NmrPipePKParser.RETURN_VA) - self.state = 189 - self.match(NmrPipePKParser.Format) - self.state = 190 - self.match(NmrPipePKParser.Format_code) self.state = 191 - self.match(NmrPipePKParser.Format_code) + self.match(NmrPipePKParser.RETURN_VA) self.state = 192 - self.match(NmrPipePKParser.Format_code) + self.match(NmrPipePKParser.Format) self.state = 193 self.match(NmrPipePKParser.Format_code) self.state = 194 @@ -1284,59 +1290,65 @@ def peak_list_3d(self): self.match(NmrPipePKParser.Format_code) self.state = 219 self.match(NmrPipePKParser.Format_code) + self.state = 220 + self.match(NmrPipePKParser.Format_code) self.state = 221 + self.match(NmrPipePKParser.Format_code) + self.state = 222 + self.match(NmrPipePKParser.Format_code) + self.state = 224 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,13,self._ctx) + la_ = self._interp.adaptivePredict(self._input,14,self._ctx) if la_ == 1: - self.state = 220 + self.state = 223 self.match(NmrPipePKParser.Format_code) - self.state = 223 + self.state = 226 self.match(NmrPipePKParser.Format_code) - self.state = 224 + self.state = 227 self.match(NmrPipePKParser.Format_code) - self.state = 226 + self.state = 229 self._errHandler.sync(self) _la = self._input.LA(1) if _la==79: - self.state = 225 + self.state = 228 self.match(NmrPipePKParser.Format_code) - self.state = 228 + self.state = 231 self.match(NmrPipePKParser.RETURN_FO) - self.state = 232 + self.state = 235 self._errHandler.sync(self) _la = self._input.LA(1) if _la==4: - self.state = 229 + self.state = 232 self.match(NmrPipePKParser.Null_value) - self.state = 230 + self.state = 233 self.match(NmrPipePKParser.Any_name_NV) - self.state = 231 + self.state = 234 self.match(NmrPipePKParser.RETURN_NV) - self.state = 237 + self.state = 240 self._errHandler.sync(self) _la = self._input.LA(1) if _la==5: - self.state = 234 + self.state = 237 self.match(NmrPipePKParser.Null_string) - self.state = 235 + self.state = 238 self.match(NmrPipePKParser.Any_name_NS) - self.state = 236 + self.state = 239 self.match(NmrPipePKParser.RETURN_NS) - self.state = 240 + self.state = 243 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 239 + self.state = 242 self.peak_3d() - self.state = 242 + self.state = 245 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==6): @@ -1398,14 +1410,8 @@ def peak_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 244 - self.match(NmrPipePKParser.Integer) - self.state = 245 - self.number() - self.state = 246 - self.number() self.state = 247 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 248 self.number() self.state = 249 @@ -1437,11 +1443,11 @@ def peak_3d(self): self.state = 262 self.number() self.state = 263 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 264 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 265 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 266 self.match(NmrPipePKParser.Integer) self.state = 267 @@ -1449,36 +1455,42 @@ def peak_3d(self): self.state = 268 self.match(NmrPipePKParser.Integer) self.state = 269 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 270 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 271 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 272 self.number() self.state = 273 - self.match(NmrPipePKParser.Integer) + self.number() + self.state = 274 + self.number() self.state = 275 + self.number() + self.state = 276 + self.match(NmrPipePKParser.Integer) + self.state = 278 self._errHandler.sync(self) _la = self._input.LA(1) if _la==12: - self.state = 274 + self.state = 277 self.match(NmrPipePKParser.Any_name) - self.state = 277 + self.state = 280 self.match(NmrPipePKParser.Integer) - self.state = 278 + self.state = 281 self.match(NmrPipePKParser.Integer) - self.state = 280 + self.state = 283 self._errHandler.sync(self) _la = self._input.LA(1) if _la==6: - self.state = 279 + self.state = 282 self.match(NmrPipePKParser.Integer) - self.state = 282 + self.state = 285 self.match(NmrPipePKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -1686,114 +1698,108 @@ def peak_list_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 284 + self.state = 287 self.match(NmrPipePKParser.Vars) - self.state = 285 + self.state = 288 self.match(NmrPipePKParser.Index) - self.state = 286 + self.state = 289 self.match(NmrPipePKParser.X_axis) - self.state = 287 + self.state = 290 self.match(NmrPipePKParser.Y_axis) - self.state = 288 + self.state = 291 self.match(NmrPipePKParser.Z_axis) - self.state = 289 + self.state = 292 self.match(NmrPipePKParser.A_axis) - self.state = 290 + self.state = 293 self.match(NmrPipePKParser.Dx) - self.state = 291 + self.state = 294 self.match(NmrPipePKParser.Dy) - self.state = 292 + self.state = 295 self.match(NmrPipePKParser.Dz) - self.state = 293 + self.state = 296 self.match(NmrPipePKParser.Dz) - self.state = 294 + self.state = 297 self.match(NmrPipePKParser.X_ppm) - self.state = 295 + self.state = 298 self.match(NmrPipePKParser.Y_ppm) - self.state = 296 + self.state = 299 self.match(NmrPipePKParser.Z_ppm) - self.state = 297 + self.state = 300 self.match(NmrPipePKParser.A_ppm) - self.state = 298 + self.state = 301 self.match(NmrPipePKParser.X_hz) - self.state = 299 + self.state = 302 self.match(NmrPipePKParser.Y_hz) - self.state = 300 + self.state = 303 self.match(NmrPipePKParser.Z_hz) - self.state = 301 + self.state = 304 self.match(NmrPipePKParser.A_hz) - self.state = 302 + self.state = 305 self.match(NmrPipePKParser.Xw) - self.state = 303 + self.state = 306 self.match(NmrPipePKParser.Yw) - self.state = 304 + self.state = 307 self.match(NmrPipePKParser.Zw) - self.state = 305 + self.state = 308 self.match(NmrPipePKParser.Aw) - self.state = 306 + self.state = 309 self.match(NmrPipePKParser.Xw_hz) - self.state = 307 + self.state = 310 self.match(NmrPipePKParser.Yw_hz) - self.state = 308 + self.state = 311 self.match(NmrPipePKParser.Zw_hz) - self.state = 309 + self.state = 312 self.match(NmrPipePKParser.Aw_hz) - self.state = 310 + self.state = 313 self.match(NmrPipePKParser.X1) - self.state = 311 + self.state = 314 self.match(NmrPipePKParser.X3) - self.state = 312 + self.state = 315 self.match(NmrPipePKParser.Y1) - self.state = 313 + self.state = 316 self.match(NmrPipePKParser.Y3) - self.state = 314 + self.state = 317 self.match(NmrPipePKParser.Z1) - self.state = 315 + self.state = 318 self.match(NmrPipePKParser.Z3) - self.state = 316 + self.state = 319 self.match(NmrPipePKParser.A1) - self.state = 317 + self.state = 320 self.match(NmrPipePKParser.A3) - self.state = 318 + self.state = 321 self.match(NmrPipePKParser.Height) - self.state = 319 + self.state = 322 self.match(NmrPipePKParser.DHeight) - self.state = 320 + self.state = 323 self.match(NmrPipePKParser.Vol) - self.state = 321 + self.state = 324 self.match(NmrPipePKParser.Pchi2) - self.state = 322 + self.state = 325 self.match(NmrPipePKParser.Type) - self.state = 324 + self.state = 327 self._errHandler.sync(self) _la = self._input.LA(1) if _la==68: - self.state = 323 + self.state = 326 self.match(NmrPipePKParser.Ass) - self.state = 326 + self.state = 329 self.match(NmrPipePKParser.ClustId) - self.state = 327 + self.state = 330 self.match(NmrPipePKParser.Memcnt) - self.state = 329 + self.state = 332 self._errHandler.sync(self) _la = self._input.LA(1) if _la==71: - self.state = 328 + self.state = 331 self.match(NmrPipePKParser.Trouble) - self.state = 331 - self.match(NmrPipePKParser.RETURN_VA) - self.state = 332 - self.match(NmrPipePKParser.Format) - self.state = 333 - self.match(NmrPipePKParser.Format_code) self.state = 334 - self.match(NmrPipePKParser.Format_code) + self.match(NmrPipePKParser.RETURN_VA) self.state = 335 - self.match(NmrPipePKParser.Format_code) + self.match(NmrPipePKParser.Format) self.state = 336 self.match(NmrPipePKParser.Format_code) self.state = 337 @@ -1864,59 +1870,65 @@ def peak_list_4d(self): self.match(NmrPipePKParser.Format_code) self.state = 370 self.match(NmrPipePKParser.Format_code) + self.state = 371 + self.match(NmrPipePKParser.Format_code) self.state = 372 + self.match(NmrPipePKParser.Format_code) + self.state = 373 + self.match(NmrPipePKParser.Format_code) + self.state = 375 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,22,self._ctx) + la_ = self._interp.adaptivePredict(self._input,23,self._ctx) if la_ == 1: - self.state = 371 + self.state = 374 self.match(NmrPipePKParser.Format_code) - self.state = 374 + self.state = 377 self.match(NmrPipePKParser.Format_code) - self.state = 375 + self.state = 378 self.match(NmrPipePKParser.Format_code) - self.state = 377 + self.state = 380 self._errHandler.sync(self) _la = self._input.LA(1) if _la==79: - self.state = 376 + self.state = 379 self.match(NmrPipePKParser.Format_code) - self.state = 379 + self.state = 382 self.match(NmrPipePKParser.RETURN_FO) - self.state = 383 + self.state = 386 self._errHandler.sync(self) _la = self._input.LA(1) if _la==4: - self.state = 380 + self.state = 383 self.match(NmrPipePKParser.Null_value) - self.state = 381 + self.state = 384 self.match(NmrPipePKParser.Any_name_NV) - self.state = 382 + self.state = 385 self.match(NmrPipePKParser.RETURN_NV) - self.state = 388 + self.state = 391 self._errHandler.sync(self) _la = self._input.LA(1) if _la==5: - self.state = 385 + self.state = 388 self.match(NmrPipePKParser.Null_string) - self.state = 386 + self.state = 389 self.match(NmrPipePKParser.Any_name_NS) - self.state = 387 + self.state = 390 self.match(NmrPipePKParser.RETURN_NS) - self.state = 391 + self.state = 394 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 390 + self.state = 393 self.peak_4d() - self.state = 393 + self.state = 396 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==6): @@ -1978,14 +1990,8 @@ def peak_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 395 - self.match(NmrPipePKParser.Integer) - self.state = 396 - self.number() - self.state = 397 - self.number() self.state = 398 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 399 self.number() self.state = 400 @@ -2029,11 +2035,11 @@ def peak_4d(self): self.state = 419 self.number() self.state = 420 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 421 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 422 - self.match(NmrPipePKParser.Integer) + self.number() self.state = 423 self.match(NmrPipePKParser.Integer) self.state = 424 @@ -2045,36 +2051,42 @@ def peak_4d(self): self.state = 427 self.match(NmrPipePKParser.Integer) self.state = 428 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 429 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 430 - self.number() + self.match(NmrPipePKParser.Integer) self.state = 431 self.number() self.state = 432 - self.match(NmrPipePKParser.Integer) + self.number() + self.state = 433 + self.number() self.state = 434 + self.number() + self.state = 435 + self.match(NmrPipePKParser.Integer) + self.state = 437 self._errHandler.sync(self) _la = self._input.LA(1) if _la==12: - self.state = 433 + self.state = 436 self.match(NmrPipePKParser.Any_name) - self.state = 436 + self.state = 439 self.match(NmrPipePKParser.Integer) - self.state = 437 + self.state = 440 self.match(NmrPipePKParser.Integer) - self.state = 439 + self.state = 442 self._errHandler.sync(self) _la = self._input.LA(1) if _la==6: - self.state = 438 + self.state = 441 self.match(NmrPipePKParser.Integer) - self.state = 441 + self.state = 444 self.match(NmrPipePKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -2122,7 +2134,7 @@ def number(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 443 + self.state = 446 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 4480) != 0)): self._errHandler.recoverInline(self) diff --git a/wwpdb/utils/nmr/pk/NmrPipePKParserListener.py b/wwpdb/utils/nmr/pk/NmrPipePKParserListener.py index 30d693e6..c3da6807 100644 --- a/wwpdb/utils/nmr/pk/NmrPipePKParserListener.py +++ b/wwpdb/utils/nmr/pk/NmrPipePKParserListener.py @@ -295,8 +295,8 @@ def exitPeak_2d(self, ctx: NmrPipePKParser.Peak_2dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -478,9 +478,9 @@ def exitPeak_3d(self, ctx: NmrPipePKParser.Peak_3dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -687,10 +687,10 @@ def exitPeak_4d(self, ctx: NmrPipePKParser.Peak_4dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(4, a4['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(4, self.atomSelectionSet[3][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() diff --git a/wwpdb/utils/nmr/pk/NmrPipePKReader.py b/wwpdb/utils/nmr/pk/NmrPipePKReader.py index 0afd1497..2af9b2a7 100644 --- a/wwpdb/utils/nmr/pk/NmrPipePKReader.py +++ b/wwpdb/utils/nmr/pk/NmrPipePKReader.py @@ -92,7 +92,7 @@ def setParserMaxErrorReport(self, maxErrReport): self.__maxParserErrorReport = maxErrReport def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, - createSfDict=False, originalFileName=None, listIdCounter=None, entryId=None): + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): """ Parse NMRPIPE PK file. @return: NmrPipePKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. """ @@ -172,6 +172,8 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, listener.setOriginaFileName(originalFileName) if listIdCounter is not None: listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) if entryId is not None: listener.setEntryId(entryId) walker.walk(listener, tree) diff --git a/wwpdb/utils/nmr/pk/NmrViewPKLexer.py b/wwpdb/utils/nmr/pk/NmrViewPKLexer.py index 49a809d4..2055a56f 100644 --- a/wwpdb/utils/nmr/pk/NmrViewPKLexer.py +++ b/wwpdb/utils/nmr/pk/NmrViewPKLexer.py @@ -54,125 +54,125 @@ def serializedATN(): 12,42,13,44,14,46,15,48,16,50,17,52,18,54,19,56,20,58,21,60,22,62, 23,64,24,66,25,68,26,70,27,72,28,74,29,76,30,78,31,80,32,82,33,2, 0,1,9,2,0,43,43,45,45,2,0,69,69,101,101,1,0,48,57,2,0,10,10,13,13, - 2,0,65,90,97,122,5,0,35,35,42,43,45,46,63,63,95,95,2,0,34,34,39, - 39,2,0,9,9,32,32,5,0,33,33,35,35,38,38,59,59,92,92,505,0,2,1,0,0, - 0,0,4,1,0,0,0,0,6,1,0,0,0,0,8,1,0,0,0,0,16,1,0,0,0,0,18,1,0,0,0, - 0,20,1,0,0,0,0,22,1,0,0,0,0,34,1,0,0,0,0,36,1,0,0,0,0,38,1,0,0,0, - 0,40,1,0,0,0,0,42,1,0,0,0,1,44,1,0,0,0,1,46,1,0,0,0,1,48,1,0,0,0, - 1,50,1,0,0,0,1,52,1,0,0,0,1,54,1,0,0,0,1,56,1,0,0,0,1,58,1,0,0,0, - 1,60,1,0,0,0,1,62,1,0,0,0,1,64,1,0,0,0,1,66,1,0,0,0,1,68,1,0,0,0, - 1,70,1,0,0,0,1,72,1,0,0,0,1,74,1,0,0,0,1,76,1,0,0,0,1,78,1,0,0,0, - 1,80,1,0,0,0,1,82,1,0,0,0,2,84,1,0,0,0,4,93,1,0,0,0,6,98,1,0,0,0, - 8,105,1,0,0,0,10,124,1,0,0,0,12,126,1,0,0,0,14,129,1,0,0,0,16,134, - 1,0,0,0,18,159,1,0,0,0,20,184,1,0,0,0,22,208,1,0,0,0,24,210,1,0, - 0,0,26,214,1,0,0,0,28,218,1,0,0,0,30,222,1,0,0,0,32,224,1,0,0,0, - 34,232,1,0,0,0,36,239,1,0,0,0,38,243,1,0,0,0,40,293,1,0,0,0,42,330, - 1,0,0,0,44,342,1,0,0,0,46,350,1,0,0,0,48,353,1,0,0,0,50,356,1,0, - 0,0,52,360,1,0,0,0,54,364,1,0,0,0,56,368,1,0,0,0,58,372,1,0,0,0, - 60,376,1,0,0,0,62,380,1,0,0,0,64,384,1,0,0,0,66,388,1,0,0,0,68,392, - 1,0,0,0,70,397,1,0,0,0,72,405,1,0,0,0,74,418,1,0,0,0,76,420,1,0, - 0,0,78,423,1,0,0,0,80,430,1,0,0,0,82,434,1,0,0,0,84,85,5,108,0,0, - 85,86,5,97,0,0,86,87,5,98,0,0,87,88,5,101,0,0,88,89,5,108,0,0,89, - 90,1,0,0,0,90,91,6,0,0,0,91,3,1,0,0,0,92,94,7,0,0,0,93,92,1,0,0, - 0,93,94,1,0,0,0,94,95,1,0,0,0,95,96,3,14,6,0,96,5,1,0,0,0,97,99, - 7,0,0,0,98,97,1,0,0,0,98,99,1,0,0,0,99,102,1,0,0,0,100,103,3,14, - 6,0,101,103,3,10,4,0,102,100,1,0,0,0,102,101,1,0,0,0,103,7,1,0,0, - 0,104,106,7,0,0,0,105,104,1,0,0,0,105,106,1,0,0,0,106,109,1,0,0, - 0,107,110,3,14,6,0,108,110,3,10,4,0,109,107,1,0,0,0,109,108,1,0, - 0,0,110,116,1,0,0,0,111,113,7,1,0,0,112,114,7,0,0,0,113,112,1,0, - 0,0,113,114,1,0,0,0,114,115,1,0,0,0,115,117,3,14,6,0,116,111,1,0, - 0,0,116,117,1,0,0,0,117,9,1,0,0,0,118,119,3,14,6,0,119,120,5,46, - 0,0,120,121,3,14,6,0,121,125,1,0,0,0,122,123,5,46,0,0,123,125,3, - 14,6,0,124,118,1,0,0,0,124,122,1,0,0,0,125,11,1,0,0,0,126,127,7, - 2,0,0,127,13,1,0,0,0,128,130,3,12,5,0,129,128,1,0,0,0,130,131,1, - 0,0,0,131,129,1,0,0,0,131,132,1,0,0,0,132,15,1,0,0,0,133,135,5,35, - 0,0,134,133,1,0,0,0,135,136,1,0,0,0,136,134,1,0,0,0,136,137,1,0, - 0,0,137,141,1,0,0,0,138,140,8,3,0,0,139,138,1,0,0,0,140,143,1,0, - 0,0,141,139,1,0,0,0,141,142,1,0,0,0,142,147,1,0,0,0,143,141,1,0, - 0,0,144,146,5,35,0,0,145,144,1,0,0,0,146,149,1,0,0,0,147,145,1,0, - 0,0,147,148,1,0,0,0,148,153,1,0,0,0,149,147,1,0,0,0,150,152,8,3, - 0,0,151,150,1,0,0,0,152,155,1,0,0,0,153,151,1,0,0,0,153,154,1,0, - 0,0,154,156,1,0,0,0,155,153,1,0,0,0,156,157,6,7,1,0,157,17,1,0,0, - 0,158,160,5,33,0,0,159,158,1,0,0,0,160,161,1,0,0,0,161,159,1,0,0, - 0,161,162,1,0,0,0,162,166,1,0,0,0,163,165,8,3,0,0,164,163,1,0,0, - 0,165,168,1,0,0,0,166,164,1,0,0,0,166,167,1,0,0,0,167,172,1,0,0, - 0,168,166,1,0,0,0,169,171,5,33,0,0,170,169,1,0,0,0,171,174,1,0,0, - 0,172,170,1,0,0,0,172,173,1,0,0,0,173,178,1,0,0,0,174,172,1,0,0, - 0,175,177,8,3,0,0,176,175,1,0,0,0,177,180,1,0,0,0,178,176,1,0,0, - 0,178,179,1,0,0,0,179,181,1,0,0,0,180,178,1,0,0,0,181,182,6,8,1, - 0,182,19,1,0,0,0,183,185,5,59,0,0,184,183,1,0,0,0,185,186,1,0,0, - 0,186,184,1,0,0,0,186,187,1,0,0,0,187,191,1,0,0,0,188,190,8,3,0, - 0,189,188,1,0,0,0,190,193,1,0,0,0,191,189,1,0,0,0,191,192,1,0,0, - 0,192,197,1,0,0,0,193,191,1,0,0,0,194,196,5,59,0,0,195,194,1,0,0, - 0,196,199,1,0,0,0,197,195,1,0,0,0,197,198,1,0,0,0,198,203,1,0,0, - 0,199,197,1,0,0,0,200,202,8,3,0,0,201,200,1,0,0,0,202,205,1,0,0, - 0,203,201,1,0,0,0,203,204,1,0,0,0,204,206,1,0,0,0,205,203,1,0,0, - 0,206,207,6,9,1,0,207,21,1,0,0,0,208,209,3,32,15,0,209,23,1,0,0, - 0,210,211,7,4,0,0,211,25,1,0,0,0,212,215,3,24,11,0,213,215,3,12, - 5,0,214,212,1,0,0,0,214,213,1,0,0,0,215,27,1,0,0,0,216,219,3,26, - 12,0,217,219,7,5,0,0,218,216,1,0,0,0,218,217,1,0,0,0,219,29,1,0, - 0,0,220,223,3,28,13,0,221,223,7,6,0,0,222,220,1,0,0,0,222,221,1, - 0,0,0,223,31,1,0,0,0,224,228,3,28,13,0,225,227,3,30,14,0,226,225, - 1,0,0,0,227,230,1,0,0,0,228,226,1,0,0,0,228,229,1,0,0,0,229,33,1, - 0,0,0,230,228,1,0,0,0,231,233,7,7,0,0,232,231,1,0,0,0,233,234,1, - 0,0,0,234,232,1,0,0,0,234,235,1,0,0,0,235,236,1,0,0,0,236,237,6, - 16,2,0,237,35,1,0,0,0,238,240,7,3,0,0,239,238,1,0,0,0,240,241,1, - 0,0,0,241,239,1,0,0,0,241,242,1,0,0,0,242,37,1,0,0,0,243,247,5,123, - 0,0,244,246,5,32,0,0,245,244,1,0,0,0,246,249,1,0,0,0,247,245,1,0, - 0,0,247,248,1,0,0,0,248,258,1,0,0,0,249,247,1,0,0,0,250,259,3,6, - 2,0,251,254,3,32,15,0,252,254,5,32,0,0,253,251,1,0,0,0,253,252,1, - 0,0,0,254,257,1,0,0,0,255,256,1,0,0,0,255,253,1,0,0,0,256,259,1, - 0,0,0,257,255,1,0,0,0,258,250,1,0,0,0,258,255,1,0,0,0,259,263,1, - 0,0,0,260,262,5,32,0,0,261,260,1,0,0,0,262,265,1,0,0,0,263,261,1, - 0,0,0,263,264,1,0,0,0,264,266,1,0,0,0,265,263,1,0,0,0,266,267,5, - 125,0,0,267,39,1,0,0,0,268,294,7,8,0,0,269,271,5,47,0,0,270,272, - 5,47,0,0,271,270,1,0,0,0,272,273,1,0,0,0,273,271,1,0,0,0,273,274, - 1,0,0,0,274,294,1,0,0,0,275,277,5,42,0,0,276,278,5,42,0,0,277,276, - 1,0,0,0,278,279,1,0,0,0,279,277,1,0,0,0,279,280,1,0,0,0,280,294, - 1,0,0,0,281,283,5,61,0,0,282,284,5,61,0,0,283,282,1,0,0,0,284,285, - 1,0,0,0,285,283,1,0,0,0,285,286,1,0,0,0,286,294,1,0,0,0,287,288, - 5,82,0,0,288,289,5,69,0,0,289,290,5,77,0,0,290,291,5,65,0,0,291, - 292,5,82,0,0,292,294,5,75,0,0,293,268,1,0,0,0,293,269,1,0,0,0,293, - 275,1,0,0,0,293,281,1,0,0,0,293,287,1,0,0,0,294,298,1,0,0,0,295, - 297,5,32,0,0,296,295,1,0,0,0,297,300,1,0,0,0,298,296,1,0,0,0,298, - 299,1,0,0,0,299,301,1,0,0,0,300,298,1,0,0,0,301,302,3,36,17,0,302, - 303,1,0,0,0,303,304,6,19,1,0,304,41,1,0,0,0,305,331,7,8,0,0,306, - 308,5,47,0,0,307,309,5,47,0,0,308,307,1,0,0,0,309,310,1,0,0,0,310, - 308,1,0,0,0,310,311,1,0,0,0,311,331,1,0,0,0,312,314,5,42,0,0,313, - 315,5,42,0,0,314,313,1,0,0,0,315,316,1,0,0,0,316,314,1,0,0,0,316, - 317,1,0,0,0,317,331,1,0,0,0,318,320,5,61,0,0,319,321,5,61,0,0,320, - 319,1,0,0,0,321,322,1,0,0,0,322,320,1,0,0,0,322,323,1,0,0,0,323, - 331,1,0,0,0,324,325,5,82,0,0,325,326,5,69,0,0,326,327,5,77,0,0,327, - 328,5,65,0,0,328,329,5,82,0,0,329,331,5,75,0,0,330,305,1,0,0,0,330, - 306,1,0,0,0,330,312,1,0,0,0,330,318,1,0,0,0,330,324,1,0,0,0,331, - 335,1,0,0,0,332,334,8,3,0,0,333,332,1,0,0,0,334,337,1,0,0,0,335, - 333,1,0,0,0,335,336,1,0,0,0,336,338,1,0,0,0,337,335,1,0,0,0,338, - 339,3,36,17,0,339,340,1,0,0,0,340,341,6,20,1,0,341,43,1,0,0,0,342, - 343,5,100,0,0,343,344,5,97,0,0,344,345,5,116,0,0,345,346,5,97,0, - 0,346,347,5,115,0,0,347,348,5,101,0,0,348,349,5,116,0,0,349,45,1, - 0,0,0,350,351,5,115,0,0,351,352,5,119,0,0,352,47,1,0,0,0,353,354, - 5,115,0,0,354,355,5,102,0,0,355,49,1,0,0,0,356,357,3,22,10,0,357, - 358,5,46,0,0,358,359,5,76,0,0,359,51,1,0,0,0,360,361,3,22,10,0,361, - 362,5,46,0,0,362,363,5,80,0,0,363,53,1,0,0,0,364,365,3,22,10,0,365, - 366,5,46,0,0,366,367,5,87,0,0,367,55,1,0,0,0,368,369,3,22,10,0,369, - 370,5,46,0,0,370,371,5,66,0,0,371,57,1,0,0,0,372,373,3,22,10,0,373, - 374,5,46,0,0,374,375,5,69,0,0,375,59,1,0,0,0,376,377,3,22,10,0,377, - 378,5,46,0,0,378,379,5,74,0,0,379,61,1,0,0,0,380,381,3,22,10,0,381, - 382,5,46,0,0,382,383,5,85,0,0,383,63,1,0,0,0,384,385,5,118,0,0,385, - 386,5,111,0,0,386,387,5,108,0,0,387,65,1,0,0,0,388,389,5,105,0,0, - 389,390,5,110,0,0,390,391,5,116,0,0,391,67,1,0,0,0,392,393,5,115, - 0,0,393,394,5,116,0,0,394,395,5,97,0,0,395,396,5,116,0,0,396,69, - 1,0,0,0,397,398,5,99,0,0,398,399,5,111,0,0,399,400,5,109,0,0,400, - 401,5,109,0,0,401,402,5,101,0,0,402,403,5,110,0,0,403,404,5,116, - 0,0,404,71,1,0,0,0,405,406,5,102,0,0,406,407,5,108,0,0,407,408,5, - 97,0,0,408,409,5,103,0,0,409,410,5,48,0,0,410,412,1,0,0,0,411,413, - 7,3,0,0,412,411,1,0,0,0,413,414,1,0,0,0,414,412,1,0,0,0,414,415, - 1,0,0,0,415,416,1,0,0,0,416,417,6,35,3,0,417,73,1,0,0,0,418,419, - 3,32,15,0,419,75,1,0,0,0,420,421,3,6,2,0,421,77,1,0,0,0,422,424, - 7,7,0,0,423,422,1,0,0,0,424,425,1,0,0,0,425,423,1,0,0,0,425,426, - 1,0,0,0,426,427,1,0,0,0,427,428,6,38,2,0,428,79,1,0,0,0,429,431, - 7,3,0,0,430,429,1,0,0,0,431,432,1,0,0,0,432,430,1,0,0,0,432,433, - 1,0,0,0,433,81,1,0,0,0,434,438,5,123,0,0,435,437,5,32,0,0,436,435, + 2,0,65,90,97,122,4,0,42,43,45,46,63,63,95,95,2,0,34,34,39,39,2,0, + 9,9,32,32,5,0,33,33,35,35,38,38,59,59,92,92,505,0,2,1,0,0,0,0,4, + 1,0,0,0,0,6,1,0,0,0,0,8,1,0,0,0,0,16,1,0,0,0,0,18,1,0,0,0,0,20,1, + 0,0,0,0,22,1,0,0,0,0,34,1,0,0,0,0,36,1,0,0,0,0,38,1,0,0,0,0,40,1, + 0,0,0,0,42,1,0,0,0,1,44,1,0,0,0,1,46,1,0,0,0,1,48,1,0,0,0,1,50,1, + 0,0,0,1,52,1,0,0,0,1,54,1,0,0,0,1,56,1,0,0,0,1,58,1,0,0,0,1,60,1, + 0,0,0,1,62,1,0,0,0,1,64,1,0,0,0,1,66,1,0,0,0,1,68,1,0,0,0,1,70,1, + 0,0,0,1,72,1,0,0,0,1,74,1,0,0,0,1,76,1,0,0,0,1,78,1,0,0,0,1,80,1, + 0,0,0,1,82,1,0,0,0,2,84,1,0,0,0,4,93,1,0,0,0,6,98,1,0,0,0,8,105, + 1,0,0,0,10,124,1,0,0,0,12,126,1,0,0,0,14,129,1,0,0,0,16,134,1,0, + 0,0,18,159,1,0,0,0,20,184,1,0,0,0,22,208,1,0,0,0,24,210,1,0,0,0, + 26,214,1,0,0,0,28,218,1,0,0,0,30,222,1,0,0,0,32,224,1,0,0,0,34,232, + 1,0,0,0,36,239,1,0,0,0,38,243,1,0,0,0,40,293,1,0,0,0,42,330,1,0, + 0,0,44,342,1,0,0,0,46,350,1,0,0,0,48,353,1,0,0,0,50,356,1,0,0,0, + 52,360,1,0,0,0,54,364,1,0,0,0,56,368,1,0,0,0,58,372,1,0,0,0,60,376, + 1,0,0,0,62,380,1,0,0,0,64,384,1,0,0,0,66,388,1,0,0,0,68,392,1,0, + 0,0,70,397,1,0,0,0,72,405,1,0,0,0,74,418,1,0,0,0,76,420,1,0,0,0, + 78,423,1,0,0,0,80,430,1,0,0,0,82,434,1,0,0,0,84,85,5,108,0,0,85, + 86,5,97,0,0,86,87,5,98,0,0,87,88,5,101,0,0,88,89,5,108,0,0,89,90, + 1,0,0,0,90,91,6,0,0,0,91,3,1,0,0,0,92,94,7,0,0,0,93,92,1,0,0,0,93, + 94,1,0,0,0,94,95,1,0,0,0,95,96,3,14,6,0,96,5,1,0,0,0,97,99,7,0,0, + 0,98,97,1,0,0,0,98,99,1,0,0,0,99,102,1,0,0,0,100,103,3,14,6,0,101, + 103,3,10,4,0,102,100,1,0,0,0,102,101,1,0,0,0,103,7,1,0,0,0,104,106, + 7,0,0,0,105,104,1,0,0,0,105,106,1,0,0,0,106,109,1,0,0,0,107,110, + 3,14,6,0,108,110,3,10,4,0,109,107,1,0,0,0,109,108,1,0,0,0,110,116, + 1,0,0,0,111,113,7,1,0,0,112,114,7,0,0,0,113,112,1,0,0,0,113,114, + 1,0,0,0,114,115,1,0,0,0,115,117,3,14,6,0,116,111,1,0,0,0,116,117, + 1,0,0,0,117,9,1,0,0,0,118,119,3,14,6,0,119,120,5,46,0,0,120,121, + 3,14,6,0,121,125,1,0,0,0,122,123,5,46,0,0,123,125,3,14,6,0,124,118, + 1,0,0,0,124,122,1,0,0,0,125,11,1,0,0,0,126,127,7,2,0,0,127,13,1, + 0,0,0,128,130,3,12,5,0,129,128,1,0,0,0,130,131,1,0,0,0,131,129,1, + 0,0,0,131,132,1,0,0,0,132,15,1,0,0,0,133,135,5,35,0,0,134,133,1, + 0,0,0,135,136,1,0,0,0,136,134,1,0,0,0,136,137,1,0,0,0,137,141,1, + 0,0,0,138,140,8,3,0,0,139,138,1,0,0,0,140,143,1,0,0,0,141,139,1, + 0,0,0,141,142,1,0,0,0,142,147,1,0,0,0,143,141,1,0,0,0,144,146,5, + 35,0,0,145,144,1,0,0,0,146,149,1,0,0,0,147,145,1,0,0,0,147,148,1, + 0,0,0,148,153,1,0,0,0,149,147,1,0,0,0,150,152,8,3,0,0,151,150,1, + 0,0,0,152,155,1,0,0,0,153,151,1,0,0,0,153,154,1,0,0,0,154,156,1, + 0,0,0,155,153,1,0,0,0,156,157,6,7,1,0,157,17,1,0,0,0,158,160,5,33, + 0,0,159,158,1,0,0,0,160,161,1,0,0,0,161,159,1,0,0,0,161,162,1,0, + 0,0,162,166,1,0,0,0,163,165,8,3,0,0,164,163,1,0,0,0,165,168,1,0, + 0,0,166,164,1,0,0,0,166,167,1,0,0,0,167,172,1,0,0,0,168,166,1,0, + 0,0,169,171,5,33,0,0,170,169,1,0,0,0,171,174,1,0,0,0,172,170,1,0, + 0,0,172,173,1,0,0,0,173,178,1,0,0,0,174,172,1,0,0,0,175,177,8,3, + 0,0,176,175,1,0,0,0,177,180,1,0,0,0,178,176,1,0,0,0,178,179,1,0, + 0,0,179,181,1,0,0,0,180,178,1,0,0,0,181,182,6,8,1,0,182,19,1,0,0, + 0,183,185,5,59,0,0,184,183,1,0,0,0,185,186,1,0,0,0,186,184,1,0,0, + 0,186,187,1,0,0,0,187,191,1,0,0,0,188,190,8,3,0,0,189,188,1,0,0, + 0,190,193,1,0,0,0,191,189,1,0,0,0,191,192,1,0,0,0,192,197,1,0,0, + 0,193,191,1,0,0,0,194,196,5,59,0,0,195,194,1,0,0,0,196,199,1,0,0, + 0,197,195,1,0,0,0,197,198,1,0,0,0,198,203,1,0,0,0,199,197,1,0,0, + 0,200,202,8,3,0,0,201,200,1,0,0,0,202,205,1,0,0,0,203,201,1,0,0, + 0,203,204,1,0,0,0,204,206,1,0,0,0,205,203,1,0,0,0,206,207,6,9,1, + 0,207,21,1,0,0,0,208,209,3,32,15,0,209,23,1,0,0,0,210,211,7,4,0, + 0,211,25,1,0,0,0,212,215,3,24,11,0,213,215,3,12,5,0,214,212,1,0, + 0,0,214,213,1,0,0,0,215,27,1,0,0,0,216,219,3,26,12,0,217,219,7,5, + 0,0,218,216,1,0,0,0,218,217,1,0,0,0,219,29,1,0,0,0,220,223,3,28, + 13,0,221,223,7,6,0,0,222,220,1,0,0,0,222,221,1,0,0,0,223,31,1,0, + 0,0,224,228,3,28,13,0,225,227,3,30,14,0,226,225,1,0,0,0,227,230, + 1,0,0,0,228,226,1,0,0,0,228,229,1,0,0,0,229,33,1,0,0,0,230,228,1, + 0,0,0,231,233,7,7,0,0,232,231,1,0,0,0,233,234,1,0,0,0,234,232,1, + 0,0,0,234,235,1,0,0,0,235,236,1,0,0,0,236,237,6,16,2,0,237,35,1, + 0,0,0,238,240,7,3,0,0,239,238,1,0,0,0,240,241,1,0,0,0,241,239,1, + 0,0,0,241,242,1,0,0,0,242,37,1,0,0,0,243,247,5,123,0,0,244,246,5, + 32,0,0,245,244,1,0,0,0,246,249,1,0,0,0,247,245,1,0,0,0,247,248,1, + 0,0,0,248,258,1,0,0,0,249,247,1,0,0,0,250,259,3,6,2,0,251,254,3, + 32,15,0,252,254,5,32,0,0,253,251,1,0,0,0,253,252,1,0,0,0,254,257, + 1,0,0,0,255,256,1,0,0,0,255,253,1,0,0,0,256,259,1,0,0,0,257,255, + 1,0,0,0,258,250,1,0,0,0,258,255,1,0,0,0,259,263,1,0,0,0,260,262, + 5,32,0,0,261,260,1,0,0,0,262,265,1,0,0,0,263,261,1,0,0,0,263,264, + 1,0,0,0,264,266,1,0,0,0,265,263,1,0,0,0,266,267,5,125,0,0,267,39, + 1,0,0,0,268,294,7,8,0,0,269,271,5,47,0,0,270,272,5,47,0,0,271,270, + 1,0,0,0,272,273,1,0,0,0,273,271,1,0,0,0,273,274,1,0,0,0,274,294, + 1,0,0,0,275,277,5,42,0,0,276,278,5,42,0,0,277,276,1,0,0,0,278,279, + 1,0,0,0,279,277,1,0,0,0,279,280,1,0,0,0,280,294,1,0,0,0,281,283, + 5,61,0,0,282,284,5,61,0,0,283,282,1,0,0,0,284,285,1,0,0,0,285,283, + 1,0,0,0,285,286,1,0,0,0,286,294,1,0,0,0,287,288,5,82,0,0,288,289, + 5,69,0,0,289,290,5,77,0,0,290,291,5,65,0,0,291,292,5,82,0,0,292, + 294,5,75,0,0,293,268,1,0,0,0,293,269,1,0,0,0,293,275,1,0,0,0,293, + 281,1,0,0,0,293,287,1,0,0,0,294,298,1,0,0,0,295,297,5,32,0,0,296, + 295,1,0,0,0,297,300,1,0,0,0,298,296,1,0,0,0,298,299,1,0,0,0,299, + 301,1,0,0,0,300,298,1,0,0,0,301,302,3,36,17,0,302,303,1,0,0,0,303, + 304,6,19,1,0,304,41,1,0,0,0,305,331,7,8,0,0,306,308,5,47,0,0,307, + 309,5,47,0,0,308,307,1,0,0,0,309,310,1,0,0,0,310,308,1,0,0,0,310, + 311,1,0,0,0,311,331,1,0,0,0,312,314,5,42,0,0,313,315,5,42,0,0,314, + 313,1,0,0,0,315,316,1,0,0,0,316,314,1,0,0,0,316,317,1,0,0,0,317, + 331,1,0,0,0,318,320,5,61,0,0,319,321,5,61,0,0,320,319,1,0,0,0,321, + 322,1,0,0,0,322,320,1,0,0,0,322,323,1,0,0,0,323,331,1,0,0,0,324, + 325,5,82,0,0,325,326,5,69,0,0,326,327,5,77,0,0,327,328,5,65,0,0, + 328,329,5,82,0,0,329,331,5,75,0,0,330,305,1,0,0,0,330,306,1,0,0, + 0,330,312,1,0,0,0,330,318,1,0,0,0,330,324,1,0,0,0,331,335,1,0,0, + 0,332,334,8,3,0,0,333,332,1,0,0,0,334,337,1,0,0,0,335,333,1,0,0, + 0,335,336,1,0,0,0,336,338,1,0,0,0,337,335,1,0,0,0,338,339,3,36,17, + 0,339,340,1,0,0,0,340,341,6,20,1,0,341,43,1,0,0,0,342,343,5,100, + 0,0,343,344,5,97,0,0,344,345,5,116,0,0,345,346,5,97,0,0,346,347, + 5,115,0,0,347,348,5,101,0,0,348,349,5,116,0,0,349,45,1,0,0,0,350, + 351,5,115,0,0,351,352,5,119,0,0,352,47,1,0,0,0,353,354,5,115,0,0, + 354,355,5,102,0,0,355,49,1,0,0,0,356,357,3,22,10,0,357,358,5,46, + 0,0,358,359,5,76,0,0,359,51,1,0,0,0,360,361,3,22,10,0,361,362,5, + 46,0,0,362,363,5,80,0,0,363,53,1,0,0,0,364,365,3,22,10,0,365,366, + 5,46,0,0,366,367,5,87,0,0,367,55,1,0,0,0,368,369,3,22,10,0,369,370, + 5,46,0,0,370,371,5,66,0,0,371,57,1,0,0,0,372,373,3,22,10,0,373,374, + 5,46,0,0,374,375,5,69,0,0,375,59,1,0,0,0,376,377,3,22,10,0,377,378, + 5,46,0,0,378,379,5,74,0,0,379,61,1,0,0,0,380,381,3,22,10,0,381,382, + 5,46,0,0,382,383,5,85,0,0,383,63,1,0,0,0,384,385,5,118,0,0,385,386, + 5,111,0,0,386,387,5,108,0,0,387,65,1,0,0,0,388,389,5,105,0,0,389, + 390,5,110,0,0,390,391,5,116,0,0,391,67,1,0,0,0,392,393,5,115,0,0, + 393,394,5,116,0,0,394,395,5,97,0,0,395,396,5,116,0,0,396,69,1,0, + 0,0,397,398,5,99,0,0,398,399,5,111,0,0,399,400,5,109,0,0,400,401, + 5,109,0,0,401,402,5,101,0,0,402,403,5,110,0,0,403,404,5,116,0,0, + 404,71,1,0,0,0,405,406,5,102,0,0,406,407,5,108,0,0,407,408,5,97, + 0,0,408,409,5,103,0,0,409,410,5,48,0,0,410,412,1,0,0,0,411,413,7, + 3,0,0,412,411,1,0,0,0,413,414,1,0,0,0,414,412,1,0,0,0,414,415,1, + 0,0,0,415,416,1,0,0,0,416,417,6,35,3,0,417,73,1,0,0,0,418,419,3, + 32,15,0,419,75,1,0,0,0,420,421,3,6,2,0,421,77,1,0,0,0,422,424,7, + 7,0,0,423,422,1,0,0,0,424,425,1,0,0,0,425,423,1,0,0,0,425,426,1, + 0,0,0,426,427,1,0,0,0,427,428,6,38,2,0,428,79,1,0,0,0,429,431,7, + 3,0,0,430,429,1,0,0,0,431,432,1,0,0,0,432,430,1,0,0,0,432,433,1, + 0,0,0,433,81,1,0,0,0,434,438,5,123,0,0,435,437,5,32,0,0,436,435, 1,0,0,0,437,440,1,0,0,0,438,436,1,0,0,0,438,439,1,0,0,0,439,449, 1,0,0,0,440,438,1,0,0,0,441,450,3,6,2,0,442,445,3,32,15,0,443,445, 5,32,0,0,444,442,1,0,0,0,444,443,1,0,0,0,445,448,1,0,0,0,446,447, diff --git a/wwpdb/utils/nmr/pk/NmrViewPKParser.py b/wwpdb/utils/nmr/pk/NmrViewPKParser.py index 10750d6c..267526ca 100644 --- a/wwpdb/utils/nmr/pk/NmrViewPKParser.py +++ b/wwpdb/utils/nmr/pk/NmrViewPKParser.py @@ -10,148 +10,151 @@ def serializedATN(): return [ - 4,1,33,420,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 4,1,33,427,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, - 2,14,7,14,2,15,7,15,1,0,1,0,1,0,1,0,1,0,1,0,1,0,5,0,40,8,0,10,0, - 12,0,43,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,55,8,1,11, - 1,12,1,56,1,1,1,1,1,1,1,1,1,1,1,1,1,2,4,2,66,8,2,11,2,12,2,67,1, - 3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1, - 3,1,3,3,3,88,8,3,1,3,1,3,3,3,92,8,3,1,3,4,3,95,8,3,11,3,12,3,96, - 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, - 1,4,1,4,1,4,3,4,118,8,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5, + 2,14,7,14,2,15,7,15,2,16,7,16,1,0,3,0,36,8,0,1,0,1,0,1,0,1,0,1,0, + 1,0,1,0,5,0,45,8,0,10,0,12,0,48,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1, + 1,1,1,1,1,1,4,1,60,8,1,11,1,12,1,61,1,1,1,1,1,1,1,1,1,1,1,1,1,2, + 4,2,71,8,2,11,2,12,2,72,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, + 1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,93,8,3,1,3,1,3,3,3,97,8,3,1, + 3,4,3,100,8,3,11,3,12,3,101,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4, + 1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,3,4,123,8,4,1,4,1,4,1,4, 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5, - 1,5,1,5,3,5,148,8,5,1,5,1,5,3,5,152,8,5,1,5,4,5,155,8,5,11,5,12, - 5,156,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1, - 6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,3,6,185,8,6,1,6,1, - 6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,153,8,5,1,5,1,5,3,5,157, + 8,5,1,5,4,5,160,8,5,11,5,12,5,161,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1, + 6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1, + 6,1,6,1,6,3,6,190,8,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, 7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1, - 7,1,7,3,7,222,8,7,1,7,1,7,3,7,226,8,7,1,7,4,7,229,8,7,11,7,12,7, - 230,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, + 7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,3,7,227,8,7,1,7,1,7,3,7,231,8, + 7,1,7,4,7,234,8,7,11,7,12,7,235,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, - 1,8,1,8,3,8,266,8,8,1,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9, - 1,9,1,9,1,9,1,9,3,9,283,8,9,1,9,1,9,3,9,287,8,9,1,9,4,9,290,8,9, - 11,9,12,9,291,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10, - 1,10,1,10,1,10,3,10,307,8,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11, - 1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,3,11, - 328,8,11,1,11,1,11,3,11,332,8,11,1,11,4,11,335,8,11,11,11,12,11, - 336,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12, - 1,12,1,12,1,12,1,12,1,12,3,12,356,8,12,1,12,1,12,1,12,1,13,1,13, - 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, - 1,13,1,13,1,13,1,13,1,13,3,13,381,8,13,1,13,1,13,3,13,385,8,13,1, - 13,4,13,388,8,13,11,13,12,13,389,1,14,1,14,1,14,1,14,1,14,1,14,1, - 14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1, - 14,1,14,3,14,413,8,14,1,14,1,14,1,14,1,15,1,15,1,15,0,0,16,0,2,4, - 6,8,10,12,14,16,18,20,22,24,26,28,30,0,1,2,0,29,30,33,33,436,0,41, - 1,0,0,0,2,46,1,0,0,0,4,65,1,0,0,0,6,69,1,0,0,0,8,98,1,0,0,0,10,122, - 1,0,0,0,12,158,1,0,0,0,14,189,1,0,0,0,16,232,1,0,0,0,18,270,1,0, - 0,0,20,293,1,0,0,0,22,311,1,0,0,0,24,338,1,0,0,0,26,360,1,0,0,0, - 28,391,1,0,0,0,30,417,1,0,0,0,32,40,3,2,1,0,33,40,3,6,3,0,34,40, - 3,10,5,0,35,40,3,14,7,0,36,40,3,18,9,0,37,40,3,22,11,0,38,40,3,26, - 13,0,39,32,1,0,0,0,39,33,1,0,0,0,39,34,1,0,0,0,39,35,1,0,0,0,39, - 36,1,0,0,0,39,37,1,0,0,0,39,38,1,0,0,0,40,43,1,0,0,0,41,39,1,0,0, - 0,41,42,1,0,0,0,42,44,1,0,0,0,43,41,1,0,0,0,44,45,5,0,0,1,45,1,1, - 0,0,0,46,47,5,1,0,0,47,48,5,14,0,0,48,49,5,15,0,0,49,50,5,16,0,0, - 50,51,5,32,0,0,51,52,3,4,2,0,52,54,5,32,0,0,53,55,5,29,0,0,54,53, - 1,0,0,0,55,56,1,0,0,0,56,54,1,0,0,0,56,57,1,0,0,0,57,58,1,0,0,0, - 58,59,5,32,0,0,59,60,3,4,2,0,60,61,5,32,0,0,61,62,3,4,2,0,62,63, - 5,32,0,0,63,3,1,0,0,0,64,66,3,30,15,0,65,64,1,0,0,0,66,67,1,0,0, - 0,67,65,1,0,0,0,67,68,1,0,0,0,68,5,1,0,0,0,69,70,5,17,0,0,70,71, - 5,18,0,0,71,72,5,19,0,0,72,73,5,20,0,0,73,74,5,21,0,0,74,75,5,22, - 0,0,75,76,5,23,0,0,76,77,5,17,0,0,77,78,5,18,0,0,78,79,5,19,0,0, - 79,80,5,20,0,0,80,81,5,21,0,0,81,82,5,22,0,0,82,83,5,23,0,0,83,84, - 5,24,0,0,84,85,5,25,0,0,85,87,5,26,0,0,86,88,5,27,0,0,87,86,1,0, - 0,0,87,88,1,0,0,0,88,89,1,0,0,0,89,91,5,28,0,0,90,92,5,10,0,0,91, - 90,1,0,0,0,91,92,1,0,0,0,92,94,1,0,0,0,93,95,3,8,4,0,94,93,1,0,0, - 0,95,96,1,0,0,0,96,94,1,0,0,0,96,97,1,0,0,0,97,7,1,0,0,0,98,99,5, - 2,0,0,99,100,5,11,0,0,100,101,5,3,0,0,101,102,5,3,0,0,102,103,5, - 3,0,0,103,104,5,8,0,0,104,105,5,11,0,0,105,106,5,11,0,0,106,107, - 5,11,0,0,107,108,5,3,0,0,108,109,5,3,0,0,109,110,5,3,0,0,110,111, - 5,8,0,0,111,112,5,11,0,0,112,113,5,11,0,0,113,114,5,3,0,0,114,115, - 5,3,0,0,115,117,5,2,0,0,116,118,5,11,0,0,117,116,1,0,0,0,117,118, - 1,0,0,0,118,119,1,0,0,0,119,120,5,2,0,0,120,121,5,10,0,0,121,9,1, - 0,0,0,122,123,5,17,0,0,123,124,5,18,0,0,124,125,5,19,0,0,125,126, - 5,20,0,0,126,127,5,21,0,0,127,128,5,22,0,0,128,129,5,23,0,0,129, - 130,5,17,0,0,130,131,5,18,0,0,131,132,5,19,0,0,132,133,5,20,0,0, - 133,134,5,21,0,0,134,135,5,22,0,0,135,136,5,23,0,0,136,137,5,17, - 0,0,137,138,5,18,0,0,138,139,5,19,0,0,139,140,5,20,0,0,140,141,5, - 21,0,0,141,142,5,22,0,0,142,143,5,23,0,0,143,144,5,24,0,0,144,145, - 5,25,0,0,145,147,5,26,0,0,146,148,5,27,0,0,147,146,1,0,0,0,147,148, - 1,0,0,0,148,149,1,0,0,0,149,151,5,28,0,0,150,152,5,10,0,0,151,150, - 1,0,0,0,151,152,1,0,0,0,152,154,1,0,0,0,153,155,3,12,6,0,154,153, - 1,0,0,0,155,156,1,0,0,0,156,154,1,0,0,0,156,157,1,0,0,0,157,11,1, - 0,0,0,158,159,5,2,0,0,159,160,5,11,0,0,160,161,5,3,0,0,161,162,5, - 3,0,0,162,163,5,3,0,0,163,164,5,8,0,0,164,165,5,11,0,0,165,166,5, - 11,0,0,166,167,5,11,0,0,167,168,5,3,0,0,168,169,5,3,0,0,169,170, - 5,3,0,0,170,171,5,8,0,0,171,172,5,11,0,0,172,173,5,11,0,0,173,174, - 5,11,0,0,174,175,5,3,0,0,175,176,5,3,0,0,176,177,5,3,0,0,177,178, - 5,8,0,0,178,179,5,11,0,0,179,180,5,11,0,0,180,181,5,3,0,0,181,182, - 5,3,0,0,182,184,5,2,0,0,183,185,5,11,0,0,184,183,1,0,0,0,184,185, - 1,0,0,0,185,186,1,0,0,0,186,187,5,2,0,0,187,188,5,10,0,0,188,13, - 1,0,0,0,189,190,5,17,0,0,190,191,5,18,0,0,191,192,5,19,0,0,192,193, - 5,20,0,0,193,194,5,21,0,0,194,195,5,22,0,0,195,196,5,23,0,0,196, - 197,5,17,0,0,197,198,5,18,0,0,198,199,5,19,0,0,199,200,5,20,0,0, - 200,201,5,21,0,0,201,202,5,22,0,0,202,203,5,23,0,0,203,204,5,17, - 0,0,204,205,5,18,0,0,205,206,5,19,0,0,206,207,5,20,0,0,207,208,5, - 21,0,0,208,209,5,22,0,0,209,210,5,23,0,0,210,211,5,17,0,0,211,212, - 5,18,0,0,212,213,5,19,0,0,213,214,5,20,0,0,214,215,5,21,0,0,215, - 216,5,22,0,0,216,217,5,23,0,0,217,218,5,24,0,0,218,219,5,25,0,0, - 219,221,5,26,0,0,220,222,5,27,0,0,221,220,1,0,0,0,221,222,1,0,0, - 0,222,223,1,0,0,0,223,225,5,28,0,0,224,226,5,10,0,0,225,224,1,0, - 0,0,225,226,1,0,0,0,226,228,1,0,0,0,227,229,3,16,8,0,228,227,1,0, - 0,0,229,230,1,0,0,0,230,228,1,0,0,0,230,231,1,0,0,0,231,15,1,0,0, - 0,232,233,5,2,0,0,233,234,5,11,0,0,234,235,5,3,0,0,235,236,5,3,0, - 0,236,237,5,3,0,0,237,238,5,8,0,0,238,239,5,11,0,0,239,240,5,11, - 0,0,240,241,5,11,0,0,241,242,5,3,0,0,242,243,5,3,0,0,243,244,5,3, - 0,0,244,245,5,8,0,0,245,246,5,11,0,0,246,247,5,11,0,0,247,248,5, - 11,0,0,248,249,5,3,0,0,249,250,5,3,0,0,250,251,5,3,0,0,251,252,5, - 8,0,0,252,253,5,11,0,0,253,254,5,11,0,0,254,255,5,11,0,0,255,256, - 5,3,0,0,256,257,5,3,0,0,257,258,5,3,0,0,258,259,5,8,0,0,259,260, - 5,11,0,0,260,261,5,11,0,0,261,262,5,3,0,0,262,263,5,3,0,0,263,265, - 5,2,0,0,264,266,5,11,0,0,265,264,1,0,0,0,265,266,1,0,0,0,266,267, - 1,0,0,0,267,268,5,2,0,0,268,269,5,10,0,0,269,17,1,0,0,0,270,271, - 5,17,0,0,271,272,5,18,0,0,272,273,5,19,0,0,273,274,5,20,0,0,274, - 275,5,17,0,0,275,276,5,18,0,0,276,277,5,19,0,0,277,278,5,20,0,0, - 278,279,5,24,0,0,279,280,5,25,0,0,280,282,5,26,0,0,281,283,5,27, - 0,0,282,281,1,0,0,0,282,283,1,0,0,0,283,284,1,0,0,0,284,286,5,28, - 0,0,285,287,5,10,0,0,286,285,1,0,0,0,286,287,1,0,0,0,287,289,1,0, - 0,0,288,290,3,20,10,0,289,288,1,0,0,0,290,291,1,0,0,0,291,289,1, - 0,0,0,291,292,1,0,0,0,292,19,1,0,0,0,293,294,5,2,0,0,294,295,5,11, - 0,0,295,296,5,3,0,0,296,297,5,3,0,0,297,298,5,3,0,0,298,299,5,11, - 0,0,299,300,5,3,0,0,300,301,5,3,0,0,301,302,5,3,0,0,302,303,5,3, - 0,0,303,304,5,3,0,0,304,306,5,2,0,0,305,307,5,11,0,0,306,305,1,0, - 0,0,306,307,1,0,0,0,307,308,1,0,0,0,308,309,5,2,0,0,309,310,5,10, - 0,0,310,21,1,0,0,0,311,312,5,17,0,0,312,313,5,18,0,0,313,314,5,19, - 0,0,314,315,5,20,0,0,315,316,5,17,0,0,316,317,5,18,0,0,317,318,5, - 19,0,0,318,319,5,20,0,0,319,320,5,17,0,0,320,321,5,18,0,0,321,322, - 5,19,0,0,322,323,5,20,0,0,323,324,5,24,0,0,324,325,5,25,0,0,325, - 327,5,26,0,0,326,328,5,27,0,0,327,326,1,0,0,0,327,328,1,0,0,0,328, - 329,1,0,0,0,329,331,5,28,0,0,330,332,5,10,0,0,331,330,1,0,0,0,331, - 332,1,0,0,0,332,334,1,0,0,0,333,335,3,24,12,0,334,333,1,0,0,0,335, - 336,1,0,0,0,336,334,1,0,0,0,336,337,1,0,0,0,337,23,1,0,0,0,338,339, - 5,2,0,0,339,340,5,11,0,0,340,341,5,3,0,0,341,342,5,3,0,0,342,343, - 5,3,0,0,343,344,5,11,0,0,344,345,5,3,0,0,345,346,5,3,0,0,346,347, - 5,3,0,0,347,348,5,11,0,0,348,349,5,3,0,0,349,350,5,3,0,0,350,351, - 5,3,0,0,351,352,5,3,0,0,352,353,5,3,0,0,353,355,5,2,0,0,354,356, - 5,11,0,0,355,354,1,0,0,0,355,356,1,0,0,0,356,357,1,0,0,0,357,358, - 5,2,0,0,358,359,5,10,0,0,359,25,1,0,0,0,360,361,5,17,0,0,361,362, - 5,18,0,0,362,363,5,19,0,0,363,364,5,20,0,0,364,365,5,17,0,0,365, - 366,5,18,0,0,366,367,5,19,0,0,367,368,5,20,0,0,368,369,5,17,0,0, - 369,370,5,18,0,0,370,371,5,19,0,0,371,372,5,20,0,0,372,373,5,17, - 0,0,373,374,5,18,0,0,374,375,5,19,0,0,375,376,5,20,0,0,376,377,5, - 24,0,0,377,378,5,25,0,0,378,380,5,26,0,0,379,381,5,27,0,0,380,379, - 1,0,0,0,380,381,1,0,0,0,381,382,1,0,0,0,382,384,5,28,0,0,383,385, - 5,10,0,0,384,383,1,0,0,0,384,385,1,0,0,0,385,387,1,0,0,0,386,388, - 3,28,14,0,387,386,1,0,0,0,388,389,1,0,0,0,389,387,1,0,0,0,389,390, - 1,0,0,0,390,27,1,0,0,0,391,392,5,2,0,0,392,393,5,11,0,0,393,394, - 5,3,0,0,394,395,5,3,0,0,395,396,5,3,0,0,396,397,5,11,0,0,397,398, - 5,3,0,0,398,399,5,3,0,0,399,400,5,3,0,0,400,401,5,11,0,0,401,402, - 5,3,0,0,402,403,5,3,0,0,403,404,5,3,0,0,404,405,5,11,0,0,405,406, - 5,3,0,0,406,407,5,3,0,0,407,408,5,3,0,0,408,409,5,3,0,0,409,410, - 5,3,0,0,410,412,5,2,0,0,411,413,5,11,0,0,412,411,1,0,0,0,412,413, - 1,0,0,0,413,414,1,0,0,0,414,415,5,2,0,0,415,416,5,10,0,0,416,29, - 1,0,0,0,417,418,7,0,0,0,418,31,1,0,0,0,28,39,41,56,67,87,91,96,117, - 147,151,156,184,221,225,230,265,282,286,291,306,327,331,336,355, - 380,384,389,412 + 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,3,8,271,8,8,1,8,1,8,1,8,1,9, + 1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,3,9,288,8,9,1,9,1,9, + 3,9,292,8,9,1,9,4,9,295,8,9,11,9,12,9,296,1,10,1,10,1,10,1,10,1, + 10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,3,10,312,8,10,1,10,1, + 10,1,10,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1,11,1, + 11,1,11,1,11,1,11,1,11,3,11,333,8,11,1,11,1,11,3,11,337,8,11,1,11, + 4,11,340,8,11,11,11,12,11,341,1,12,1,12,1,12,1,12,1,12,1,12,1,12, + 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,3,12,361,8,12, + 1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13, + 1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,3,13,386,8,13, + 1,13,1,13,3,13,390,8,13,1,13,4,13,393,8,13,11,13,12,13,394,1,14, + 1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14,1,14, + 1,14,1,14,1,14,1,14,1,14,1,14,1,14,3,14,418,8,14,1,14,1,14,1,14, + 1,15,1,15,1,16,1,16,1,16,0,0,17,0,2,4,6,8,10,12,14,16,18,20,22,24, + 26,28,30,32,0,2,2,0,29,30,33,33,3,0,3,3,8,8,11,11,443,0,35,1,0,0, + 0,2,51,1,0,0,0,4,70,1,0,0,0,6,74,1,0,0,0,8,103,1,0,0,0,10,127,1, + 0,0,0,12,163,1,0,0,0,14,194,1,0,0,0,16,237,1,0,0,0,18,275,1,0,0, + 0,20,298,1,0,0,0,22,316,1,0,0,0,24,343,1,0,0,0,26,365,1,0,0,0,28, + 396,1,0,0,0,30,422,1,0,0,0,32,424,1,0,0,0,34,36,5,10,0,0,35,34,1, + 0,0,0,35,36,1,0,0,0,36,46,1,0,0,0,37,45,3,2,1,0,38,45,3,6,3,0,39, + 45,3,10,5,0,40,45,3,14,7,0,41,45,3,18,9,0,42,45,3,22,11,0,43,45, + 3,26,13,0,44,37,1,0,0,0,44,38,1,0,0,0,44,39,1,0,0,0,44,40,1,0,0, + 0,44,41,1,0,0,0,44,42,1,0,0,0,44,43,1,0,0,0,45,48,1,0,0,0,46,44, + 1,0,0,0,46,47,1,0,0,0,47,49,1,0,0,0,48,46,1,0,0,0,49,50,5,0,0,1, + 50,1,1,0,0,0,51,52,5,1,0,0,52,53,5,14,0,0,53,54,5,15,0,0,54,55,5, + 16,0,0,55,56,5,32,0,0,56,57,3,4,2,0,57,59,5,32,0,0,58,60,5,29,0, + 0,59,58,1,0,0,0,60,61,1,0,0,0,61,59,1,0,0,0,61,62,1,0,0,0,62,63, + 1,0,0,0,63,64,5,32,0,0,64,65,3,4,2,0,65,66,5,32,0,0,66,67,3,4,2, + 0,67,68,5,32,0,0,68,3,1,0,0,0,69,71,3,30,15,0,70,69,1,0,0,0,71,72, + 1,0,0,0,72,70,1,0,0,0,72,73,1,0,0,0,73,5,1,0,0,0,74,75,5,17,0,0, + 75,76,5,18,0,0,76,77,5,19,0,0,77,78,5,20,0,0,78,79,5,21,0,0,79,80, + 5,22,0,0,80,81,5,23,0,0,81,82,5,17,0,0,82,83,5,18,0,0,83,84,5,19, + 0,0,84,85,5,20,0,0,85,86,5,21,0,0,86,87,5,22,0,0,87,88,5,23,0,0, + 88,89,5,24,0,0,89,90,5,25,0,0,90,92,5,26,0,0,91,93,5,27,0,0,92,91, + 1,0,0,0,92,93,1,0,0,0,93,94,1,0,0,0,94,96,5,28,0,0,95,97,5,10,0, + 0,96,95,1,0,0,0,96,97,1,0,0,0,97,99,1,0,0,0,98,100,3,8,4,0,99,98, + 1,0,0,0,100,101,1,0,0,0,101,99,1,0,0,0,101,102,1,0,0,0,102,7,1,0, + 0,0,103,104,5,2,0,0,104,105,5,11,0,0,105,106,5,3,0,0,106,107,5,3, + 0,0,107,108,5,3,0,0,108,109,5,8,0,0,109,110,3,32,16,0,110,111,5, + 11,0,0,111,112,5,11,0,0,112,113,5,3,0,0,113,114,5,3,0,0,114,115, + 5,3,0,0,115,116,5,8,0,0,116,117,3,32,16,0,117,118,5,11,0,0,118,119, + 5,3,0,0,119,120,5,3,0,0,120,122,5,2,0,0,121,123,5,11,0,0,122,121, + 1,0,0,0,122,123,1,0,0,0,123,124,1,0,0,0,124,125,5,2,0,0,125,126, + 5,10,0,0,126,9,1,0,0,0,127,128,5,17,0,0,128,129,5,18,0,0,129,130, + 5,19,0,0,130,131,5,20,0,0,131,132,5,21,0,0,132,133,5,22,0,0,133, + 134,5,23,0,0,134,135,5,17,0,0,135,136,5,18,0,0,136,137,5,19,0,0, + 137,138,5,20,0,0,138,139,5,21,0,0,139,140,5,22,0,0,140,141,5,23, + 0,0,141,142,5,17,0,0,142,143,5,18,0,0,143,144,5,19,0,0,144,145,5, + 20,0,0,145,146,5,21,0,0,146,147,5,22,0,0,147,148,5,23,0,0,148,149, + 5,24,0,0,149,150,5,25,0,0,150,152,5,26,0,0,151,153,5,27,0,0,152, + 151,1,0,0,0,152,153,1,0,0,0,153,154,1,0,0,0,154,156,5,28,0,0,155, + 157,5,10,0,0,156,155,1,0,0,0,156,157,1,0,0,0,157,159,1,0,0,0,158, + 160,3,12,6,0,159,158,1,0,0,0,160,161,1,0,0,0,161,159,1,0,0,0,161, + 162,1,0,0,0,162,11,1,0,0,0,163,164,5,2,0,0,164,165,5,11,0,0,165, + 166,5,3,0,0,166,167,5,3,0,0,167,168,5,3,0,0,168,169,5,8,0,0,169, + 170,3,32,16,0,170,171,5,11,0,0,171,172,5,11,0,0,172,173,5,3,0,0, + 173,174,5,3,0,0,174,175,5,3,0,0,175,176,5,8,0,0,176,177,3,32,16, + 0,177,178,5,11,0,0,178,179,5,11,0,0,179,180,5,3,0,0,180,181,5,3, + 0,0,181,182,5,3,0,0,182,183,5,8,0,0,183,184,3,32,16,0,184,185,5, + 11,0,0,185,186,5,3,0,0,186,187,5,3,0,0,187,189,5,2,0,0,188,190,5, + 11,0,0,189,188,1,0,0,0,189,190,1,0,0,0,190,191,1,0,0,0,191,192,5, + 2,0,0,192,193,5,10,0,0,193,13,1,0,0,0,194,195,5,17,0,0,195,196,5, + 18,0,0,196,197,5,19,0,0,197,198,5,20,0,0,198,199,5,21,0,0,199,200, + 5,22,0,0,200,201,5,23,0,0,201,202,5,17,0,0,202,203,5,18,0,0,203, + 204,5,19,0,0,204,205,5,20,0,0,205,206,5,21,0,0,206,207,5,22,0,0, + 207,208,5,23,0,0,208,209,5,17,0,0,209,210,5,18,0,0,210,211,5,19, + 0,0,211,212,5,20,0,0,212,213,5,21,0,0,213,214,5,22,0,0,214,215,5, + 23,0,0,215,216,5,17,0,0,216,217,5,18,0,0,217,218,5,19,0,0,218,219, + 5,20,0,0,219,220,5,21,0,0,220,221,5,22,0,0,221,222,5,23,0,0,222, + 223,5,24,0,0,223,224,5,25,0,0,224,226,5,26,0,0,225,227,5,27,0,0, + 226,225,1,0,0,0,226,227,1,0,0,0,227,228,1,0,0,0,228,230,5,28,0,0, + 229,231,5,10,0,0,230,229,1,0,0,0,230,231,1,0,0,0,231,233,1,0,0,0, + 232,234,3,16,8,0,233,232,1,0,0,0,234,235,1,0,0,0,235,233,1,0,0,0, + 235,236,1,0,0,0,236,15,1,0,0,0,237,238,5,2,0,0,238,239,5,11,0,0, + 239,240,5,3,0,0,240,241,5,3,0,0,241,242,5,3,0,0,242,243,5,8,0,0, + 243,244,3,32,16,0,244,245,5,11,0,0,245,246,5,11,0,0,246,247,5,3, + 0,0,247,248,5,3,0,0,248,249,5,3,0,0,249,250,5,8,0,0,250,251,3,32, + 16,0,251,252,5,11,0,0,252,253,5,11,0,0,253,254,5,3,0,0,254,255,5, + 3,0,0,255,256,5,3,0,0,256,257,5,8,0,0,257,258,3,32,16,0,258,259, + 5,11,0,0,259,260,5,11,0,0,260,261,5,3,0,0,261,262,5,3,0,0,262,263, + 5,3,0,0,263,264,5,8,0,0,264,265,3,32,16,0,265,266,5,11,0,0,266,267, + 5,3,0,0,267,268,5,3,0,0,268,270,5,2,0,0,269,271,5,11,0,0,270,269, + 1,0,0,0,270,271,1,0,0,0,271,272,1,0,0,0,272,273,5,2,0,0,273,274, + 5,10,0,0,274,17,1,0,0,0,275,276,5,17,0,0,276,277,5,18,0,0,277,278, + 5,19,0,0,278,279,5,20,0,0,279,280,5,17,0,0,280,281,5,18,0,0,281, + 282,5,19,0,0,282,283,5,20,0,0,283,284,5,24,0,0,284,285,5,25,0,0, + 285,287,5,26,0,0,286,288,5,27,0,0,287,286,1,0,0,0,287,288,1,0,0, + 0,288,289,1,0,0,0,289,291,5,28,0,0,290,292,5,10,0,0,291,290,1,0, + 0,0,291,292,1,0,0,0,292,294,1,0,0,0,293,295,3,20,10,0,294,293,1, + 0,0,0,295,296,1,0,0,0,296,294,1,0,0,0,296,297,1,0,0,0,297,19,1,0, + 0,0,298,299,5,2,0,0,299,300,5,11,0,0,300,301,5,3,0,0,301,302,5,3, + 0,0,302,303,5,3,0,0,303,304,5,11,0,0,304,305,5,3,0,0,305,306,5,3, + 0,0,306,307,5,3,0,0,307,308,5,3,0,0,308,309,5,3,0,0,309,311,5,2, + 0,0,310,312,5,11,0,0,311,310,1,0,0,0,311,312,1,0,0,0,312,313,1,0, + 0,0,313,314,5,2,0,0,314,315,5,10,0,0,315,21,1,0,0,0,316,317,5,17, + 0,0,317,318,5,18,0,0,318,319,5,19,0,0,319,320,5,20,0,0,320,321,5, + 17,0,0,321,322,5,18,0,0,322,323,5,19,0,0,323,324,5,20,0,0,324,325, + 5,17,0,0,325,326,5,18,0,0,326,327,5,19,0,0,327,328,5,20,0,0,328, + 329,5,24,0,0,329,330,5,25,0,0,330,332,5,26,0,0,331,333,5,27,0,0, + 332,331,1,0,0,0,332,333,1,0,0,0,333,334,1,0,0,0,334,336,5,28,0,0, + 335,337,5,10,0,0,336,335,1,0,0,0,336,337,1,0,0,0,337,339,1,0,0,0, + 338,340,3,24,12,0,339,338,1,0,0,0,340,341,1,0,0,0,341,339,1,0,0, + 0,341,342,1,0,0,0,342,23,1,0,0,0,343,344,5,2,0,0,344,345,5,11,0, + 0,345,346,5,3,0,0,346,347,5,3,0,0,347,348,5,3,0,0,348,349,5,11,0, + 0,349,350,5,3,0,0,350,351,5,3,0,0,351,352,5,3,0,0,352,353,5,11,0, + 0,353,354,5,3,0,0,354,355,5,3,0,0,355,356,5,3,0,0,356,357,5,3,0, + 0,357,358,5,3,0,0,358,360,5,2,0,0,359,361,5,11,0,0,360,359,1,0,0, + 0,360,361,1,0,0,0,361,362,1,0,0,0,362,363,5,2,0,0,363,364,5,10,0, + 0,364,25,1,0,0,0,365,366,5,17,0,0,366,367,5,18,0,0,367,368,5,19, + 0,0,368,369,5,20,0,0,369,370,5,17,0,0,370,371,5,18,0,0,371,372,5, + 19,0,0,372,373,5,20,0,0,373,374,5,17,0,0,374,375,5,18,0,0,375,376, + 5,19,0,0,376,377,5,20,0,0,377,378,5,17,0,0,378,379,5,18,0,0,379, + 380,5,19,0,0,380,381,5,20,0,0,381,382,5,24,0,0,382,383,5,25,0,0, + 383,385,5,26,0,0,384,386,5,27,0,0,385,384,1,0,0,0,385,386,1,0,0, + 0,386,387,1,0,0,0,387,389,5,28,0,0,388,390,5,10,0,0,389,388,1,0, + 0,0,389,390,1,0,0,0,390,392,1,0,0,0,391,393,3,28,14,0,392,391,1, + 0,0,0,393,394,1,0,0,0,394,392,1,0,0,0,394,395,1,0,0,0,395,27,1,0, + 0,0,396,397,5,2,0,0,397,398,5,11,0,0,398,399,5,3,0,0,399,400,5,3, + 0,0,400,401,5,3,0,0,401,402,5,11,0,0,402,403,5,3,0,0,403,404,5,3, + 0,0,404,405,5,3,0,0,405,406,5,11,0,0,406,407,5,3,0,0,407,408,5,3, + 0,0,408,409,5,3,0,0,409,410,5,11,0,0,410,411,5,3,0,0,411,412,5,3, + 0,0,412,413,5,3,0,0,413,414,5,3,0,0,414,415,5,3,0,0,415,417,5,2, + 0,0,416,418,5,11,0,0,417,416,1,0,0,0,417,418,1,0,0,0,418,419,1,0, + 0,0,419,420,5,2,0,0,420,421,5,10,0,0,421,29,1,0,0,0,422,423,7,0, + 0,0,423,31,1,0,0,0,424,425,7,1,0,0,425,33,1,0,0,0,29,35,44,46,61, + 72,92,96,101,122,152,156,161,189,226,230,235,270,287,291,296,311, + 332,336,341,360,385,389,394,417 ] class NmrViewPKParser ( Parser ): @@ -197,12 +200,13 @@ class NmrViewPKParser ( Parser ): RULE_peak_list_wo_eju_4d = 13 RULE_peak_wo_eju_4d = 14 RULE_label = 15 + RULE_jcoupling = 16 ruleNames = [ "nmrview_pk", "data_label", "labels", "peak_list_2d", "peak_2d", "peak_list_3d", "peak_3d", "peak_list_4d", "peak_4d", "peak_list_wo_eju_2d", "peak_wo_eju_2d", "peak_list_wo_eju_3d", "peak_wo_eju_3d", "peak_list_wo_eju_4d", "peak_wo_eju_4d", - "label" ] + "label", "jcoupling" ] EOF = Token.EOF Label=1 @@ -258,6 +262,9 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): def EOF(self): return self.getToken(NmrViewPKParser.EOF, 0) + def RETURN(self): + return self.getToken(NmrViewPKParser.RETURN, 0) + def data_label(self, i:int=None): if i is None: return self.getTypedRuleContexts(NmrViewPKParser.Data_labelContext) @@ -328,54 +335,62 @@ def nmrview_pk(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 41 + self.state = 35 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==10: + self.state = 34 + self.match(NmrViewPKParser.RETURN) + + + self.state = 46 self._errHandler.sync(self) _la = self._input.LA(1) while _la==1 or _la==17: - self.state = 39 + self.state = 44 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,0,self._ctx) + la_ = self._interp.adaptivePredict(self._input,1,self._ctx) if la_ == 1: - self.state = 32 + self.state = 37 self.data_label() pass elif la_ == 2: - self.state = 33 + self.state = 38 self.peak_list_2d() pass elif la_ == 3: - self.state = 34 + self.state = 39 self.peak_list_3d() pass elif la_ == 4: - self.state = 35 + self.state = 40 self.peak_list_4d() pass elif la_ == 5: - self.state = 36 + self.state = 41 self.peak_list_wo_eju_2d() pass elif la_ == 6: - self.state = 37 + self.state = 42 self.peak_list_wo_eju_3d() pass elif la_ == 7: - self.state = 38 + self.state = 43 self.peak_list_wo_eju_4d() pass - self.state = 43 + self.state = 48 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 44 + self.state = 49 self.match(NmrViewPKParser.EOF) except RecognitionException as re: localctx.exception = re @@ -445,41 +460,41 @@ def data_label(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 46 + self.state = 51 self.match(NmrViewPKParser.Label) - self.state = 47 + self.state = 52 self.match(NmrViewPKParser.Dataset) - self.state = 48 + self.state = 53 self.match(NmrViewPKParser.Sw) - self.state = 49 + self.state = 54 self.match(NmrViewPKParser.Sf) - self.state = 50 + self.state = 55 self.match(NmrViewPKParser.RETURN_LA) - self.state = 51 + self.state = 56 self.labels() - self.state = 52 + self.state = 57 self.match(NmrViewPKParser.RETURN_LA) - self.state = 54 + self.state = 59 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 53 + self.state = 58 self.match(NmrViewPKParser.Simple_name_LA) - self.state = 56 + self.state = 61 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==29): break - self.state = 58 + self.state = 63 self.match(NmrViewPKParser.RETURN_LA) - self.state = 59 + self.state = 64 self.labels() - self.state = 60 + self.state = 65 self.match(NmrViewPKParser.RETURN_LA) - self.state = 61 + self.state = 66 self.labels() - self.state = 62 + self.state = 67 self.match(NmrViewPKParser.RETURN_LA) except RecognitionException as re: localctx.exception = re @@ -525,13 +540,13 @@ def labels(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 65 + self.state = 70 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 64 + self.state = 69 self.label() - self.state = 67 + self.state = 72 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 10200547328) != 0)): @@ -641,65 +656,65 @@ def peak_list_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 69 + self.state = 74 self.match(NmrViewPKParser.L_name) - self.state = 70 + self.state = 75 self.match(NmrViewPKParser.P_name) - self.state = 71 + self.state = 76 self.match(NmrViewPKParser.W_name) - self.state = 72 + self.state = 77 self.match(NmrViewPKParser.B_name) - self.state = 73 + self.state = 78 self.match(NmrViewPKParser.E_name) - self.state = 74 + self.state = 79 self.match(NmrViewPKParser.J_name) - self.state = 75 + self.state = 80 self.match(NmrViewPKParser.U_name) - self.state = 76 + self.state = 81 self.match(NmrViewPKParser.L_name) - self.state = 77 + self.state = 82 self.match(NmrViewPKParser.P_name) - self.state = 78 + self.state = 83 self.match(NmrViewPKParser.W_name) - self.state = 79 + self.state = 84 self.match(NmrViewPKParser.B_name) - self.state = 80 + self.state = 85 self.match(NmrViewPKParser.E_name) - self.state = 81 + self.state = 86 self.match(NmrViewPKParser.J_name) - self.state = 82 + self.state = 87 self.match(NmrViewPKParser.U_name) - self.state = 83 + self.state = 88 self.match(NmrViewPKParser.Vol) - self.state = 84 + self.state = 89 self.match(NmrViewPKParser.Int) - self.state = 85 + self.state = 90 self.match(NmrViewPKParser.Stat) - self.state = 87 + self.state = 92 self._errHandler.sync(self) _la = self._input.LA(1) if _la==27: - self.state = 86 + self.state = 91 self.match(NmrViewPKParser.Comment) - self.state = 89 + self.state = 94 self.match(NmrViewPKParser.Flag0) - self.state = 91 + self.state = 96 self._errHandler.sync(self) _la = self._input.LA(1) if _la==10: - self.state = 90 + self.state = 95 self.match(NmrViewPKParser.RETURN) - self.state = 94 + self.state = 99 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 93 + self.state = 98 self.peak_2d() - self.state = 96 + self.state = 101 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==2): @@ -745,6 +760,13 @@ def Simple_name(self, i:int=None): else: return self.getToken(NmrViewPKParser.Simple_name, i) + def jcoupling(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(NmrViewPKParser.JcouplingContext) + else: + return self.getTypedRuleContext(NmrViewPKParser.JcouplingContext,i) + + def RETURN(self): return self.getToken(NmrViewPKParser.RETURN, 0) @@ -769,53 +791,53 @@ def peak_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 98 - self.match(NmrViewPKParser.Integer) - self.state = 99 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 100 - self.match(NmrViewPKParser.Float) - self.state = 101 - self.match(NmrViewPKParser.Float) - self.state = 102 - self.match(NmrViewPKParser.Float) self.state = 103 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.Integer) self.state = 104 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 105 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 106 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 107 self.match(NmrViewPKParser.Float) self.state = 108 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.Simple_name) self.state = 109 - self.match(NmrViewPKParser.Float) + self.jcoupling() self.state = 110 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 111 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 112 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 113 self.match(NmrViewPKParser.Float) self.state = 114 self.match(NmrViewPKParser.Float) self.state = 115 - self.match(NmrViewPKParser.Integer) + self.match(NmrViewPKParser.Simple_name) + self.state = 116 + self.jcoupling() self.state = 117 + self.match(NmrViewPKParser.ENCLOSE_DATA) + self.state = 118 + self.match(NmrViewPKParser.Float) + self.state = 119 + self.match(NmrViewPKParser.Float) + self.state = 120 + self.match(NmrViewPKParser.Integer) + self.state = 122 self._errHandler.sync(self) _la = self._input.LA(1) if _la==11: - self.state = 116 + self.state = 121 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 119 + self.state = 124 self.match(NmrViewPKParser.Integer) - self.state = 120 + self.state = 125 self.match(NmrViewPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -921,79 +943,79 @@ def peak_list_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 122 + self.state = 127 self.match(NmrViewPKParser.L_name) - self.state = 123 + self.state = 128 self.match(NmrViewPKParser.P_name) - self.state = 124 + self.state = 129 self.match(NmrViewPKParser.W_name) - self.state = 125 + self.state = 130 self.match(NmrViewPKParser.B_name) - self.state = 126 + self.state = 131 self.match(NmrViewPKParser.E_name) - self.state = 127 + self.state = 132 self.match(NmrViewPKParser.J_name) - self.state = 128 + self.state = 133 self.match(NmrViewPKParser.U_name) - self.state = 129 + self.state = 134 self.match(NmrViewPKParser.L_name) - self.state = 130 + self.state = 135 self.match(NmrViewPKParser.P_name) - self.state = 131 + self.state = 136 self.match(NmrViewPKParser.W_name) - self.state = 132 + self.state = 137 self.match(NmrViewPKParser.B_name) - self.state = 133 + self.state = 138 self.match(NmrViewPKParser.E_name) - self.state = 134 + self.state = 139 self.match(NmrViewPKParser.J_name) - self.state = 135 + self.state = 140 self.match(NmrViewPKParser.U_name) - self.state = 136 + self.state = 141 self.match(NmrViewPKParser.L_name) - self.state = 137 + self.state = 142 self.match(NmrViewPKParser.P_name) - self.state = 138 + self.state = 143 self.match(NmrViewPKParser.W_name) - self.state = 139 + self.state = 144 self.match(NmrViewPKParser.B_name) - self.state = 140 + self.state = 145 self.match(NmrViewPKParser.E_name) - self.state = 141 + self.state = 146 self.match(NmrViewPKParser.J_name) - self.state = 142 + self.state = 147 self.match(NmrViewPKParser.U_name) - self.state = 143 + self.state = 148 self.match(NmrViewPKParser.Vol) - self.state = 144 + self.state = 149 self.match(NmrViewPKParser.Int) - self.state = 145 + self.state = 150 self.match(NmrViewPKParser.Stat) - self.state = 147 + self.state = 152 self._errHandler.sync(self) _la = self._input.LA(1) if _la==27: - self.state = 146 + self.state = 151 self.match(NmrViewPKParser.Comment) - self.state = 149 + self.state = 154 self.match(NmrViewPKParser.Flag0) - self.state = 151 + self.state = 156 self._errHandler.sync(self) _la = self._input.LA(1) if _la==10: - self.state = 150 + self.state = 155 self.match(NmrViewPKParser.RETURN) - self.state = 154 + self.state = 159 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 153 + self.state = 158 self.peak_3d() - self.state = 156 + self.state = 161 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==2): @@ -1039,6 +1061,13 @@ def Simple_name(self, i:int=None): else: return self.getToken(NmrViewPKParser.Simple_name, i) + def jcoupling(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(NmrViewPKParser.JcouplingContext) + else: + return self.getTypedRuleContext(NmrViewPKParser.JcouplingContext,i) + + def RETURN(self): return self.getToken(NmrViewPKParser.RETURN, 0) @@ -1063,67 +1092,67 @@ def peak_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 158 - self.match(NmrViewPKParser.Integer) - self.state = 159 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 160 - self.match(NmrViewPKParser.Float) - self.state = 161 - self.match(NmrViewPKParser.Float) - self.state = 162 - self.match(NmrViewPKParser.Float) self.state = 163 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.Integer) self.state = 164 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 165 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 166 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 167 self.match(NmrViewPKParser.Float) self.state = 168 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.Simple_name) self.state = 169 - self.match(NmrViewPKParser.Float) + self.jcoupling() self.state = 170 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 171 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 172 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 173 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 174 self.match(NmrViewPKParser.Float) self.state = 175 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.Simple_name) self.state = 176 - self.match(NmrViewPKParser.Float) + self.jcoupling() self.state = 177 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 178 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 179 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 180 self.match(NmrViewPKParser.Float) self.state = 181 self.match(NmrViewPKParser.Float) self.state = 182 - self.match(NmrViewPKParser.Integer) + self.match(NmrViewPKParser.Simple_name) + self.state = 183 + self.jcoupling() self.state = 184 + self.match(NmrViewPKParser.ENCLOSE_DATA) + self.state = 185 + self.match(NmrViewPKParser.Float) + self.state = 186 + self.match(NmrViewPKParser.Float) + self.state = 187 + self.match(NmrViewPKParser.Integer) + self.state = 189 self._errHandler.sync(self) _la = self._input.LA(1) if _la==11: - self.state = 183 + self.state = 188 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 186 + self.state = 191 self.match(NmrViewPKParser.Integer) - self.state = 187 + self.state = 192 self.match(NmrViewPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -1229,93 +1258,93 @@ def peak_list_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 189 + self.state = 194 self.match(NmrViewPKParser.L_name) - self.state = 190 + self.state = 195 self.match(NmrViewPKParser.P_name) - self.state = 191 + self.state = 196 self.match(NmrViewPKParser.W_name) - self.state = 192 + self.state = 197 self.match(NmrViewPKParser.B_name) - self.state = 193 + self.state = 198 self.match(NmrViewPKParser.E_name) - self.state = 194 + self.state = 199 self.match(NmrViewPKParser.J_name) - self.state = 195 + self.state = 200 self.match(NmrViewPKParser.U_name) - self.state = 196 + self.state = 201 self.match(NmrViewPKParser.L_name) - self.state = 197 + self.state = 202 self.match(NmrViewPKParser.P_name) - self.state = 198 + self.state = 203 self.match(NmrViewPKParser.W_name) - self.state = 199 + self.state = 204 self.match(NmrViewPKParser.B_name) - self.state = 200 + self.state = 205 self.match(NmrViewPKParser.E_name) - self.state = 201 + self.state = 206 self.match(NmrViewPKParser.J_name) - self.state = 202 + self.state = 207 self.match(NmrViewPKParser.U_name) - self.state = 203 + self.state = 208 self.match(NmrViewPKParser.L_name) - self.state = 204 + self.state = 209 self.match(NmrViewPKParser.P_name) - self.state = 205 + self.state = 210 self.match(NmrViewPKParser.W_name) - self.state = 206 + self.state = 211 self.match(NmrViewPKParser.B_name) - self.state = 207 + self.state = 212 self.match(NmrViewPKParser.E_name) - self.state = 208 + self.state = 213 self.match(NmrViewPKParser.J_name) - self.state = 209 + self.state = 214 self.match(NmrViewPKParser.U_name) - self.state = 210 + self.state = 215 self.match(NmrViewPKParser.L_name) - self.state = 211 + self.state = 216 self.match(NmrViewPKParser.P_name) - self.state = 212 + self.state = 217 self.match(NmrViewPKParser.W_name) - self.state = 213 + self.state = 218 self.match(NmrViewPKParser.B_name) - self.state = 214 + self.state = 219 self.match(NmrViewPKParser.E_name) - self.state = 215 + self.state = 220 self.match(NmrViewPKParser.J_name) - self.state = 216 + self.state = 221 self.match(NmrViewPKParser.U_name) - self.state = 217 + self.state = 222 self.match(NmrViewPKParser.Vol) - self.state = 218 + self.state = 223 self.match(NmrViewPKParser.Int) - self.state = 219 + self.state = 224 self.match(NmrViewPKParser.Stat) - self.state = 221 + self.state = 226 self._errHandler.sync(self) _la = self._input.LA(1) if _la==27: - self.state = 220 + self.state = 225 self.match(NmrViewPKParser.Comment) - self.state = 223 + self.state = 228 self.match(NmrViewPKParser.Flag0) - self.state = 225 + self.state = 230 self._errHandler.sync(self) _la = self._input.LA(1) if _la==10: - self.state = 224 + self.state = 229 self.match(NmrViewPKParser.RETURN) - self.state = 228 + self.state = 233 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 227 + self.state = 232 self.peak_4d() - self.state = 230 + self.state = 235 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==2): @@ -1361,6 +1390,13 @@ def Simple_name(self, i:int=None): else: return self.getToken(NmrViewPKParser.Simple_name, i) + def jcoupling(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(NmrViewPKParser.JcouplingContext) + else: + return self.getTypedRuleContext(NmrViewPKParser.JcouplingContext,i) + + def RETURN(self): return self.getToken(NmrViewPKParser.RETURN, 0) @@ -1385,81 +1421,81 @@ def peak_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 232 - self.match(NmrViewPKParser.Integer) - self.state = 233 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 234 - self.match(NmrViewPKParser.Float) - self.state = 235 - self.match(NmrViewPKParser.Float) - self.state = 236 - self.match(NmrViewPKParser.Float) self.state = 237 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.Integer) self.state = 238 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 239 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 240 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 241 self.match(NmrViewPKParser.Float) self.state = 242 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.Simple_name) self.state = 243 - self.match(NmrViewPKParser.Float) + self.jcoupling() self.state = 244 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 245 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 246 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 247 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 248 self.match(NmrViewPKParser.Float) self.state = 249 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.Simple_name) self.state = 250 - self.match(NmrViewPKParser.Float) + self.jcoupling() self.state = 251 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 252 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 253 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 254 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 255 self.match(NmrViewPKParser.Float) self.state = 256 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.Simple_name) self.state = 257 - self.match(NmrViewPKParser.Float) + self.jcoupling() self.state = 258 - self.match(NmrViewPKParser.Simple_name) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 259 self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 260 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Float) self.state = 261 self.match(NmrViewPKParser.Float) self.state = 262 self.match(NmrViewPKParser.Float) self.state = 263 - self.match(NmrViewPKParser.Integer) + self.match(NmrViewPKParser.Simple_name) + self.state = 264 + self.jcoupling() self.state = 265 + self.match(NmrViewPKParser.ENCLOSE_DATA) + self.state = 266 + self.match(NmrViewPKParser.Float) + self.state = 267 + self.match(NmrViewPKParser.Float) + self.state = 268 + self.match(NmrViewPKParser.Integer) + self.state = 270 self._errHandler.sync(self) _la = self._input.LA(1) if _la==11: - self.state = 264 + self.state = 269 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 267 + self.state = 272 self.match(NmrViewPKParser.Integer) - self.state = 268 + self.state = 273 self.match(NmrViewPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -1547,53 +1583,53 @@ def peak_list_wo_eju_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 270 + self.state = 275 self.match(NmrViewPKParser.L_name) - self.state = 271 + self.state = 276 self.match(NmrViewPKParser.P_name) - self.state = 272 + self.state = 277 self.match(NmrViewPKParser.W_name) - self.state = 273 + self.state = 278 self.match(NmrViewPKParser.B_name) - self.state = 274 + self.state = 279 self.match(NmrViewPKParser.L_name) - self.state = 275 + self.state = 280 self.match(NmrViewPKParser.P_name) - self.state = 276 + self.state = 281 self.match(NmrViewPKParser.W_name) - self.state = 277 + self.state = 282 self.match(NmrViewPKParser.B_name) - self.state = 278 + self.state = 283 self.match(NmrViewPKParser.Vol) - self.state = 279 + self.state = 284 self.match(NmrViewPKParser.Int) - self.state = 280 + self.state = 285 self.match(NmrViewPKParser.Stat) - self.state = 282 + self.state = 287 self._errHandler.sync(self) _la = self._input.LA(1) if _la==27: - self.state = 281 + self.state = 286 self.match(NmrViewPKParser.Comment) - self.state = 284 + self.state = 289 self.match(NmrViewPKParser.Flag0) - self.state = 286 + self.state = 291 self._errHandler.sync(self) _la = self._input.LA(1) if _la==10: - self.state = 285 + self.state = 290 self.match(NmrViewPKParser.RETURN) - self.state = 289 + self.state = 294 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 288 + self.state = 293 self.peak_wo_eju_2d() - self.state = 291 + self.state = 296 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==2): @@ -1657,41 +1693,41 @@ def peak_wo_eju_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 293 + self.state = 298 self.match(NmrViewPKParser.Integer) - self.state = 294 + self.state = 299 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 295 + self.state = 300 self.match(NmrViewPKParser.Float) - self.state = 296 + self.state = 301 self.match(NmrViewPKParser.Float) - self.state = 297 + self.state = 302 self.match(NmrViewPKParser.Float) - self.state = 298 + self.state = 303 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 299 + self.state = 304 self.match(NmrViewPKParser.Float) - self.state = 300 + self.state = 305 self.match(NmrViewPKParser.Float) - self.state = 301 + self.state = 306 self.match(NmrViewPKParser.Float) - self.state = 302 + self.state = 307 self.match(NmrViewPKParser.Float) - self.state = 303 + self.state = 308 self.match(NmrViewPKParser.Float) - self.state = 304 + self.state = 309 self.match(NmrViewPKParser.Integer) - self.state = 306 + self.state = 311 self._errHandler.sync(self) _la = self._input.LA(1) if _la==11: - self.state = 305 + self.state = 310 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 308 + self.state = 313 self.match(NmrViewPKParser.Integer) - self.state = 309 + self.state = 314 self.match(NmrViewPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -1779,61 +1815,61 @@ def peak_list_wo_eju_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 311 + self.state = 316 self.match(NmrViewPKParser.L_name) - self.state = 312 + self.state = 317 self.match(NmrViewPKParser.P_name) - self.state = 313 + self.state = 318 self.match(NmrViewPKParser.W_name) - self.state = 314 + self.state = 319 self.match(NmrViewPKParser.B_name) - self.state = 315 + self.state = 320 self.match(NmrViewPKParser.L_name) - self.state = 316 + self.state = 321 self.match(NmrViewPKParser.P_name) - self.state = 317 + self.state = 322 self.match(NmrViewPKParser.W_name) - self.state = 318 + self.state = 323 self.match(NmrViewPKParser.B_name) - self.state = 319 + self.state = 324 self.match(NmrViewPKParser.L_name) - self.state = 320 + self.state = 325 self.match(NmrViewPKParser.P_name) - self.state = 321 + self.state = 326 self.match(NmrViewPKParser.W_name) - self.state = 322 + self.state = 327 self.match(NmrViewPKParser.B_name) - self.state = 323 + self.state = 328 self.match(NmrViewPKParser.Vol) - self.state = 324 + self.state = 329 self.match(NmrViewPKParser.Int) - self.state = 325 + self.state = 330 self.match(NmrViewPKParser.Stat) - self.state = 327 + self.state = 332 self._errHandler.sync(self) _la = self._input.LA(1) if _la==27: - self.state = 326 + self.state = 331 self.match(NmrViewPKParser.Comment) - self.state = 329 + self.state = 334 self.match(NmrViewPKParser.Flag0) - self.state = 331 + self.state = 336 self._errHandler.sync(self) _la = self._input.LA(1) if _la==10: - self.state = 330 + self.state = 335 self.match(NmrViewPKParser.RETURN) - self.state = 334 + self.state = 339 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 333 + self.state = 338 self.peak_wo_eju_3d() - self.state = 336 + self.state = 341 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==2): @@ -1897,28 +1933,18 @@ def peak_wo_eju_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 338 - self.match(NmrViewPKParser.Integer) - self.state = 339 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 340 - self.match(NmrViewPKParser.Float) - self.state = 341 - self.match(NmrViewPKParser.Float) - self.state = 342 - self.match(NmrViewPKParser.Float) self.state = 343 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Integer) self.state = 344 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 345 self.match(NmrViewPKParser.Float) self.state = 346 self.match(NmrViewPKParser.Float) self.state = 347 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 348 self.match(NmrViewPKParser.Float) + self.state = 348 + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 349 self.match(NmrViewPKParser.Float) self.state = 350 @@ -1926,20 +1952,30 @@ def peak_wo_eju_3d(self): self.state = 351 self.match(NmrViewPKParser.Float) self.state = 352 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 353 - self.match(NmrViewPKParser.Integer) + self.match(NmrViewPKParser.Float) + self.state = 354 + self.match(NmrViewPKParser.Float) self.state = 355 + self.match(NmrViewPKParser.Float) + self.state = 356 + self.match(NmrViewPKParser.Float) + self.state = 357 + self.match(NmrViewPKParser.Float) + self.state = 358 + self.match(NmrViewPKParser.Integer) + self.state = 360 self._errHandler.sync(self) _la = self._input.LA(1) if _la==11: - self.state = 354 + self.state = 359 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 357 + self.state = 362 self.match(NmrViewPKParser.Integer) - self.state = 358 + self.state = 363 self.match(NmrViewPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -2027,69 +2063,69 @@ def peak_list_wo_eju_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 360 + self.state = 365 self.match(NmrViewPKParser.L_name) - self.state = 361 + self.state = 366 self.match(NmrViewPKParser.P_name) - self.state = 362 + self.state = 367 self.match(NmrViewPKParser.W_name) - self.state = 363 + self.state = 368 self.match(NmrViewPKParser.B_name) - self.state = 364 + self.state = 369 self.match(NmrViewPKParser.L_name) - self.state = 365 + self.state = 370 self.match(NmrViewPKParser.P_name) - self.state = 366 + self.state = 371 self.match(NmrViewPKParser.W_name) - self.state = 367 + self.state = 372 self.match(NmrViewPKParser.B_name) - self.state = 368 + self.state = 373 self.match(NmrViewPKParser.L_name) - self.state = 369 + self.state = 374 self.match(NmrViewPKParser.P_name) - self.state = 370 + self.state = 375 self.match(NmrViewPKParser.W_name) - self.state = 371 + self.state = 376 self.match(NmrViewPKParser.B_name) - self.state = 372 + self.state = 377 self.match(NmrViewPKParser.L_name) - self.state = 373 + self.state = 378 self.match(NmrViewPKParser.P_name) - self.state = 374 + self.state = 379 self.match(NmrViewPKParser.W_name) - self.state = 375 + self.state = 380 self.match(NmrViewPKParser.B_name) - self.state = 376 + self.state = 381 self.match(NmrViewPKParser.Vol) - self.state = 377 + self.state = 382 self.match(NmrViewPKParser.Int) - self.state = 378 + self.state = 383 self.match(NmrViewPKParser.Stat) - self.state = 380 + self.state = 385 self._errHandler.sync(self) _la = self._input.LA(1) if _la==27: - self.state = 379 + self.state = 384 self.match(NmrViewPKParser.Comment) - self.state = 382 + self.state = 387 self.match(NmrViewPKParser.Flag0) - self.state = 384 + self.state = 389 self._errHandler.sync(self) _la = self._input.LA(1) if _la==10: - self.state = 383 + self.state = 388 self.match(NmrViewPKParser.RETURN) - self.state = 387 + self.state = 392 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 386 + self.state = 391 self.peak_wo_eju_4d() - self.state = 389 + self.state = 394 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==2): @@ -2153,36 +2189,26 @@ def peak_wo_eju_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 391 - self.match(NmrViewPKParser.Integer) - self.state = 392 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 393 - self.match(NmrViewPKParser.Float) - self.state = 394 - self.match(NmrViewPKParser.Float) - self.state = 395 - self.match(NmrViewPKParser.Float) self.state = 396 - self.match(NmrViewPKParser.ENCLOSE_DATA) + self.match(NmrViewPKParser.Integer) self.state = 397 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 398 self.match(NmrViewPKParser.Float) self.state = 399 self.match(NmrViewPKParser.Float) self.state = 400 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 401 self.match(NmrViewPKParser.Float) + self.state = 401 + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 402 self.match(NmrViewPKParser.Float) self.state = 403 self.match(NmrViewPKParser.Float) self.state = 404 - self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 405 self.match(NmrViewPKParser.Float) + self.state = 405 + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 406 self.match(NmrViewPKParser.Float) self.state = 407 @@ -2190,20 +2216,30 @@ def peak_wo_eju_4d(self): self.state = 408 self.match(NmrViewPKParser.Float) self.state = 409 - self.match(NmrViewPKParser.Float) + self.match(NmrViewPKParser.ENCLOSE_DATA) self.state = 410 - self.match(NmrViewPKParser.Integer) + self.match(NmrViewPKParser.Float) + self.state = 411 + self.match(NmrViewPKParser.Float) self.state = 412 + self.match(NmrViewPKParser.Float) + self.state = 413 + self.match(NmrViewPKParser.Float) + self.state = 414 + self.match(NmrViewPKParser.Float) + self.state = 415 + self.match(NmrViewPKParser.Integer) + self.state = 417 self._errHandler.sync(self) _la = self._input.LA(1) if _la==11: - self.state = 411 + self.state = 416 self.match(NmrViewPKParser.ENCLOSE_DATA) - self.state = 414 + self.state = 419 self.match(NmrViewPKParser.Integer) - self.state = 415 + self.state = 420 self.match(NmrViewPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -2251,7 +2287,7 @@ def label(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 417 + self.state = 422 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 10200547328) != 0)): self._errHandler.recoverInline(self) @@ -2267,6 +2303,59 @@ def label(self): return localctx + class JcouplingContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Float(self): + return self.getToken(NmrViewPKParser.Float, 0) + + def Simple_name(self): + return self.getToken(NmrViewPKParser.Simple_name, 0) + + def ENCLOSE_DATA(self): + return self.getToken(NmrViewPKParser.ENCLOSE_DATA, 0) + + def getRuleIndex(self): + return NmrViewPKParser.RULE_jcoupling + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterJcoupling" ): + listener.enterJcoupling(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitJcoupling" ): + listener.exitJcoupling(self) + + + + + def jcoupling(self): + + localctx = NmrViewPKParser.JcouplingContext(self, self._ctx, self.state) + self.enterRule(localctx, 32, self.RULE_jcoupling) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 424 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 2312) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + diff --git a/wwpdb/utils/nmr/pk/NmrViewPKParserListener.py b/wwpdb/utils/nmr/pk/NmrViewPKParserListener.py index d0eae442..73c8a38d 100644 --- a/wwpdb/utils/nmr/pk/NmrViewPKParserListener.py +++ b/wwpdb/utils/nmr/pk/NmrViewPKParserListener.py @@ -39,6 +39,7 @@ class NmrViewPKParserListener(ParseTreeListener, BasePKParserListener): __cur_label_type = None __labels = None + __jcouplings = None def __init__(self, verbose=True, log=sys.stdout, representativeModelId=REPRESENTATIVE_MODEL_ID, @@ -96,6 +97,8 @@ def exitLabels(self, ctx: NmrViewPKParser.LabelsContext): # pylint: disable=unu for _dim_id, _axis_code in enumerate(labels, start=1): if _dim_id not in self.cur_spectral_dim: cur_spectral_dim = copy.copy(SPECTRAL_DIM_TEMPLATE) + else: + cur_spectral_dim = self.cur_spectral_dim[_dim_id] cur_spectral_dim['axis_code'] = _axis_code @@ -141,6 +144,7 @@ def exitLabels(self, ctx: NmrViewPKParser.LabelsContext): # pylint: disable=unu # Enter a parse tree produced by NmrViewPKParser#peak_list_2d. def enterPeak_list_2d(self, ctx: NmrViewPKParser.Peak_list_2dContext): # pylint: disable=unused-argument self.initSpectralDim() + self.__jcouplings = [] # Exit a parse tree produced by NmrViewPKParser#peak_list_2d. def exitPeak_list_2d(self, ctx: NmrViewPKParser.Peak_list_2dContext): # pylint: disable=unused-argument @@ -151,6 +155,7 @@ def enterPeak_2d(self, ctx: NmrViewPKParser.Peak_2dContext): # pylint: disable= self.peaks2D += 1 self.atomSelectionSet.clear() + self.__jcouplings.clear() # Exit a parse tree produced by NmrViewPKParser#peak_2d. def exitPeak_2d(self, ctx: NmrViewPKParser.Peak_2dContext): @@ -162,22 +167,22 @@ def exitPeak_2d(self, ctx: NmrViewPKParser.Peak_2dContext): W1 = float(str(ctx.Float(1))) B1 = float(str(ctx.Float(2))) # E1 = str(ctx.Simple_name(0)) - # J1 = str(ctx.ENCLOSE_DATA(1))[1:-1] - # U1 = str(ctx.ENCLOSE_DATA(2))[1:-1] + # J1 = self.__jcouplings[0] + # U1 = str(ctx.ENCLOSE_DATA(1))[1:-1] - L2 = str(ctx.ENCLOSE_DATA(3))[1:-1] + L2 = str(ctx.ENCLOSE_DATA(2))[1:-1] P2 = float(str(ctx.Float(3))) W2 = float(str(ctx.Float(4))) B2 = float(str(ctx.Float(5))) # E2 = str(ctx.Simple_name(1)) - # J2 = str(ctx.ENCLOSE_DATA(4))[1:-1] - # U2 = str(ctx.ENCLOSE_DATA(5))[1:-1] + # J2 = self.__jcouplings[1] + # U2 = str(ctx.ENCLOSE_DATA(3))[1:-1] vol = str(ctx.Float(6)) _int = str(ctx.Float(7)) stat = int(str(ctx.Integer(1))) - if ctx.ENCLOSE_DATA(6): - comment = str(ctx.ENCLOSE_DATA(6))[1:-1] + if ctx.ENCLOSE_DATA(4): + comment = str(ctx.ENCLOSE_DATA(4))[1:-1] if comment in emptyValue: comment = None else: @@ -217,10 +222,10 @@ def exitPeak_2d(self, ctx: NmrViewPKParser.Peak_2dContext): assignment0 = self.extractPeakAssignment(1, L1, index) if assignment0 is not None: - assignments[0] = assignment0[0] + a1 = assignment0[0] assignment1 = self.extractPeakAssignment(1, L2, index) if assignment1 is not None: - assignments[1] = assignment1[0] + a2 = assignment1[0] if all(len(a) > 0 for a in assignments): @@ -229,9 +234,6 @@ def exitPeak_2d(self, ctx: NmrViewPKParser.Peak_2dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -254,8 +256,8 @@ def exitPeak_2d(self, ctx: NmrViewPKParser.Peak_2dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -293,6 +295,7 @@ def exitPeak_2d(self, ctx: NmrViewPKParser.Peak_2dContext): # Enter a parse tree produced by NmrViewPKParser#peak_list_3d. def enterPeak_list_3d(self, ctx: NmrViewPKParser.Peak_list_3dContext): # pylint: disable=unused-argument self.initSpectralDim() + self.__jcouplings = [] # Exit a parse tree produced by NmrViewPKParser#peak_list_3d. def exitPeak_list_3d(self, ctx: NmrViewPKParser.Peak_list_3dContext): # pylint: disable=unused-argument @@ -303,6 +306,7 @@ def enterPeak_3d(self, ctx: NmrViewPKParser.Peak_3dContext): # pylint: disable= self.peaks3D += 1 self.atomSelectionSet.clear() + self.__jcouplings.clear() # Exit a parse tree produced by NmrViewPKParser#peak_3d. def exitPeak_3d(self, ctx: NmrViewPKParser.Peak_3dContext): @@ -314,30 +318,30 @@ def exitPeak_3d(self, ctx: NmrViewPKParser.Peak_3dContext): W1 = float(str(ctx.Float(1))) B1 = float(str(ctx.Float(2))) # E1 = str(ctx.Simple_name(0)) - # J1 = str(ctx.ENCLOSE_DATA(1))[1:-1] - # U1 = str(ctx.ENCLOSE_DATA(2))[1:-1] + # J1 = self.__jcouplings[0] + # U1 = str(ctx.ENCLOSE_DATA(1))[1:-1] - L2 = str(ctx.ENCLOSE_DATA(3))[1:-1] + L2 = str(ctx.ENCLOSE_DATA(2))[1:-1] P2 = float(str(ctx.Float(3))) W2 = float(str(ctx.Float(4))) B2 = float(str(ctx.Float(5))) # E2 = str(ctx.Simple_name(1)) - # J2 = str(ctx.ENCLOSE_DATA(4))[1:-1] - # U2 = str(ctx.ENCLOSE_DATA(5))[1:-1] + # J2 = self.__jcouplings[1] + # U2 = str(ctx.ENCLOSE_DATA(3))[1:-1] - L3 = str(ctx.ENCLOSE_DATA(6))[1:-1] + L3 = str(ctx.ENCLOSE_DATA(4))[1:-1] P3 = float(str(ctx.Float(6))) W3 = float(str(ctx.Float(7))) B3 = float(str(ctx.Float(8))) # E3 = str(ctx.Simple_name(2)) - # J3 = str(ctx.ENCLOSE_DATA(7))[1:-1] - # U3 = str(ctx.ENCLOSE_DATA(8))[1:-1] + # J3 = self.__jcouplings[2] + # U3 = str(ctx.ENCLOSE_DATA(5))[1:-1] vol = str(ctx.Float(9)) _int = str(ctx.Float(10)) stat = int(str(ctx.Integer(1))) - if ctx.ENCLOSE_DATA(9): - comment = str(ctx.ENCLOSE_DATA(9))[1:-1] + if ctx.ENCLOSE_DATA(6): + comment = str(ctx.ENCLOSE_DATA(6))[1:-1] if comment in emptyValue: comment = None else: @@ -380,13 +384,13 @@ def exitPeak_3d(self, ctx: NmrViewPKParser.Peak_3dContext): assignment0 = self.extractPeakAssignment(1, L1, index) if assignment0 is not None: - assignments[0] = assignment0[0] + a1 = assignment0[0] assignment1 = self.extractPeakAssignment(1, L2, index) if assignment1 is not None: - assignments[1] = assignment1[0] + a2 = assignment1[0] assignment2 = self.extractPeakAssignment(1, L3, index) if assignment2 is not None: - assignments[2] = assignment2[0] + a3 = assignment2[0] if all(len(a) > 0 for a in assignments): @@ -395,10 +399,6 @@ def exitPeak_3d(self, ctx: NmrViewPKParser.Peak_3dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -426,9 +426,9 @@ def exitPeak_3d(self, ctx: NmrViewPKParser.Peak_3dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -472,6 +472,7 @@ def exitPeak_3d(self, ctx: NmrViewPKParser.Peak_3dContext): # Enter a parse tree produced by NmrViewPKParser#peak_list_4d. def enterPeak_list_4d(self, ctx: NmrViewPKParser.Peak_list_4dContext): # pylint: disable=unused-argument self.initSpectralDim() + self.__jcouplings = [] # Exit a parse tree produced by NmrViewPKParser#peak_list_4d. def exitPeak_list_4d(self, ctx: NmrViewPKParser.Peak_list_4dContext): # pylint: disable=unused-argument @@ -482,6 +483,7 @@ def enterPeak_4d(self, ctx: NmrViewPKParser.Peak_4dContext): # pylint: disable= self.peaks4D += 1 self.atomSelectionSet.clear() + self.__jcouplings.clear() # Exit a parse tree produced by NmrViewPKParser#peak_4d. def exitPeak_4d(self, ctx: NmrViewPKParser.Peak_4dContext): @@ -493,38 +495,38 @@ def exitPeak_4d(self, ctx: NmrViewPKParser.Peak_4dContext): W1 = float(str(ctx.Float(1))) B1 = float(str(ctx.Float(2))) # E1 = str(ctx.Simple_name(0)) - # J1 = str(ctx.ENCLOSE_DATA(1))[1:-1] - # U1 = str(ctx.ENCLOSE_DATA(2))[1:-1] + # J1 = self.__jcouplings[0] + # U1 = str(ctx.ENCLOSE_DATA(1))[1:-1] - L2 = str(ctx.ENCLOSE_DATA(3))[1:-1] + L2 = str(ctx.ENCLOSE_DATA(2))[1:-1] P2 = float(str(ctx.Float(3))) W2 = float(str(ctx.Float(4))) B2 = float(str(ctx.Float(5))) # E2 = str(ctx.Simple_name(1)) - # J2 = str(ctx.ENCLOSE_DATA(4))[1:-1] - # U2 = str(ctx.ENCLOSE_DATA(5))[1:-1] + # J2 = self.__jcouplings[1] + # U2 = str(ctx.ENCLOSE_DATA(3))[1:-1] - L3 = str(ctx.ENCLOSE_DATA(6))[1:-1] + L3 = str(ctx.ENCLOSE_DATA(4))[1:-1] P3 = float(str(ctx.Float(6))) W3 = float(str(ctx.Float(7))) B3 = float(str(ctx.Float(8))) # E3 = str(ctx.Simple_name(2)) - # J3 = str(ctx.ENCLOSE_DATA(7))[1:-1] - # U3 = str(ctx.ENCLOSE_DATA(8))[1:-1] + # J3 = self.__jcouplings[2] + # U3 = str(ctx.ENCLOSE_DATA(5))[1:-1] - L4 = str(ctx.ENCLOSE_DATA(9))[1:-1] + L4 = str(ctx.ENCLOSE_DATA(6))[1:-1] P4 = float(str(ctx.Float(9))) W4 = float(str(ctx.Float(10))) B4 = float(str(ctx.Float(11))) # E4 = str(ctx.Simple_name(3)) - # J4 = str(ctx.ENCLOSE_DATA(10))[1:-1] - # U4 = str(ctx.ENCLOSE_DATA(11))[1:-1] + # J4 = self.__jcouplings[3] + # U4 = str(ctx.ENCLOSE_DATA(7))[1:-1] vol = str(ctx.Float(12)) _int = str(ctx.Float(13)) stat = int(str(ctx.Integer(1))) - if ctx.ENCLOSE_DATA(12): - comment = str(ctx.ENCLOSE_DATA(12))[1:-1] + if ctx.ENCLOSE_DATA(8): + comment = str(ctx.ENCLOSE_DATA(8))[1:-1] if comment in emptyValue: comment = None else: @@ -570,16 +572,16 @@ def exitPeak_4d(self, ctx: NmrViewPKParser.Peak_4dContext): assignment0 = self.extractPeakAssignment(1, L1, index) if assignment0 is not None: - assignments[0] = assignment0[0] + a1 = assignment0[0] assignment1 = self.extractPeakAssignment(1, L2, index) if assignment1 is not None: - assignments[1] = assignment1[0] + a2 = assignment1[0] assignment2 = self.extractPeakAssignment(1, L3, index) if assignment2 is not None: - assignments[2] = assignment2[0] + a3 = assignment2[0] assignment3 = self.extractPeakAssignment(1, L4, index) if assignment3 is not None: - assignments[3] = assignment3[0] + a4 = assignment3[0] if all(len(a) > 0 for a in assignments): @@ -588,11 +590,6 @@ def exitPeak_4d(self, ctx: NmrViewPKParser.Peak_4dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - a4 = assignments[3] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -625,10 +622,10 @@ def exitPeak_4d(self, ctx: NmrViewPKParser.Peak_4dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(4, a4['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(4, self.atomSelectionSet[3][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -745,10 +742,10 @@ def exitPeak_wo_eju_2d(self, ctx: NmrViewPKParser.Peak_wo_eju_2dContext): assignment0 = self.extractPeakAssignment(1, L1, index) if assignment0 is not None: - assignments[0] = assignment0[0] + a1 = assignment0[0] assignment1 = self.extractPeakAssignment(1, L2, index) if assignment1 is not None: - assignments[1] = assignment1[0] + a2 = assignment1[0] if all(len(a) > 0 for a in assignments): @@ -757,9 +754,6 @@ def exitPeak_wo_eju_2d(self, ctx: NmrViewPKParser.Peak_wo_eju_2dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -782,8 +776,8 @@ def exitPeak_wo_eju_2d(self, ctx: NmrViewPKParser.Peak_wo_eju_2dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -897,13 +891,13 @@ def exitPeak_wo_eju_3d(self, ctx: NmrViewPKParser.Peak_wo_eju_3dContext): assignment0 = self.extractPeakAssignment(1, L1, index) if assignment0 is not None: - assignments[0] = assignment0[0] + a1 = assignment0[0] assignment1 = self.extractPeakAssignment(1, L2, index) if assignment1 is not None: - assignments[1] = assignment1[0] + a2 = assignment1[0] assignment2 = self.extractPeakAssignment(1, L3, index) if assignment2 is not None: - assignments[2] = assignment2[0] + a3 = assignment2[0] if all(len(a) > 0 for a in assignments): @@ -912,10 +906,6 @@ def exitPeak_wo_eju_3d(self, ctx: NmrViewPKParser.Peak_wo_eju_3dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -943,9 +933,9 @@ def exitPeak_wo_eju_3d(self, ctx: NmrViewPKParser.Peak_wo_eju_3dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -1073,16 +1063,16 @@ def exitPeak_wo_eju_4d(self, ctx: NmrViewPKParser.Peak_wo_eju_4dContext): assignment0 = self.extractPeakAssignment(1, L1, index) if assignment0 is not None: - assignments[0] = assignment0[0] + a1 = assignment0[0] assignment1 = self.extractPeakAssignment(1, L2, index) if assignment1 is not None: - assignments[1] = assignment1[0] + a2 = assignment1[0] assignment2 = self.extractPeakAssignment(1, L3, index) if assignment2 is not None: - assignments[2] = assignment2[0] + a3 = assignment2[0] assignment3 = self.extractPeakAssignment(1, L4, index) if assignment3 is not None: - assignments[3] = assignment3[0] + a4 = assignment3[0] if all(len(a) > 0 for a in assignments): @@ -1091,11 +1081,6 @@ def exitPeak_wo_eju_4d(self, ctx: NmrViewPKParser.Peak_wo_eju_4dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - a4 = assignments[3] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -1128,10 +1113,10 @@ def exitPeak_wo_eju_4d(self, ctx: NmrViewPKParser.Peak_wo_eju_4dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(4, a4['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(4, self.atomSelectionSet[3][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -1191,7 +1176,25 @@ def enterLabel(self, ctx: NmrViewPKParser.LabelContext): self.__labels[self.__cur_label_type].append(float(value)) # Exit a parse tree produced by NmrViewPKParser#label. - def exitLabel(self, ctx: NmrViewPKParser.LabelContext): + def exitLabel(self, ctx: NmrViewPKParser.LabelContext): # pylint: disable=unused-argument + pass + + # Enter a parse tree produced by NmrViewPKParser#jcoupling. + def enterJcoupling(self, ctx: NmrViewPKParser.JcouplingContext): + if ctx.Float(): + self.__jcouplings.append(float(str(ctx.Float()))) + elif ctx.Simple_name(): + self.__jcouplings.append(str(ctx.Simple_name())) + else: + value = str(ctx.ENCLOSE_DATA())[1:-1].strip() + try: + _value = float(value) + self.__jcouplings.append(_value) + except ValueError: + self.__jcouplings.append(value) + + # Exit a parse tree produced by NmrViewPKParser#jcoupling. + def exitJcoupling(self, ctx: NmrViewPKParser.JcouplingContext): # pylint: disable=unused-argument pass diff --git a/wwpdb/utils/nmr/pk/NmrViewPKReader.py b/wwpdb/utils/nmr/pk/NmrViewPKReader.py index 5df32cbc..872d4ef0 100644 --- a/wwpdb/utils/nmr/pk/NmrViewPKReader.py +++ b/wwpdb/utils/nmr/pk/NmrViewPKReader.py @@ -92,7 +92,7 @@ def setParserMaxErrorReport(self, maxErrReport): self.__maxParserErrorReport = maxErrReport def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, - createSfDict=False, originalFileName=None, listIdCounter=None, entryId=None): + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): """ Parse NMRVIEW PK file. @return: NmrViewPKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. """ @@ -172,6 +172,8 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, listener.setOriginaFileName(originalFileName) if listIdCounter is not None: listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) if entryId is not None: listener.setEntryId(entryId) walker.walk(listener, tree) @@ -210,6 +212,11 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, if __name__ == "__main__": + reader = NmrViewPKReader(True) + reader.setDebugMode(True) + reader.parse('../../tests-nmr/mock-data-remediation/2la0/2la0-corrected-div_ext.mr', + '../../tests-nmr/mock-data-remediation/2la0/2la0.cif') + reader = NmrViewPKReader(True) reader.setDebugMode(True) reader.parse('../../tests-nmr/mock-data-remediation/6iws/e170209_15n_noesy.xpk', diff --git a/wwpdb/utils/nmr/pk/SparkyPKLexer.py b/wwpdb/utils/nmr/pk/SparkyPKLexer.py index 7549cbab..30bfb892 100644 --- a/wwpdb/utils/nmr/pk/SparkyPKLexer.py +++ b/wwpdb/utils/nmr/pk/SparkyPKLexer.py @@ -48,36 +48,36 @@ def serializedATN(): 8,24,0,26,9,28,10,30,11,32,0,34,0,36,0,38,0,40,0,42,12,44,13,46, 14,48,15,50,16,52,17,54,18,56,19,58,20,60,21,62,22,64,23,66,24,68, 25,2,0,1,10,2,0,43,43,45,45,2,0,69,69,101,101,1,0,48,57,2,0,10,10, - 13,13,4,0,38,38,44,44,46,47,59,59,2,0,65,90,97,122,4,0,35,35,42, - 43,63,63,95,95,2,0,34,34,39,39,2,0,9,9,32,32,5,0,33,33,35,35,38, - 38,59,59,92,92,438,0,2,1,0,0,0,0,4,1,0,0,0,0,6,1,0,0,0,0,8,1,0,0, - 0,0,10,1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,0,0,22,1,0,0,0,0,26,1,0,0, - 0,0,28,1,0,0,0,0,30,1,0,0,0,0,42,1,0,0,0,0,44,1,0,0,0,0,46,1,0,0, - 0,0,48,1,0,0,0,0,50,1,0,0,0,1,52,1,0,0,0,1,54,1,0,0,0,1,56,1,0,0, - 0,1,58,1,0,0,0,1,60,1,0,0,0,1,62,1,0,0,0,1,64,1,0,0,0,1,66,1,0,0, - 0,1,68,1,0,0,0,2,70,1,0,0,0,4,83,1,0,0,0,6,89,1,0,0,0,8,94,1,0,0, - 0,10,101,1,0,0,0,12,120,1,0,0,0,14,122,1,0,0,0,16,125,1,0,0,0,18, - 130,1,0,0,0,20,155,1,0,0,0,22,180,1,0,0,0,24,204,1,0,0,0,26,212, - 1,0,0,0,28,216,1,0,0,0,30,222,1,0,0,0,32,230,1,0,0,0,34,234,1,0, - 0,0,36,238,1,0,0,0,38,242,1,0,0,0,40,244,1,0,0,0,42,252,1,0,0,0, - 44,259,1,0,0,0,46,263,1,0,0,0,48,300,1,0,0,0,50,337,1,0,0,0,52,349, - 1,0,0,0,54,352,1,0,0,0,56,355,1,0,0,0,58,358,1,0,0,0,60,366,1,0, - 0,0,62,375,1,0,0,0,64,382,1,0,0,0,66,387,1,0,0,0,68,394,1,0,0,0, - 70,71,5,65,0,0,71,72,5,115,0,0,72,73,5,115,0,0,73,74,5,105,0,0,74, - 75,5,103,0,0,75,76,5,110,0,0,76,77,5,109,0,0,77,78,5,101,0,0,78, - 79,5,110,0,0,79,80,5,116,0,0,80,81,1,0,0,0,81,82,6,0,0,0,82,3,1, - 0,0,0,83,84,5,119,0,0,84,85,5,49,0,0,85,86,1,0,0,0,86,87,6,1,0,0, - 87,5,1,0,0,0,88,90,7,0,0,0,89,88,1,0,0,0,89,90,1,0,0,0,90,91,1,0, - 0,0,91,92,3,16,7,0,92,7,1,0,0,0,93,95,7,0,0,0,94,93,1,0,0,0,94,95, - 1,0,0,0,95,98,1,0,0,0,96,99,3,16,7,0,97,99,3,12,5,0,98,96,1,0,0, - 0,98,97,1,0,0,0,99,9,1,0,0,0,100,102,7,0,0,0,101,100,1,0,0,0,101, - 102,1,0,0,0,102,105,1,0,0,0,103,106,3,16,7,0,104,106,3,12,5,0,105, - 103,1,0,0,0,105,104,1,0,0,0,106,112,1,0,0,0,107,109,7,1,0,0,108, - 110,7,0,0,0,109,108,1,0,0,0,109,110,1,0,0,0,110,111,1,0,0,0,111, - 113,3,16,7,0,112,107,1,0,0,0,112,113,1,0,0,0,113,11,1,0,0,0,114, - 115,3,16,7,0,115,116,5,46,0,0,116,117,3,16,7,0,117,121,1,0,0,0,118, - 119,5,46,0,0,119,121,3,16,7,0,120,114,1,0,0,0,120,118,1,0,0,0,121, - 13,1,0,0,0,122,123,7,2,0,0,123,15,1,0,0,0,124,126,3,14,6,0,125,124, + 13,13,4,0,38,38,44,44,46,47,58,59,2,0,65,90,97,122,3,0,42,43,63, + 63,95,95,2,0,34,34,39,39,2,0,9,9,32,32,5,0,33,33,35,35,38,38,59, + 59,92,92,438,0,2,1,0,0,0,0,4,1,0,0,0,0,6,1,0,0,0,0,8,1,0,0,0,0,10, + 1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,0,0,22,1,0,0,0,0,26,1,0,0,0,0,28, + 1,0,0,0,0,30,1,0,0,0,0,42,1,0,0,0,0,44,1,0,0,0,0,46,1,0,0,0,0,48, + 1,0,0,0,0,50,1,0,0,0,1,52,1,0,0,0,1,54,1,0,0,0,1,56,1,0,0,0,1,58, + 1,0,0,0,1,60,1,0,0,0,1,62,1,0,0,0,1,64,1,0,0,0,1,66,1,0,0,0,1,68, + 1,0,0,0,2,70,1,0,0,0,4,83,1,0,0,0,6,89,1,0,0,0,8,94,1,0,0,0,10,101, + 1,0,0,0,12,120,1,0,0,0,14,122,1,0,0,0,16,125,1,0,0,0,18,130,1,0, + 0,0,20,155,1,0,0,0,22,180,1,0,0,0,24,204,1,0,0,0,26,212,1,0,0,0, + 28,216,1,0,0,0,30,222,1,0,0,0,32,230,1,0,0,0,34,234,1,0,0,0,36,238, + 1,0,0,0,38,242,1,0,0,0,40,244,1,0,0,0,42,252,1,0,0,0,44,259,1,0, + 0,0,46,263,1,0,0,0,48,300,1,0,0,0,50,337,1,0,0,0,52,349,1,0,0,0, + 54,352,1,0,0,0,56,355,1,0,0,0,58,358,1,0,0,0,60,366,1,0,0,0,62,375, + 1,0,0,0,64,382,1,0,0,0,66,387,1,0,0,0,68,394,1,0,0,0,70,71,5,65, + 0,0,71,72,5,115,0,0,72,73,5,115,0,0,73,74,5,105,0,0,74,75,5,103, + 0,0,75,76,5,110,0,0,76,77,5,109,0,0,77,78,5,101,0,0,78,79,5,110, + 0,0,79,80,5,116,0,0,80,81,1,0,0,0,81,82,6,0,0,0,82,3,1,0,0,0,83, + 84,5,119,0,0,84,85,5,49,0,0,85,86,1,0,0,0,86,87,6,1,0,0,87,5,1,0, + 0,0,88,90,7,0,0,0,89,88,1,0,0,0,89,90,1,0,0,0,90,91,1,0,0,0,91,92, + 3,16,7,0,92,7,1,0,0,0,93,95,7,0,0,0,94,93,1,0,0,0,94,95,1,0,0,0, + 95,98,1,0,0,0,96,99,3,16,7,0,97,99,3,12,5,0,98,96,1,0,0,0,98,97, + 1,0,0,0,99,9,1,0,0,0,100,102,7,0,0,0,101,100,1,0,0,0,101,102,1,0, + 0,0,102,105,1,0,0,0,103,106,3,16,7,0,104,106,3,12,5,0,105,103,1, + 0,0,0,105,104,1,0,0,0,106,112,1,0,0,0,107,109,7,1,0,0,108,110,7, + 0,0,0,109,108,1,0,0,0,109,110,1,0,0,0,110,111,1,0,0,0,111,113,3, + 16,7,0,112,107,1,0,0,0,112,113,1,0,0,0,113,11,1,0,0,0,114,115,3, + 16,7,0,115,116,5,46,0,0,116,117,3,16,7,0,117,121,1,0,0,0,118,119, + 5,46,0,0,119,121,3,16,7,0,120,114,1,0,0,0,120,118,1,0,0,0,121,13, + 1,0,0,0,122,123,7,2,0,0,123,15,1,0,0,0,124,126,3,14,6,0,125,124, 1,0,0,0,126,127,1,0,0,0,127,125,1,0,0,0,127,128,1,0,0,0,128,17,1, 0,0,0,129,131,5,35,0,0,130,129,1,0,0,0,131,132,1,0,0,0,132,130,1, 0,0,0,132,133,1,0,0,0,133,137,1,0,0,0,134,136,8,3,0,0,135,134,1, diff --git a/wwpdb/utils/nmr/pk/SparkyPKParser.py b/wwpdb/utils/nmr/pk/SparkyPKParser.py index 51f29a7b..a034359c 100644 --- a/wwpdb/utils/nmr/pk/SparkyPKParser.py +++ b/wwpdb/utils/nmr/pk/SparkyPKParser.py @@ -10,47 +10,49 @@ def serializedATN(): return [ - 4,1,25,123,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, - 6,2,7,7,7,1,0,1,0,5,0,19,8,0,10,0,12,0,22,9,0,1,0,1,0,1,1,1,1,1, - 1,1,1,3,1,30,8,1,1,1,3,1,33,8,1,1,1,1,1,3,1,37,8,1,1,1,3,1,40,8, - 1,1,1,1,1,4,1,44,8,1,11,1,12,1,45,1,1,4,1,49,8,1,11,1,12,1,50,1, - 1,4,1,54,8,1,11,1,12,1,55,3,1,58,8,1,1,2,1,2,1,2,3,2,63,8,2,1,2, - 3,2,66,8,2,1,2,1,2,3,2,70,8,2,1,2,3,2,73,8,2,1,2,1,2,4,2,77,8,2, - 11,2,12,2,78,1,3,1,3,1,3,1,3,4,3,85,8,3,11,3,12,3,86,1,3,1,3,1,4, - 1,4,1,4,1,4,1,4,4,4,96,8,4,11,4,12,4,97,1,4,1,4,1,5,1,5,1,5,1,5, - 1,5,1,5,4,5,108,8,5,11,5,12,5,109,1,5,1,5,1,6,4,6,115,8,6,11,6,12, - 6,116,1,6,1,6,1,7,1,7,1,7,0,0,8,0,2,4,6,8,10,12,14,0,1,1,0,3,5,134, - 0,20,1,0,0,0,2,25,1,0,0,0,4,59,1,0,0,0,6,80,1,0,0,0,8,90,1,0,0,0, - 10,101,1,0,0,0,12,114,1,0,0,0,14,120,1,0,0,0,16,19,3,2,1,0,17,19, - 3,4,2,0,18,16,1,0,0,0,18,17,1,0,0,0,19,22,1,0,0,0,20,18,1,0,0,0, - 20,21,1,0,0,0,21,23,1,0,0,0,22,20,1,0,0,0,23,24,5,0,0,1,24,1,1,0, - 0,0,25,26,5,1,0,0,26,27,5,17,0,0,27,29,5,18,0,0,28,30,5,19,0,0,29, - 28,1,0,0,0,29,30,1,0,0,0,30,32,1,0,0,0,31,33,5,20,0,0,32,31,1,0, - 0,0,32,33,1,0,0,0,33,34,1,0,0,0,34,36,5,21,0,0,35,37,5,22,0,0,36, - 35,1,0,0,0,36,37,1,0,0,0,37,39,1,0,0,0,38,40,5,23,0,0,39,38,1,0, - 0,0,39,40,1,0,0,0,40,41,1,0,0,0,41,57,5,25,0,0,42,44,3,6,3,0,43, - 42,1,0,0,0,44,45,1,0,0,0,45,43,1,0,0,0,45,46,1,0,0,0,46,58,1,0,0, - 0,47,49,3,8,4,0,48,47,1,0,0,0,49,50,1,0,0,0,50,48,1,0,0,0,50,51, - 1,0,0,0,51,58,1,0,0,0,52,54,3,10,5,0,53,52,1,0,0,0,54,55,1,0,0,0, - 55,53,1,0,0,0,55,56,1,0,0,0,56,58,1,0,0,0,57,43,1,0,0,0,57,48,1, - 0,0,0,57,53,1,0,0,0,58,3,1,0,0,0,59,60,5,2,0,0,60,62,5,18,0,0,61, - 63,5,19,0,0,62,61,1,0,0,0,62,63,1,0,0,0,63,65,1,0,0,0,64,66,5,20, - 0,0,65,64,1,0,0,0,65,66,1,0,0,0,66,67,1,0,0,0,67,69,5,21,0,0,68, - 70,5,22,0,0,69,68,1,0,0,0,69,70,1,0,0,0,70,72,1,0,0,0,71,73,5,23, - 0,0,72,71,1,0,0,0,72,73,1,0,0,0,73,74,1,0,0,0,74,76,5,25,0,0,75, - 77,3,12,6,0,76,75,1,0,0,0,77,78,1,0,0,0,78,76,1,0,0,0,78,79,1,0, - 0,0,79,5,1,0,0,0,80,81,5,9,0,0,81,82,5,4,0,0,82,84,5,4,0,0,83,85, - 3,14,7,0,84,83,1,0,0,0,85,86,1,0,0,0,86,84,1,0,0,0,86,87,1,0,0,0, - 87,88,1,0,0,0,88,89,5,13,0,0,89,7,1,0,0,0,90,91,5,10,0,0,91,92,5, - 4,0,0,92,93,5,4,0,0,93,95,5,4,0,0,94,96,3,14,7,0,95,94,1,0,0,0,96, - 97,1,0,0,0,97,95,1,0,0,0,97,98,1,0,0,0,98,99,1,0,0,0,99,100,5,13, - 0,0,100,9,1,0,0,0,101,102,5,11,0,0,102,103,5,4,0,0,103,104,5,4,0, - 0,104,105,5,4,0,0,105,107,5,4,0,0,106,108,3,14,7,0,107,106,1,0,0, - 0,108,109,1,0,0,0,109,107,1,0,0,0,109,110,1,0,0,0,110,111,1,0,0, - 0,111,112,5,13,0,0,112,11,1,0,0,0,113,115,3,14,7,0,114,113,1,0,0, - 0,115,116,1,0,0,0,116,114,1,0,0,0,116,117,1,0,0,0,117,118,1,0,0, - 0,118,119,5,13,0,0,119,13,1,0,0,0,120,121,7,0,0,0,121,15,1,0,0,0, - 19,18,20,29,32,36,39,45,50,55,57,62,65,69,72,78,86,97,109,116 + 4,1,25,125,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,1,0,3,0,18,8,0,1,0,1,0,1,0,4,0,23,8,0,11,0,12,0,24,1,0, + 4,0,28,8,0,11,0,12,0,29,1,0,4,0,33,8,0,11,0,12,0,34,5,0,37,8,0,10, + 0,12,0,40,9,0,1,0,1,0,1,1,1,1,1,1,1,1,3,1,48,8,1,1,1,3,1,51,8,1, + 1,1,1,1,3,1,55,8,1,1,1,3,1,58,8,1,1,1,1,1,1,2,1,2,1,2,3,2,65,8,2, + 1,2,3,2,68,8,2,1,2,1,2,3,2,72,8,2,1,2,3,2,75,8,2,1,2,1,2,4,2,79, + 8,2,11,2,12,2,80,1,3,1,3,1,3,1,3,4,3,87,8,3,11,3,12,3,88,1,3,1,3, + 1,4,1,4,1,4,1,4,1,4,4,4,98,8,4,11,4,12,4,99,1,4,1,4,1,5,1,5,1,5, + 1,5,1,5,1,5,4,5,110,8,5,11,5,12,5,111,1,5,1,5,1,6,4,6,117,8,6,11, + 6,12,6,118,1,6,1,6,1,7,1,7,1,7,0,0,8,0,2,4,6,8,10,12,14,0,1,1,0, + 3,5,138,0,17,1,0,0,0,2,43,1,0,0,0,4,61,1,0,0,0,6,82,1,0,0,0,8,92, + 1,0,0,0,10,103,1,0,0,0,12,116,1,0,0,0,14,122,1,0,0,0,16,18,5,13, + 0,0,17,16,1,0,0,0,17,18,1,0,0,0,18,38,1,0,0,0,19,37,3,2,1,0,20,37, + 3,4,2,0,21,23,3,6,3,0,22,21,1,0,0,0,23,24,1,0,0,0,24,22,1,0,0,0, + 24,25,1,0,0,0,25,37,1,0,0,0,26,28,3,8,4,0,27,26,1,0,0,0,28,29,1, + 0,0,0,29,27,1,0,0,0,29,30,1,0,0,0,30,37,1,0,0,0,31,33,3,10,5,0,32, + 31,1,0,0,0,33,34,1,0,0,0,34,32,1,0,0,0,34,35,1,0,0,0,35,37,1,0,0, + 0,36,19,1,0,0,0,36,20,1,0,0,0,36,22,1,0,0,0,36,27,1,0,0,0,36,32, + 1,0,0,0,37,40,1,0,0,0,38,36,1,0,0,0,38,39,1,0,0,0,39,41,1,0,0,0, + 40,38,1,0,0,0,41,42,5,0,0,1,42,1,1,0,0,0,43,44,5,1,0,0,44,45,5,17, + 0,0,45,47,5,18,0,0,46,48,5,19,0,0,47,46,1,0,0,0,47,48,1,0,0,0,48, + 50,1,0,0,0,49,51,5,20,0,0,50,49,1,0,0,0,50,51,1,0,0,0,51,52,1,0, + 0,0,52,54,5,21,0,0,53,55,5,22,0,0,54,53,1,0,0,0,54,55,1,0,0,0,55, + 57,1,0,0,0,56,58,5,23,0,0,57,56,1,0,0,0,57,58,1,0,0,0,58,59,1,0, + 0,0,59,60,5,25,0,0,60,3,1,0,0,0,61,62,5,2,0,0,62,64,5,18,0,0,63, + 65,5,19,0,0,64,63,1,0,0,0,64,65,1,0,0,0,65,67,1,0,0,0,66,68,5,20, + 0,0,67,66,1,0,0,0,67,68,1,0,0,0,68,69,1,0,0,0,69,71,5,21,0,0,70, + 72,5,22,0,0,71,70,1,0,0,0,71,72,1,0,0,0,72,74,1,0,0,0,73,75,5,23, + 0,0,74,73,1,0,0,0,74,75,1,0,0,0,75,76,1,0,0,0,76,78,5,25,0,0,77, + 79,3,12,6,0,78,77,1,0,0,0,79,80,1,0,0,0,80,78,1,0,0,0,80,81,1,0, + 0,0,81,5,1,0,0,0,82,83,5,9,0,0,83,84,5,4,0,0,84,86,5,4,0,0,85,87, + 3,14,7,0,86,85,1,0,0,0,87,88,1,0,0,0,88,86,1,0,0,0,88,89,1,0,0,0, + 89,90,1,0,0,0,90,91,5,13,0,0,91,7,1,0,0,0,92,93,5,10,0,0,93,94,5, + 4,0,0,94,95,5,4,0,0,95,97,5,4,0,0,96,98,3,14,7,0,97,96,1,0,0,0,98, + 99,1,0,0,0,99,97,1,0,0,0,99,100,1,0,0,0,100,101,1,0,0,0,101,102, + 5,13,0,0,102,9,1,0,0,0,103,104,5,11,0,0,104,105,5,4,0,0,105,106, + 5,4,0,0,106,107,5,4,0,0,107,109,5,4,0,0,108,110,3,14,7,0,109,108, + 1,0,0,0,110,111,1,0,0,0,111,109,1,0,0,0,111,112,1,0,0,0,112,113, + 1,0,0,0,113,114,5,13,0,0,114,11,1,0,0,0,115,117,3,14,7,0,116,115, + 1,0,0,0,117,118,1,0,0,0,118,116,1,0,0,0,118,119,1,0,0,0,119,120, + 1,0,0,0,120,121,5,13,0,0,121,13,1,0,0,0,122,123,7,0,0,0,123,15,1, + 0,0,0,19,17,24,29,34,36,38,47,50,54,57,64,67,71,74,80,88,99,111, + 118 ] class SparkyPKParser ( Parser ): @@ -135,6 +137,9 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): def EOF(self): return self.getToken(SparkyPKParser.EOF, 0) + def RETURN(self): + return self.getToken(SparkyPKParser.RETURN, 0) + def data_label(self, i:int=None): if i is None: return self.getTypedRuleContexts(SparkyPKParser.Data_labelContext) @@ -149,6 +154,27 @@ def data_label_wo_assign(self, i:int=None): return self.getTypedRuleContext(SparkyPKParser.Data_label_wo_assignContext,i) + def peak_2d(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SparkyPKParser.Peak_2dContext) + else: + return self.getTypedRuleContext(SparkyPKParser.Peak_2dContext,i) + + + def peak_3d(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SparkyPKParser.Peak_3dContext) + else: + return self.getTypedRuleContext(SparkyPKParser.Peak_3dContext,i) + + + def peak_4d(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(SparkyPKParser.Peak_4dContext) + else: + return self.getTypedRuleContext(SparkyPKParser.Peak_4dContext,i) + + def getRuleIndex(self): return SparkyPKParser.RULE_sparky_pk @@ -170,29 +196,85 @@ def sparky_pk(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 20 + self.state = 17 self._errHandler.sync(self) _la = self._input.LA(1) - while _la==1 or _la==2: - self.state = 18 + if _la==13: + self.state = 16 + self.match(SparkyPKParser.RETURN) + + + self.state = 38 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 3590) != 0): + self.state = 36 self._errHandler.sync(self) token = self._input.LA(1) if token in [1]: - self.state = 16 + self.state = 19 self.data_label() pass elif token in [2]: - self.state = 17 + self.state = 20 self.data_label_wo_assign() + pass + elif token in [9]: + self.state = 22 + self._errHandler.sync(self) + _alt = 1 + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt == 1: + self.state = 21 + self.peak_2d() + + else: + raise NoViableAltException(self) + self.state = 24 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,1,self._ctx) + + pass + elif token in [10]: + self.state = 27 + self._errHandler.sync(self) + _alt = 1 + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt == 1: + self.state = 26 + self.peak_3d() + + else: + raise NoViableAltException(self) + self.state = 29 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,2,self._ctx) + + pass + elif token in [11]: + self.state = 32 + self._errHandler.sync(self) + _alt = 1 + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt == 1: + self.state = 31 + self.peak_4d() + + else: + raise NoViableAltException(self) + self.state = 34 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,3,self._ctx) + pass else: raise NoViableAltException(self) - self.state = 22 + self.state = 40 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 23 + self.state = 41 self.match(SparkyPKParser.EOF) except RecognitionException as re: localctx.exception = re @@ -237,27 +319,6 @@ def Volume_LA(self): def S_N_LA(self): return self.getToken(SparkyPKParser.S_N_LA, 0) - def peak_2d(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(SparkyPKParser.Peak_2dContext) - else: - return self.getTypedRuleContext(SparkyPKParser.Peak_2dContext,i) - - - def peak_3d(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(SparkyPKParser.Peak_3dContext) - else: - return self.getTypedRuleContext(SparkyPKParser.Peak_3dContext,i) - - - def peak_4d(self, i:int=None): - if i is None: - return self.getTypedRuleContexts(SparkyPKParser.Peak_4dContext) - else: - return self.getTypedRuleContext(SparkyPKParser.Peak_4dContext,i) - - def getRuleIndex(self): return SparkyPKParser.RULE_data_label @@ -279,96 +340,48 @@ def data_label(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 25 + self.state = 43 self.match(SparkyPKParser.Assignment) - self.state = 26 + self.state = 44 self.match(SparkyPKParser.W1_LA) - self.state = 27 + self.state = 45 self.match(SparkyPKParser.W2_LA) - self.state = 29 + self.state = 47 self._errHandler.sync(self) _la = self._input.LA(1) if _la==19: - self.state = 28 + self.state = 46 self.match(SparkyPKParser.W3_LA) - self.state = 32 + self.state = 50 self._errHandler.sync(self) _la = self._input.LA(1) if _la==20: - self.state = 31 + self.state = 49 self.match(SparkyPKParser.W4_LA) - self.state = 34 + self.state = 52 self.match(SparkyPKParser.Height_LA) - self.state = 36 + self.state = 54 self._errHandler.sync(self) _la = self._input.LA(1) if _la==22: - self.state = 35 + self.state = 53 self.match(SparkyPKParser.Volume_LA) - self.state = 39 + self.state = 57 self._errHandler.sync(self) _la = self._input.LA(1) if _la==23: - self.state = 38 + self.state = 56 self.match(SparkyPKParser.S_N_LA) - self.state = 41 + self.state = 59 self.match(SparkyPKParser.RETURN_LA) - self.state = 57 - self._errHandler.sync(self) - token = self._input.LA(1) - if token in [9]: - self.state = 43 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 42 - self.peak_2d() - self.state = 45 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not (_la==9): - break - - pass - elif token in [10]: - self.state = 48 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 47 - self.peak_3d() - self.state = 50 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not (_la==10): - break - - pass - elif token in [11]: - self.state = 53 - self._errHandler.sync(self) - _la = self._input.LA(1) - while True: - self.state = 52 - self.peak_4d() - self.state = 55 - self._errHandler.sync(self) - _la = self._input.LA(1) - if not (_la==11): - break - - pass - else: - raise NoViableAltException(self) - except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) @@ -437,53 +450,53 @@ def data_label_wo_assign(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 59 + self.state = 61 self.match(SparkyPKParser.W1) - self.state = 60 - self.match(SparkyPKParser.W2_LA) self.state = 62 + self.match(SparkyPKParser.W2_LA) + self.state = 64 self._errHandler.sync(self) _la = self._input.LA(1) if _la==19: - self.state = 61 + self.state = 63 self.match(SparkyPKParser.W3_LA) - self.state = 65 + self.state = 67 self._errHandler.sync(self) _la = self._input.LA(1) if _la==20: - self.state = 64 + self.state = 66 self.match(SparkyPKParser.W4_LA) - self.state = 67 - self.match(SparkyPKParser.Height_LA) self.state = 69 + self.match(SparkyPKParser.Height_LA) + self.state = 71 self._errHandler.sync(self) _la = self._input.LA(1) if _la==22: - self.state = 68 + self.state = 70 self.match(SparkyPKParser.Volume_LA) - self.state = 72 + self.state = 74 self._errHandler.sync(self) _la = self._input.LA(1) if _la==23: - self.state = 71 + self.state = 73 self.match(SparkyPKParser.S_N_LA) - self.state = 74 + self.state = 76 self.match(SparkyPKParser.RETURN_LA) - self.state = 76 + self.state = 78 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 75 + self.state = 77 self.peak_wo_assign() - self.state = 78 + self.state = 80 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 56) != 0)): @@ -545,25 +558,25 @@ def peak_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 80 + self.state = 82 self.match(SparkyPKParser.Assignment_2d_ex) - self.state = 81 + self.state = 83 self.match(SparkyPKParser.Float) - self.state = 82 + self.state = 84 self.match(SparkyPKParser.Float) - self.state = 84 + self.state = 86 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 83 + self.state = 85 self.number() - self.state = 86 + self.state = 88 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 56) != 0)): break - self.state = 88 + self.state = 90 self.match(SparkyPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -621,27 +634,27 @@ def peak_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 90 + self.state = 92 self.match(SparkyPKParser.Assignment_3d_ex) - self.state = 91 + self.state = 93 self.match(SparkyPKParser.Float) - self.state = 92 + self.state = 94 self.match(SparkyPKParser.Float) - self.state = 93 + self.state = 95 self.match(SparkyPKParser.Float) - self.state = 95 + self.state = 97 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 94 + self.state = 96 self.number() - self.state = 97 + self.state = 99 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 56) != 0)): break - self.state = 99 + self.state = 101 self.match(SparkyPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -699,29 +712,29 @@ def peak_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 101 - self.match(SparkyPKParser.Assignment_4d_ex) - self.state = 102 - self.match(SparkyPKParser.Float) self.state = 103 - self.match(SparkyPKParser.Float) + self.match(SparkyPKParser.Assignment_4d_ex) self.state = 104 self.match(SparkyPKParser.Float) self.state = 105 self.match(SparkyPKParser.Float) - self.state = 107 + self.state = 106 + self.match(SparkyPKParser.Float) + self.state = 107 + self.match(SparkyPKParser.Float) + self.state = 109 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 106 + self.state = 108 self.number() - self.state = 109 + self.state = 111 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 56) != 0)): break - self.state = 111 + self.state = 113 self.match(SparkyPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -770,19 +783,19 @@ def peak_wo_assign(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 114 + self.state = 116 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 113 + self.state = 115 self.number() - self.state = 116 + self.state = 118 self._errHandler.sync(self) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & 56) != 0)): break - self.state = 118 + self.state = 120 self.match(SparkyPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -830,7 +843,7 @@ def number(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 120 + self.state = 122 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 56) != 0)): self._errHandler.recoverInline(self) diff --git a/wwpdb/utils/nmr/pk/SparkyPKParserListener.py b/wwpdb/utils/nmr/pk/SparkyPKParserListener.py index 07e72d45..267ebef4 100644 --- a/wwpdb/utils/nmr/pk/SparkyPKParserListener.py +++ b/wwpdb/utils/nmr/pk/SparkyPKParserListener.py @@ -74,7 +74,7 @@ def exitData_label(self, ctx: SparkyPKParser.Data_labelContext): # pylint: disa # Enter a parse tree produced by SparkyPKParser#data_label_wo_assign. def enterData_label_wo_assign(self, ctx: SparkyPKParser.Data_label_wo_assignContext): - if ctx.W1_LA(): + if ctx.W1(): self.num_of_dim = max(self.num_of_dim, 1) if ctx.W2_LA(): self.num_of_dim = max(self.num_of_dim, 2) @@ -96,6 +96,10 @@ def exitData_label_wo_assign(self, ctx: SparkyPKParser.Data_label_wo_assignConte # Enter a parse tree produced by SparkyPKParser#peak_2d. def enterPeak_2d(self, ctx: SparkyPKParser.Peak_2dContext): # pylint: disable=unused-argument + if self.cur_subtype != 'peak2d': + self.num_of_dim = 2 + self.initSpectralDim() + self.peaks2D += 1 self.atomSelectionSet.clear() @@ -180,8 +184,8 @@ def exitPeak_2d(self, ctx: SparkyPKParser.Peak_2dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -220,6 +224,10 @@ def exitPeak_2d(self, ctx: SparkyPKParser.Peak_2dContext): # Enter a parse tree produced by SparkyPKParser#peak_3d. def enterPeak_3d(self, ctx: SparkyPKParser.Peak_3dContext): # pylint: disable=unused-argument + if self.cur_subtype != 'peak3d': + self.num_of_dim = 3 + self.initSpectralDim() + self.peaks3D += 1 self.atomSelectionSet.clear() @@ -312,9 +320,9 @@ def exitPeak_3d(self, ctx: SparkyPKParser.Peak_3dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() @@ -361,6 +369,10 @@ def exitPeak_3d(self, ctx: SparkyPKParser.Peak_3dContext): # Enter a parse tree produced by SparkyPKParser#peak_4d. def enterPeak_4d(self, ctx: SparkyPKParser.Peak_4dContext): # pylint: disable=unused-argument + if self.cur_subtype != 'peak4d': + self.num_of_dim = 4 + self.initSpectralDim() + self.peaks4D += 1 self.atomSelectionSet.clear() @@ -461,10 +473,10 @@ def exitPeak_4d(self, ctx: SparkyPKParser.Peak_4dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(4, a4['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(4, self.atomSelectionSet[3][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() diff --git a/wwpdb/utils/nmr/pk/SparkyPKReader.py b/wwpdb/utils/nmr/pk/SparkyPKReader.py index 85af99de..aa08f340 100644 --- a/wwpdb/utils/nmr/pk/SparkyPKReader.py +++ b/wwpdb/utils/nmr/pk/SparkyPKReader.py @@ -92,7 +92,7 @@ def setParserMaxErrorReport(self, maxErrReport): self.__maxParserErrorReport = maxErrReport def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, - createSfDict=False, originalFileName=None, listIdCounter=None, entryId=None): + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): """ Parse SPARKY PK file. @return: SparkyPKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. """ @@ -172,6 +172,8 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, listener.setOriginaFileName(originalFileName) if listIdCounter is not None: listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) if entryId is not None: listener.setEntryId(entryId) walker.walk(listener, tree) @@ -210,6 +212,11 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, if __name__ == "__main__": + reader = SparkyPKReader(True) + reader.setDebugMode(True) + reader.parse('../../tests-nmr/mock-data-remediation/2k5w/2k5w-corrected-div_dst.mr', + '../../tests-nmr/mock-data-remediation/2k5w/2k5w.cif') + reader = SparkyPKReader(True) reader.setDebugMode(True) reader.parse('../../tests-nmr/mock-data-remediation/2js7/2js7-trimmed-div_ext.mr', diff --git a/wwpdb/utils/nmr/pk/TopSpinPKParserListener.py b/wwpdb/utils/nmr/pk/TopSpinPKParserListener.py index 64dc82b1..8b1b3ec3 100644 --- a/wwpdb/utils/nmr/pk/TopSpinPKParserListener.py +++ b/wwpdb/utils/nmr/pk/TopSpinPKParserListener.py @@ -302,15 +302,15 @@ def enterAttribute(self, ctx: XMLParser.AttributeContext): self.__annotation = string # Exit a parse tree produced by XMLParser#attribute. - def exitAttribute(self, ctx: XMLParser.AttributeContext): + def exitAttribute(self, ctx: XMLParser.AttributeContext): # pylint: disable=unused-argument pass # Enter a parse tree produced by XMLParser#chardata. - def enterChardata(self, ctx: XMLParser.ChardataContext): + def enterChardata(self, ctx: XMLParser.ChardataContext): # pylint: disable=unused-argument pass # Exit a parse tree produced by XMLParser#chardata. - def exitChardata(self, ctx: XMLParser.ChardataContext): + def exitChardata(self, ctx: XMLParser.ChardataContext): # pylint: disable=unused-argument pass # Enter a parse tree produced by XMLParser#misc. diff --git a/wwpdb/utils/nmr/pk/TopSpinPKReader.py b/wwpdb/utils/nmr/pk/TopSpinPKReader.py index defe3535..eb5a9d24 100644 --- a/wwpdb/utils/nmr/pk/TopSpinPKReader.py +++ b/wwpdb/utils/nmr/pk/TopSpinPKReader.py @@ -92,7 +92,7 @@ def setParserMaxErrorReport(self, maxErrReport): self.__maxParserErrorReport = maxErrReport def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, - createSfDict=False, originalFileName=None, listIdCounter=None, entryId=None): + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): """ Parse TOPSPIN PK file. @return: TopSpinPKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. """ @@ -172,6 +172,8 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, listener.setOriginaFileName(originalFileName) if listIdCounter is not None: listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) if entryId is not None: listener.setEntryId(entryId) walker.walk(listener, tree) diff --git a/wwpdb/utils/nmr/pk/VnmrPKLexer.py b/wwpdb/utils/nmr/pk/VnmrPKLexer.py new file mode 100644 index 00000000..cb5f752f --- /dev/null +++ b/wwpdb/utils/nmr/pk/VnmrPKLexer.py @@ -0,0 +1,257 @@ +# Generated from VnmrPKLexer.g4 by ANTLR 4.13.0 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,27,457,6,-1,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5, + 7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12, + 2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19, + 7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25, + 2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32, + 7,32,2,33,7,33,2,34,7,34,2,35,7,35,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, + 0,1,0,1,0,1,0,1,1,3,1,87,8,1,1,1,1,1,1,2,3,2,92,8,2,1,2,1,2,3,2, + 96,8,2,1,3,3,3,99,8,3,1,3,1,3,3,3,103,8,3,1,3,1,3,3,3,107,8,3,1, + 3,3,3,110,8,3,1,4,1,4,1,4,1,4,1,4,1,4,3,4,118,8,4,1,5,1,5,1,6,4, + 6,123,8,6,11,6,12,6,124,1,7,4,7,128,8,7,11,7,12,7,129,1,7,5,7,133, + 8,7,10,7,12,7,136,9,7,1,7,5,7,139,8,7,10,7,12,7,142,9,7,1,7,5,7, + 145,8,7,10,7,12,7,148,9,7,1,7,1,7,1,8,4,8,153,8,8,11,8,12,8,154, + 1,8,5,8,158,8,8,10,8,12,8,161,9,8,1,8,5,8,164,8,8,10,8,12,8,167, + 9,8,1,8,5,8,170,8,8,10,8,12,8,173,9,8,1,8,1,8,1,9,4,9,178,8,9,11, + 9,12,9,179,1,9,5,9,183,8,9,10,9,12,9,186,9,9,1,9,5,9,189,8,9,10, + 9,12,9,192,9,9,1,9,5,9,195,8,9,10,9,12,9,198,9,9,1,9,1,9,1,10,1, + 10,1,10,5,10,205,8,10,10,10,12,10,208,9,10,1,11,1,11,1,11,1,11,1, + 12,1,12,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1, + 13,1,14,1,14,1,15,1,15,3,15,232,8,15,1,16,1,16,3,16,236,8,16,1,17, + 1,17,3,17,240,8,17,1,18,1,18,5,18,244,8,18,10,18,12,18,247,9,18, + 1,19,4,19,250,8,19,11,19,12,19,251,1,19,1,19,1,20,4,20,257,8,20, + 11,20,12,20,258,1,21,1,21,1,21,5,21,264,8,21,10,21,12,21,267,9,21, + 1,21,1,21,1,21,1,21,1,22,1,22,1,22,4,22,276,8,22,11,22,12,22,277, + 1,22,1,22,4,22,282,8,22,11,22,12,22,283,1,22,1,22,4,22,288,8,22, + 11,22,12,22,289,1,22,1,22,1,22,1,22,1,22,1,22,3,22,298,8,22,1,22, + 5,22,301,8,22,10,22,12,22,304,9,22,1,22,1,22,1,22,1,22,1,23,1,23, + 1,23,4,23,313,8,23,11,23,12,23,314,1,23,1,23,4,23,319,8,23,11,23, + 12,23,320,1,23,1,23,4,23,325,8,23,11,23,12,23,326,1,23,1,23,1,23, + 1,23,1,23,1,23,3,23,335,8,23,1,23,5,23,338,8,23,10,23,12,23,341, + 9,23,1,23,1,23,1,23,1,23,1,24,1,24,1,24,1,24,1,24,1,24,1,24,1,24, + 1,24,1,24,1,24,1,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25, + 1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26,1,26, + 1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27,1,27, + 1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29, + 1,29,1,29,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,31, + 1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32, + 1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,34,4,34, + 445,8,34,11,34,12,34,446,1,34,1,34,1,35,4,35,452,8,35,11,35,12,35, + 453,1,35,1,35,1,265,0,36,2,1,4,2,6,3,8,4,10,0,12,0,14,0,16,5,18, + 6,20,7,22,0,24,8,26,9,28,10,30,0,32,0,34,0,36,0,38,0,40,11,42,12, + 44,13,46,14,48,15,50,16,52,17,54,18,56,19,58,20,60,21,62,22,64,23, + 66,24,68,25,70,26,72,27,2,0,1,10,2,0,43,43,45,45,2,0,69,69,101,101, + 1,0,48,57,2,0,10,10,13,13,4,0,38,38,44,44,46,47,58,59,2,0,65,90, + 97,122,3,0,42,43,63,63,95,95,2,0,34,34,39,39,2,0,9,9,32,32,5,0,33, + 33,35,35,38,38,59,59,92,92,494,0,2,1,0,0,0,0,4,1,0,0,0,0,6,1,0,0, + 0,0,8,1,0,0,0,0,16,1,0,0,0,0,18,1,0,0,0,0,20,1,0,0,0,0,24,1,0,0, + 0,0,26,1,0,0,0,0,28,1,0,0,0,0,40,1,0,0,0,0,42,1,0,0,0,0,44,1,0,0, + 0,0,46,1,0,0,0,0,48,1,0,0,0,1,50,1,0,0,0,1,52,1,0,0,0,1,54,1,0,0, + 0,1,56,1,0,0,0,1,58,1,0,0,0,1,60,1,0,0,0,1,62,1,0,0,0,1,64,1,0,0, + 0,1,66,1,0,0,0,1,68,1,0,0,0,1,70,1,0,0,0,1,72,1,0,0,0,2,74,1,0,0, + 0,4,86,1,0,0,0,6,91,1,0,0,0,8,98,1,0,0,0,10,117,1,0,0,0,12,119,1, + 0,0,0,14,122,1,0,0,0,16,127,1,0,0,0,18,152,1,0,0,0,20,177,1,0,0, + 0,22,201,1,0,0,0,24,209,1,0,0,0,26,213,1,0,0,0,28,219,1,0,0,0,30, + 227,1,0,0,0,32,231,1,0,0,0,34,235,1,0,0,0,36,239,1,0,0,0,38,241, + 1,0,0,0,40,249,1,0,0,0,42,256,1,0,0,0,44,260,1,0,0,0,46,297,1,0, + 0,0,48,334,1,0,0,0,50,346,1,0,0,0,52,358,1,0,0,0,54,370,1,0,0,0, + 56,382,1,0,0,0,58,394,1,0,0,0,60,401,1,0,0,0,62,408,1,0,0,0,64,415, + 1,0,0,0,66,422,1,0,0,0,68,432,1,0,0,0,70,444,1,0,0,0,72,451,1,0, + 0,0,74,75,5,112,0,0,75,76,5,101,0,0,76,77,5,97,0,0,77,78,5,107,0, + 0,78,79,5,32,0,0,79,80,5,105,0,0,80,81,5,100,0,0,81,82,5,46,0,0, + 82,83,1,0,0,0,83,84,6,0,0,0,84,3,1,0,0,0,85,87,7,0,0,0,86,85,1,0, + 0,0,86,87,1,0,0,0,87,88,1,0,0,0,88,89,3,14,6,0,89,5,1,0,0,0,90,92, + 7,0,0,0,91,90,1,0,0,0,91,92,1,0,0,0,92,95,1,0,0,0,93,96,3,14,6,0, + 94,96,3,10,4,0,95,93,1,0,0,0,95,94,1,0,0,0,96,7,1,0,0,0,97,99,7, + 0,0,0,98,97,1,0,0,0,98,99,1,0,0,0,99,102,1,0,0,0,100,103,3,14,6, + 0,101,103,3,10,4,0,102,100,1,0,0,0,102,101,1,0,0,0,103,109,1,0,0, + 0,104,106,7,1,0,0,105,107,7,0,0,0,106,105,1,0,0,0,106,107,1,0,0, + 0,107,108,1,0,0,0,108,110,3,14,6,0,109,104,1,0,0,0,109,110,1,0,0, + 0,110,9,1,0,0,0,111,112,3,14,6,0,112,113,5,46,0,0,113,114,3,14,6, + 0,114,118,1,0,0,0,115,116,5,46,0,0,116,118,3,14,6,0,117,111,1,0, + 0,0,117,115,1,0,0,0,118,11,1,0,0,0,119,120,7,2,0,0,120,13,1,0,0, + 0,121,123,3,12,5,0,122,121,1,0,0,0,123,124,1,0,0,0,124,122,1,0,0, + 0,124,125,1,0,0,0,125,15,1,0,0,0,126,128,5,35,0,0,127,126,1,0,0, + 0,128,129,1,0,0,0,129,127,1,0,0,0,129,130,1,0,0,0,130,134,1,0,0, + 0,131,133,8,3,0,0,132,131,1,0,0,0,133,136,1,0,0,0,134,132,1,0,0, + 0,134,135,1,0,0,0,135,140,1,0,0,0,136,134,1,0,0,0,137,139,5,35,0, + 0,138,137,1,0,0,0,139,142,1,0,0,0,140,138,1,0,0,0,140,141,1,0,0, + 0,141,146,1,0,0,0,142,140,1,0,0,0,143,145,8,3,0,0,144,143,1,0,0, + 0,145,148,1,0,0,0,146,144,1,0,0,0,146,147,1,0,0,0,147,149,1,0,0, + 0,148,146,1,0,0,0,149,150,6,7,1,0,150,17,1,0,0,0,151,153,5,33,0, + 0,152,151,1,0,0,0,153,154,1,0,0,0,154,152,1,0,0,0,154,155,1,0,0, + 0,155,159,1,0,0,0,156,158,8,3,0,0,157,156,1,0,0,0,158,161,1,0,0, + 0,159,157,1,0,0,0,159,160,1,0,0,0,160,165,1,0,0,0,161,159,1,0,0, + 0,162,164,5,33,0,0,163,162,1,0,0,0,164,167,1,0,0,0,165,163,1,0,0, + 0,165,166,1,0,0,0,166,171,1,0,0,0,167,165,1,0,0,0,168,170,8,3,0, + 0,169,168,1,0,0,0,170,173,1,0,0,0,171,169,1,0,0,0,171,172,1,0,0, + 0,172,174,1,0,0,0,173,171,1,0,0,0,174,175,6,8,1,0,175,19,1,0,0,0, + 176,178,5,59,0,0,177,176,1,0,0,0,178,179,1,0,0,0,179,177,1,0,0,0, + 179,180,1,0,0,0,180,184,1,0,0,0,181,183,8,3,0,0,182,181,1,0,0,0, + 183,186,1,0,0,0,184,182,1,0,0,0,184,185,1,0,0,0,185,190,1,0,0,0, + 186,184,1,0,0,0,187,189,5,59,0,0,188,187,1,0,0,0,189,192,1,0,0,0, + 190,188,1,0,0,0,190,191,1,0,0,0,191,196,1,0,0,0,192,190,1,0,0,0, + 193,195,8,3,0,0,194,193,1,0,0,0,195,198,1,0,0,0,196,194,1,0,0,0, + 196,197,1,0,0,0,197,199,1,0,0,0,198,196,1,0,0,0,199,200,6,9,1,0, + 200,21,1,0,0,0,201,206,3,38,18,0,202,203,7,4,0,0,203,205,3,38,18, + 0,204,202,1,0,0,0,205,208,1,0,0,0,206,204,1,0,0,0,206,207,1,0,0, + 0,207,23,1,0,0,0,208,206,1,0,0,0,209,210,3,22,10,0,210,211,5,45, + 0,0,211,212,3,22,10,0,212,25,1,0,0,0,213,214,3,22,10,0,214,215,5, + 45,0,0,215,216,3,22,10,0,216,217,5,45,0,0,217,218,3,22,10,0,218, + 27,1,0,0,0,219,220,3,22,10,0,220,221,5,45,0,0,221,222,3,22,10,0, + 222,223,5,45,0,0,223,224,3,22,10,0,224,225,5,45,0,0,225,226,3,22, + 10,0,226,29,1,0,0,0,227,228,7,5,0,0,228,31,1,0,0,0,229,232,3,30, + 14,0,230,232,3,12,5,0,231,229,1,0,0,0,231,230,1,0,0,0,232,33,1,0, + 0,0,233,236,3,32,15,0,234,236,7,6,0,0,235,233,1,0,0,0,235,234,1, + 0,0,0,236,35,1,0,0,0,237,240,3,34,16,0,238,240,7,7,0,0,239,237,1, + 0,0,0,239,238,1,0,0,0,240,37,1,0,0,0,241,245,3,34,16,0,242,244,3, + 36,17,0,243,242,1,0,0,0,244,247,1,0,0,0,245,243,1,0,0,0,245,246, + 1,0,0,0,246,39,1,0,0,0,247,245,1,0,0,0,248,250,7,8,0,0,249,248,1, + 0,0,0,250,251,1,0,0,0,251,249,1,0,0,0,251,252,1,0,0,0,252,253,1, + 0,0,0,253,254,6,19,2,0,254,41,1,0,0,0,255,257,7,3,0,0,256,255,1, + 0,0,0,257,258,1,0,0,0,258,256,1,0,0,0,258,259,1,0,0,0,259,43,1,0, + 0,0,260,265,5,123,0,0,261,264,3,44,21,0,262,264,9,0,0,0,263,261, + 1,0,0,0,263,262,1,0,0,0,264,267,1,0,0,0,265,266,1,0,0,0,265,263, + 1,0,0,0,266,268,1,0,0,0,267,265,1,0,0,0,268,269,5,125,0,0,269,270, + 1,0,0,0,270,271,6,21,1,0,271,45,1,0,0,0,272,298,7,9,0,0,273,275, + 5,47,0,0,274,276,5,47,0,0,275,274,1,0,0,0,276,277,1,0,0,0,277,275, + 1,0,0,0,277,278,1,0,0,0,278,298,1,0,0,0,279,281,5,42,0,0,280,282, + 5,42,0,0,281,280,1,0,0,0,282,283,1,0,0,0,283,281,1,0,0,0,283,284, + 1,0,0,0,284,298,1,0,0,0,285,287,5,61,0,0,286,288,5,61,0,0,287,286, + 1,0,0,0,288,289,1,0,0,0,289,287,1,0,0,0,289,290,1,0,0,0,290,298, + 1,0,0,0,291,292,5,82,0,0,292,293,5,69,0,0,293,294,5,77,0,0,294,295, + 5,65,0,0,295,296,5,82,0,0,296,298,5,75,0,0,297,272,1,0,0,0,297,273, + 1,0,0,0,297,279,1,0,0,0,297,285,1,0,0,0,297,291,1,0,0,0,298,302, + 1,0,0,0,299,301,5,32,0,0,300,299,1,0,0,0,301,304,1,0,0,0,302,300, + 1,0,0,0,302,303,1,0,0,0,303,305,1,0,0,0,304,302,1,0,0,0,305,306, + 3,42,20,0,306,307,1,0,0,0,307,308,6,22,1,0,308,47,1,0,0,0,309,335, + 7,9,0,0,310,312,5,47,0,0,311,313,5,47,0,0,312,311,1,0,0,0,313,314, + 1,0,0,0,314,312,1,0,0,0,314,315,1,0,0,0,315,335,1,0,0,0,316,318, + 5,42,0,0,317,319,5,42,0,0,318,317,1,0,0,0,319,320,1,0,0,0,320,318, + 1,0,0,0,320,321,1,0,0,0,321,335,1,0,0,0,322,324,5,61,0,0,323,325, + 5,61,0,0,324,323,1,0,0,0,325,326,1,0,0,0,326,324,1,0,0,0,326,327, + 1,0,0,0,327,335,1,0,0,0,328,329,5,82,0,0,329,330,5,69,0,0,330,331, + 5,77,0,0,331,332,5,65,0,0,332,333,5,82,0,0,333,335,5,75,0,0,334, + 309,1,0,0,0,334,310,1,0,0,0,334,316,1,0,0,0,334,322,1,0,0,0,334, + 328,1,0,0,0,335,339,1,0,0,0,336,338,8,3,0,0,337,336,1,0,0,0,338, + 341,1,0,0,0,339,337,1,0,0,0,339,340,1,0,0,0,340,342,1,0,0,0,341, + 339,1,0,0,0,342,343,3,42,20,0,343,344,1,0,0,0,344,345,6,23,1,0,345, + 49,1,0,0,0,346,347,5,68,0,0,347,348,5,105,0,0,348,349,5,109,0,0, + 349,350,5,32,0,0,350,351,5,48,0,0,351,352,5,32,0,0,352,353,5,40, + 0,0,353,354,5,112,0,0,354,355,5,112,0,0,355,356,5,109,0,0,356,357, + 5,41,0,0,357,51,1,0,0,0,358,359,5,68,0,0,359,360,5,105,0,0,360,361, + 5,109,0,0,361,362,5,32,0,0,362,363,5,49,0,0,363,364,5,32,0,0,364, + 365,5,40,0,0,365,366,5,112,0,0,366,367,5,112,0,0,367,368,5,109,0, + 0,368,369,5,41,0,0,369,53,1,0,0,0,370,371,5,68,0,0,371,372,5,105, + 0,0,372,373,5,109,0,0,373,374,5,32,0,0,374,375,5,50,0,0,375,376, + 5,32,0,0,376,377,5,40,0,0,377,378,5,112,0,0,378,379,5,112,0,0,379, + 380,5,109,0,0,380,381,5,41,0,0,381,55,1,0,0,0,382,383,5,68,0,0,383, + 384,5,105,0,0,384,385,5,109,0,0,385,386,5,32,0,0,386,387,5,51,0, + 0,387,388,5,32,0,0,388,389,5,40,0,0,389,390,5,112,0,0,390,391,5, + 112,0,0,391,392,5,109,0,0,392,393,5,41,0,0,393,57,1,0,0,0,394,395, + 5,68,0,0,395,396,5,101,0,0,396,397,5,118,0,0,397,398,5,46,0,0,398, + 399,5,32,0,0,399,400,5,48,0,0,400,59,1,0,0,0,401,402,5,68,0,0,402, + 403,5,101,0,0,403,404,5,118,0,0,404,405,5,46,0,0,405,406,5,32,0, + 0,406,407,5,49,0,0,407,61,1,0,0,0,408,409,5,68,0,0,409,410,5,101, + 0,0,410,411,5,118,0,0,411,412,5,46,0,0,412,413,5,32,0,0,413,414, + 5,50,0,0,414,63,1,0,0,0,415,416,5,68,0,0,416,417,5,101,0,0,417,418, + 5,118,0,0,418,419,5,46,0,0,419,420,5,32,0,0,420,421,5,51,0,0,421, + 65,1,0,0,0,422,423,5,65,0,0,423,424,5,109,0,0,424,425,5,112,0,0, + 425,426,5,108,0,0,426,427,5,105,0,0,427,428,5,116,0,0,428,429,5, + 117,0,0,429,430,5,100,0,0,430,431,5,101,0,0,431,67,1,0,0,0,432,433, + 5,65,0,0,433,434,5,115,0,0,434,435,5,115,0,0,435,436,5,105,0,0,436, + 437,5,103,0,0,437,438,5,110,0,0,438,439,5,109,0,0,439,440,5,101, + 0,0,440,441,5,110,0,0,441,442,5,116,0,0,442,69,1,0,0,0,443,445,7, + 8,0,0,444,443,1,0,0,0,445,446,1,0,0,0,446,444,1,0,0,0,446,447,1, + 0,0,0,447,448,1,0,0,0,448,449,6,34,2,0,449,71,1,0,0,0,450,452,7, + 3,0,0,451,450,1,0,0,0,452,453,1,0,0,0,453,451,1,0,0,0,453,454,1, + 0,0,0,454,455,1,0,0,0,455,456,6,35,3,0,456,73,1,0,0,0,44,0,1,86, + 91,95,98,102,106,109,117,124,129,134,140,146,154,159,165,171,179, + 184,190,196,206,231,235,239,245,251,258,263,265,277,283,289,297, + 302,314,320,326,334,339,446,453,4,5,1,0,0,1,0,6,0,0,4,0,0 + ] + +class VnmrPKLexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + LABEL_MODE = 1 + + Peak_id = 1 + Integer = 2 + Float = 3 + Real = 4 + SHARP_COMMENT = 5 + EXCLM_COMMENT = 6 + SMCLN_COMMENT = 7 + Assignment_2d_ex = 8 + Assignment_3d_ex = 9 + Assignment_4d_ex = 10 + SPACE = 11 + RETURN = 12 + ENCLOSE_COMMENT = 13 + SECTION_COMMENT = 14 + LINE_COMMENT = 15 + Dim_0_ppm = 16 + Dim_1_ppm = 17 + Dim_2_ppm = 18 + Dim_3_ppm = 19 + Dev_0 = 20 + Dev_1 = 21 + Dev_2 = 22 + Dev_3 = 23 + Amplitude = 24 + Assignment = 25 + SPACE_LA = 26 + RETURN_LA = 27 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE", "LABEL_MODE" ] + + literalNames = [ "", + "'peak id.'", "'Dim 0 (ppm)'", "'Dim 1 (ppm)'", "'Dim 2 (ppm)'", + "'Dim 3 (ppm)'", "'Dev. 0'", "'Dev. 1'", "'Dev. 2'", "'Dev. 3'", + "'Amplitude'", "'Assignment'" ] + + symbolicNames = [ "", + "Peak_id", "Integer", "Float", "Real", "SHARP_COMMENT", "EXCLM_COMMENT", + "SMCLN_COMMENT", "Assignment_2d_ex", "Assignment_3d_ex", "Assignment_4d_ex", + "SPACE", "RETURN", "ENCLOSE_COMMENT", "SECTION_COMMENT", "LINE_COMMENT", + "Dim_0_ppm", "Dim_1_ppm", "Dim_2_ppm", "Dim_3_ppm", "Dev_0", + "Dev_1", "Dev_2", "Dev_3", "Amplitude", "Assignment", "SPACE_LA", + "RETURN_LA" ] + + ruleNames = [ "Peak_id", "Integer", "Float", "Real", "DEC_DOT_DEC", + "DEC_DIGIT", "DECIMAL", "SHARP_COMMENT", "EXCLM_COMMENT", + "SMCLN_COMMENT", "ASS_EACH_AXIS", "Assignment_2d_ex", + "Assignment_3d_ex", "Assignment_4d_ex", "ALPHA", "ALPHA_NUM", + "START_CHAR", "NAME_CHAR", "SIMPLE_NAME", "SPACE", "RETURN", + "ENCLOSE_COMMENT", "SECTION_COMMENT", "LINE_COMMENT", + "Dim_0_ppm", "Dim_1_ppm", "Dim_2_ppm", "Dim_3_ppm", "Dev_0", + "Dev_1", "Dev_2", "Dev_3", "Amplitude", "Assignment", + "SPACE_LA", "RETURN_LA" ] + + grammarFileName = "VnmrPKLexer.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.0") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + diff --git a/wwpdb/utils/nmr/pk/VnmrPKParser.py b/wwpdb/utils/nmr/pk/VnmrPKParser.py new file mode 100644 index 00000000..913aafd3 --- /dev/null +++ b/wwpdb/utils/nmr/pk/VnmrPKParser.py @@ -0,0 +1,686 @@ +# Generated from VnmrPKParser.g4 by ANTLR 4.13.0 +# encoding: utf-8 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + +def serializedATN(): + return [ + 4,1,27,99,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,1,0,3, + 0,14,8,0,1,0,1,0,4,0,18,8,0,11,0,12,0,19,1,0,4,0,23,8,0,11,0,12, + 0,24,1,0,4,0,28,8,0,11,0,12,0,29,5,0,32,8,0,10,0,12,0,35,9,0,1,0, + 1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,48,8,1,3,1,50,8,1,1, + 1,1,1,3,1,54,8,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,3,2,65,8,2, + 1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,78,8,3,1,3,1,3,1, + 4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,3,4,93,8,4,1,4,1,4,1,5, + 1,5,1,5,0,0,6,0,2,4,6,8,10,0,1,1,0,2,4,106,0,13,1,0,0,0,2,38,1,0, + 0,0,4,57,1,0,0,0,6,68,1,0,0,0,8,81,1,0,0,0,10,96,1,0,0,0,12,14,5, + 12,0,0,13,12,1,0,0,0,13,14,1,0,0,0,14,33,1,0,0,0,15,32,3,2,1,0,16, + 18,3,4,2,0,17,16,1,0,0,0,18,19,1,0,0,0,19,17,1,0,0,0,19,20,1,0,0, + 0,20,32,1,0,0,0,21,23,3,6,3,0,22,21,1,0,0,0,23,24,1,0,0,0,24,22, + 1,0,0,0,24,25,1,0,0,0,25,32,1,0,0,0,26,28,3,8,4,0,27,26,1,0,0,0, + 28,29,1,0,0,0,29,27,1,0,0,0,29,30,1,0,0,0,30,32,1,0,0,0,31,15,1, + 0,0,0,31,17,1,0,0,0,31,22,1,0,0,0,31,27,1,0,0,0,32,35,1,0,0,0,33, + 31,1,0,0,0,33,34,1,0,0,0,34,36,1,0,0,0,35,33,1,0,0,0,36,37,5,0,0, + 1,37,1,1,0,0,0,38,39,5,1,0,0,39,40,5,16,0,0,40,41,5,20,0,0,41,42, + 5,17,0,0,42,49,5,21,0,0,43,44,5,18,0,0,44,47,5,22,0,0,45,46,5,19, + 0,0,46,48,5,23,0,0,47,45,1,0,0,0,47,48,1,0,0,0,48,50,1,0,0,0,49, + 43,1,0,0,0,49,50,1,0,0,0,50,51,1,0,0,0,51,53,5,24,0,0,52,54,5,25, + 0,0,53,52,1,0,0,0,53,54,1,0,0,0,54,55,1,0,0,0,55,56,5,27,0,0,56, + 3,1,0,0,0,57,58,5,2,0,0,58,59,5,3,0,0,59,60,5,3,0,0,60,61,5,3,0, + 0,61,62,5,3,0,0,62,64,3,10,5,0,63,65,5,8,0,0,64,63,1,0,0,0,64,65, + 1,0,0,0,65,66,1,0,0,0,66,67,5,12,0,0,67,5,1,0,0,0,68,69,5,2,0,0, + 69,70,5,3,0,0,70,71,5,3,0,0,71,72,5,3,0,0,72,73,5,3,0,0,73,74,5, + 3,0,0,74,75,5,3,0,0,75,77,3,10,5,0,76,78,5,9,0,0,77,76,1,0,0,0,77, + 78,1,0,0,0,78,79,1,0,0,0,79,80,5,12,0,0,80,7,1,0,0,0,81,82,5,2,0, + 0,82,83,5,3,0,0,83,84,5,3,0,0,84,85,5,3,0,0,85,86,5,3,0,0,86,87, + 5,3,0,0,87,88,5,3,0,0,88,89,5,3,0,0,89,90,5,3,0,0,90,92,3,10,5,0, + 91,93,5,10,0,0,92,91,1,0,0,0,92,93,1,0,0,0,93,94,1,0,0,0,94,95,5, + 12,0,0,95,9,1,0,0,0,96,97,7,0,0,0,97,11,1,0,0,0,12,13,19,24,29,31, + 33,47,49,53,64,77,92 + ] + +class VnmrPKParser ( Parser ): + + grammarFileName = "VnmrPKParser.g4" + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + sharedContextCache = PredictionContextCache() + + literalNames = [ "", "'peak id.'", "", "", + "", "", "", "", + "", "", "", "", + "", "", "", "", + "'Dim 0 (ppm)'", "'Dim 1 (ppm)'", "'Dim 2 (ppm)'", + "'Dim 3 (ppm)'", "'Dev. 0'", "'Dev. 1'", "'Dev. 2'", + "'Dev. 3'", "'Amplitude'", "'Assignment'" ] + + symbolicNames = [ "", "Peak_id", "Integer", "Float", "Real", + "SHARP_COMMENT", "EXCLM_COMMENT", "SMCLN_COMMENT", + "Assignment_2d_ex", "Assignment_3d_ex", "Assignment_4d_ex", + "SPACE", "RETURN", "ENCLOSE_COMMENT", "SECTION_COMMENT", + "LINE_COMMENT", "Dim_0_ppm", "Dim_1_ppm", "Dim_2_ppm", + "Dim_3_ppm", "Dev_0", "Dev_1", "Dev_2", "Dev_3", "Amplitude", + "Assignment", "SPACE_LA", "RETURN_LA" ] + + RULE_vnmr_pk = 0 + RULE_data_label = 1 + RULE_peak_2d = 2 + RULE_peak_3d = 3 + RULE_peak_4d = 4 + RULE_number = 5 + + ruleNames = [ "vnmr_pk", "data_label", "peak_2d", "peak_3d", "peak_4d", + "number" ] + + EOF = Token.EOF + Peak_id=1 + Integer=2 + Float=3 + Real=4 + SHARP_COMMENT=5 + EXCLM_COMMENT=6 + SMCLN_COMMENT=7 + Assignment_2d_ex=8 + Assignment_3d_ex=9 + Assignment_4d_ex=10 + SPACE=11 + RETURN=12 + ENCLOSE_COMMENT=13 + SECTION_COMMENT=14 + LINE_COMMENT=15 + Dim_0_ppm=16 + Dim_1_ppm=17 + Dim_2_ppm=18 + Dim_3_ppm=19 + Dev_0=20 + Dev_1=21 + Dev_2=22 + Dev_3=23 + Amplitude=24 + Assignment=25 + SPACE_LA=26 + RETURN_LA=27 + + def __init__(self, input:TokenStream, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.0") + self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) + self._predicates = None + + + + + class Vnmr_pkContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def EOF(self): + return self.getToken(VnmrPKParser.EOF, 0) + + def RETURN(self): + return self.getToken(VnmrPKParser.RETURN, 0) + + def data_label(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(VnmrPKParser.Data_labelContext) + else: + return self.getTypedRuleContext(VnmrPKParser.Data_labelContext,i) + + + def peak_2d(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(VnmrPKParser.Peak_2dContext) + else: + return self.getTypedRuleContext(VnmrPKParser.Peak_2dContext,i) + + + def peak_3d(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(VnmrPKParser.Peak_3dContext) + else: + return self.getTypedRuleContext(VnmrPKParser.Peak_3dContext,i) + + + def peak_4d(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(VnmrPKParser.Peak_4dContext) + else: + return self.getTypedRuleContext(VnmrPKParser.Peak_4dContext,i) + + + def getRuleIndex(self): + return VnmrPKParser.RULE_vnmr_pk + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterVnmr_pk" ): + listener.enterVnmr_pk(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitVnmr_pk" ): + listener.exitVnmr_pk(self) + + + + + def vnmr_pk(self): + + localctx = VnmrPKParser.Vnmr_pkContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_vnmr_pk) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 13 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==12: + self.state = 12 + self.match(VnmrPKParser.RETURN) + + + self.state = 33 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==1 or _la==2: + self.state = 31 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,4,self._ctx) + if la_ == 1: + self.state = 15 + self.data_label() + pass + + elif la_ == 2: + self.state = 17 + self._errHandler.sync(self) + _alt = 1 + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt == 1: + self.state = 16 + self.peak_2d() + + else: + raise NoViableAltException(self) + self.state = 19 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,1,self._ctx) + + pass + + elif la_ == 3: + self.state = 22 + self._errHandler.sync(self) + _alt = 1 + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt == 1: + self.state = 21 + self.peak_3d() + + else: + raise NoViableAltException(self) + self.state = 24 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,2,self._ctx) + + pass + + elif la_ == 4: + self.state = 27 + self._errHandler.sync(self) + _alt = 1 + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt == 1: + self.state = 26 + self.peak_4d() + + else: + raise NoViableAltException(self) + self.state = 29 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,3,self._ctx) + + pass + + + self.state = 35 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 36 + self.match(VnmrPKParser.EOF) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Data_labelContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Peak_id(self): + return self.getToken(VnmrPKParser.Peak_id, 0) + + def Dim_0_ppm(self): + return self.getToken(VnmrPKParser.Dim_0_ppm, 0) + + def Dev_0(self): + return self.getToken(VnmrPKParser.Dev_0, 0) + + def Dim_1_ppm(self): + return self.getToken(VnmrPKParser.Dim_1_ppm, 0) + + def Dev_1(self): + return self.getToken(VnmrPKParser.Dev_1, 0) + + def Amplitude(self): + return self.getToken(VnmrPKParser.Amplitude, 0) + + def RETURN_LA(self): + return self.getToken(VnmrPKParser.RETURN_LA, 0) + + def Dim_2_ppm(self): + return self.getToken(VnmrPKParser.Dim_2_ppm, 0) + + def Dev_2(self): + return self.getToken(VnmrPKParser.Dev_2, 0) + + def Assignment(self): + return self.getToken(VnmrPKParser.Assignment, 0) + + def Dim_3_ppm(self): + return self.getToken(VnmrPKParser.Dim_3_ppm, 0) + + def Dev_3(self): + return self.getToken(VnmrPKParser.Dev_3, 0) + + def getRuleIndex(self): + return VnmrPKParser.RULE_data_label + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterData_label" ): + listener.enterData_label(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitData_label" ): + listener.exitData_label(self) + + + + + def data_label(self): + + localctx = VnmrPKParser.Data_labelContext(self, self._ctx, self.state) + self.enterRule(localctx, 2, self.RULE_data_label) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 38 + self.match(VnmrPKParser.Peak_id) + self.state = 39 + self.match(VnmrPKParser.Dim_0_ppm) + self.state = 40 + self.match(VnmrPKParser.Dev_0) + self.state = 41 + self.match(VnmrPKParser.Dim_1_ppm) + self.state = 42 + self.match(VnmrPKParser.Dev_1) + self.state = 49 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==18: + self.state = 43 + self.match(VnmrPKParser.Dim_2_ppm) + self.state = 44 + self.match(VnmrPKParser.Dev_2) + self.state = 47 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==19: + self.state = 45 + self.match(VnmrPKParser.Dim_3_ppm) + self.state = 46 + self.match(VnmrPKParser.Dev_3) + + + + + self.state = 51 + self.match(VnmrPKParser.Amplitude) + self.state = 53 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==25: + self.state = 52 + self.match(VnmrPKParser.Assignment) + + + self.state = 55 + self.match(VnmrPKParser.RETURN_LA) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Peak_2dContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Integer(self): + return self.getToken(VnmrPKParser.Integer, 0) + + def Float(self, i:int=None): + if i is None: + return self.getTokens(VnmrPKParser.Float) + else: + return self.getToken(VnmrPKParser.Float, i) + + def number(self): + return self.getTypedRuleContext(VnmrPKParser.NumberContext,0) + + + def RETURN(self): + return self.getToken(VnmrPKParser.RETURN, 0) + + def Assignment_2d_ex(self): + return self.getToken(VnmrPKParser.Assignment_2d_ex, 0) + + def getRuleIndex(self): + return VnmrPKParser.RULE_peak_2d + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPeak_2d" ): + listener.enterPeak_2d(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPeak_2d" ): + listener.exitPeak_2d(self) + + + + + def peak_2d(self): + + localctx = VnmrPKParser.Peak_2dContext(self, self._ctx, self.state) + self.enterRule(localctx, 4, self.RULE_peak_2d) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 57 + self.match(VnmrPKParser.Integer) + self.state = 58 + self.match(VnmrPKParser.Float) + self.state = 59 + self.match(VnmrPKParser.Float) + self.state = 60 + self.match(VnmrPKParser.Float) + self.state = 61 + self.match(VnmrPKParser.Float) + self.state = 62 + self.number() + self.state = 64 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==8: + self.state = 63 + self.match(VnmrPKParser.Assignment_2d_ex) + + + self.state = 66 + self.match(VnmrPKParser.RETURN) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Peak_3dContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Integer(self): + return self.getToken(VnmrPKParser.Integer, 0) + + def Float(self, i:int=None): + if i is None: + return self.getTokens(VnmrPKParser.Float) + else: + return self.getToken(VnmrPKParser.Float, i) + + def number(self): + return self.getTypedRuleContext(VnmrPKParser.NumberContext,0) + + + def RETURN(self): + return self.getToken(VnmrPKParser.RETURN, 0) + + def Assignment_3d_ex(self): + return self.getToken(VnmrPKParser.Assignment_3d_ex, 0) + + def getRuleIndex(self): + return VnmrPKParser.RULE_peak_3d + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPeak_3d" ): + listener.enterPeak_3d(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPeak_3d" ): + listener.exitPeak_3d(self) + + + + + def peak_3d(self): + + localctx = VnmrPKParser.Peak_3dContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_peak_3d) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 68 + self.match(VnmrPKParser.Integer) + self.state = 69 + self.match(VnmrPKParser.Float) + self.state = 70 + self.match(VnmrPKParser.Float) + self.state = 71 + self.match(VnmrPKParser.Float) + self.state = 72 + self.match(VnmrPKParser.Float) + self.state = 73 + self.match(VnmrPKParser.Float) + self.state = 74 + self.match(VnmrPKParser.Float) + self.state = 75 + self.number() + self.state = 77 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==9: + self.state = 76 + self.match(VnmrPKParser.Assignment_3d_ex) + + + self.state = 79 + self.match(VnmrPKParser.RETURN) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class Peak_4dContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Integer(self): + return self.getToken(VnmrPKParser.Integer, 0) + + def Float(self, i:int=None): + if i is None: + return self.getTokens(VnmrPKParser.Float) + else: + return self.getToken(VnmrPKParser.Float, i) + + def number(self): + return self.getTypedRuleContext(VnmrPKParser.NumberContext,0) + + + def RETURN(self): + return self.getToken(VnmrPKParser.RETURN, 0) + + def Assignment_4d_ex(self): + return self.getToken(VnmrPKParser.Assignment_4d_ex, 0) + + def getRuleIndex(self): + return VnmrPKParser.RULE_peak_4d + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPeak_4d" ): + listener.enterPeak_4d(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPeak_4d" ): + listener.exitPeak_4d(self) + + + + + def peak_4d(self): + + localctx = VnmrPKParser.Peak_4dContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_peak_4d) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 81 + self.match(VnmrPKParser.Integer) + self.state = 82 + self.match(VnmrPKParser.Float) + self.state = 83 + self.match(VnmrPKParser.Float) + self.state = 84 + self.match(VnmrPKParser.Float) + self.state = 85 + self.match(VnmrPKParser.Float) + self.state = 86 + self.match(VnmrPKParser.Float) + self.state = 87 + self.match(VnmrPKParser.Float) + self.state = 88 + self.match(VnmrPKParser.Float) + self.state = 89 + self.match(VnmrPKParser.Float) + self.state = 90 + self.number() + self.state = 92 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==10: + self.state = 91 + self.match(VnmrPKParser.Assignment_4d_ex) + + + self.state = 94 + self.match(VnmrPKParser.RETURN) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class NumberContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Real(self): + return self.getToken(VnmrPKParser.Real, 0) + + def Float(self): + return self.getToken(VnmrPKParser.Float, 0) + + def Integer(self): + return self.getToken(VnmrPKParser.Integer, 0) + + def getRuleIndex(self): + return VnmrPKParser.RULE_number + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterNumber" ): + listener.enterNumber(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitNumber" ): + listener.exitNumber(self) + + + + + def number(self): + + localctx = VnmrPKParser.NumberContext(self, self._ctx, self.state) + self.enterRule(localctx, 10, self.RULE_number) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 96 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 28) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + + + diff --git a/wwpdb/utils/nmr/pk/VnmrPKParserListener.py b/wwpdb/utils/nmr/pk/VnmrPKParserListener.py new file mode 100644 index 00000000..f601be76 --- /dev/null +++ b/wwpdb/utils/nmr/pk/VnmrPKParserListener.py @@ -0,0 +1,538 @@ +## +# File: VnmrPKParserListener.py +# Date: 16-Dec-2024 +# +# Updates: +""" ParserLister class for VNMR PK files. + @author: Masashi Yokochi +""" +import sys + +from antlr4 import ParseTreeListener + +try: + from wwpdb.utils.nmr.pk.VnmrPKParser import VnmrPKParser + from wwpdb.utils.nmr.pk.BasePKParserListener import BasePKParserListener + from wwpdb.utils.nmr.mr.ParserListenerUtil import (REPRESENTATIVE_MODEL_ID, + REPRESENTATIVE_ALT_ID, + getPkRow) + +except ImportError: + from nmr.pk.VnmrPKParser import VnmrPKParser + from nmr.pk.BasePKParserListener import BasePKParserListener + from nmr.mr.ParserListenerUtil import (REPRESENTATIVE_MODEL_ID, + REPRESENTATIVE_ALT_ID, + getPkRow) + + +# This class defines a complete listener for a parse tree produced by VnmrPKParser. +class VnmrPKParserListener(ParseTreeListener, BasePKParserListener): + + __has_assign = False + + def __init__(self, verbose=True, log=sys.stdout, + representativeModelId=REPRESENTATIVE_MODEL_ID, + representativeAltId=REPRESENTATIVE_ALT_ID, + mrAtomNameMapping=None, + cR=None, caC=None, ccU=None, csStat=None, nefT=None, + reasons=None): + super().__init__(verbose, log, representativeModelId, representativeAltId, + mrAtomNameMapping, cR, caC, ccU, csStat, nefT, reasons) + + self.file_type = 'nm-pea-vnm' + self.software_name = 'VNMR' + + # Enter a parse tree produced by VnmrPKParser#vnmr_pk. + def enterVnmr_pk(self, ctx: VnmrPKParser.Vnmr_pkContext): # pylint: disable=unused-argument + self.enter() + + # Exit a parse tree produced by VnmrPKParser#vnmr_pk. + def exitVnmr_pk(self, ctx: VnmrPKParser.Vnmr_pkContext): # pylint: disable=unused-argument + self.exit() + + # Enter a parse tree produced by VnmrPKParser#data_label. + def enterData_label(self, ctx: VnmrPKParser.Data_labelContext): + if ctx.Dim_0_ppm(): + self.num_of_dim = max(self.num_of_dim, 1) + if ctx.Dim_1_ppm(): + self.num_of_dim = max(self.num_of_dim, 2) + if ctx.Dim_2_ppm(): + self.num_of_dim = max(self.num_of_dim, 3) + if ctx.Dim_3_ppm(): + self.num_of_dim = max(self.num_of_dim, 4) + + self.__has_assign = False + + if ctx.Assignment(): + self.__has_assign = True + + self.initSpectralDim() + + # Exit a parse tree produced by VnmrPKParser#data_label. + def exitData_label(self, ctx: VnmrPKParser.Data_labelContext): # pylint: disable=unused-argument + pass + + # Enter a parse tree produced by VnmrPKParser#peak_2d. + def enterPeak_2d(self, ctx: VnmrPKParser.Peak_2dContext): # pylint: disable=unused-argument + if self.cur_subtype != 'peak2d': + self.num_of_dim = 2 + self.initSpectralDim() + + self.peaks2D += 1 + + self.atomSelectionSet.clear() + + # Exit a parse tree produced by VnmrPKParser#peak_2d. + def exitPeak_2d(self, ctx: VnmrPKParser.Peak_2dContext): + + try: + + if len(self.numberSelection) == 0: + self.peaks2D -= 1 + return + + index = int(str(ctx.Integer())) + + ass = None + if self.__has_assign: + ass = str(ctx.Assignment_2d_ex()) + if '?' in ass: + ass = None + + x_ppm = float(str(ctx.Float(0))) + x_dev = abs(float(str(ctx.Float(1)))) + y_ppm = float(str(ctx.Float(2))) + y_dev = abs(float(str(ctx.Float(3)))) + + height = self.originalNumberSelection[0] + + if not self.hasPolySeq and not self.hasNonPolySeq: + return + + if x_ppm is None or y_ppm is None: + self.peaks2D -= 1 + return + + dstFunc = self.validatePeak2D(index, x_ppm, y_ppm, x_dev, y_dev, None, None, + None, None, None, None, height, None, None, None) + + if dstFunc is None: + self.peaks2D -= 1 + return + + cur_spectral_dim = self.spectral_dim[self.num_of_dim][self.cur_list_id] + + cur_spectral_dim[1]['freq_hint'].append(x_ppm) + cur_spectral_dim[2]['freq_hint'].append(y_ppm) + + has_assignments = False + + asis1 = asis2 = None + + if ass is not None: + assignments = self.extractPeakAssignment(self.num_of_dim, ass, index) + + if assignments is not None: + + self.retrieveLocalSeqScheme() + + hasChainId = all(a['chain_id'] is not None for a in assignments) + hasCompId = all(a['comp_id'] is not None for a in assignments) + + a1 = assignments[0] + a2 = assignments[1] + + if hasChainId and hasCompId: + chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + + elif hasChainId: + chainAssign1 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a1['chain_id'], a1['seq_id'], a1['atom_id'], index) + chainAssign2 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a2['chain_id'], a2['seq_id'], a2['atom_id'], index) + + elif hasCompId: + chainAssign1, asis1 = self.assignCoordPolymerSequence(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + chainAssign2, asis2 = self.assignCoordPolymerSequence(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + + else: + chainAssign1 = self.assignCoordPolymerSequenceWithoutCompId(a1['seq_id'], a1['atom_id'], index) + chainAssign2 = self.assignCoordPolymerSequenceWithoutCompId(a2['seq_id'], a2['atom_id'], index) + + if len(chainAssign1) > 0 and len(chainAssign2) > 0: + self.selectCoordAtoms(chainAssign1, a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + self.selectCoordAtoms(chainAssign2, a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + + if len(self.atomSelectionSet) == self.num_of_dim: + has_assignments = True + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + + if self.createSfDict__: + sf = self.getSf() + + if self.debug: + print(f"subtype={self.cur_subtype} id={self.peaks2D} (index={index}) " + f"{ass} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} {dstFunc}") + + if self.createSfDict__ and sf is not None: + sf['index_id'] += 1 + ambig_code1 = ambig_code2 = None + if has_assignments: + atom1 = self.atomSelectionSet[0][0] + atom2 = self.atomSelectionSet[1][0] + if len(self.atomSelectionSet[0]) > 1: + ambig_code1 = self.csStat.getMaxAmbigCodeWoSetId(atom1['comp_id'], atom1['atom_id']) + if ambig_code1 == 0: + ambig_code1 = None + if len(self.atomSelectionSet[1]) > 1: + ambig_code2 = self.csStat.getMaxAmbigCodeWoSetId(atom2['comp_id'], atom2['atom_id']) + if ambig_code2 == 0: + ambig_code2 = None + else: + atom1 = atom2 = None + + row = getPkRow(self.cur_subtype, sf['id'], sf['index_id'], + sf['list_id'], self.entryId, dstFunc, + self.authToStarSeq, self.authToOrigSeq, self.offsetHolder, + atom1, atom2, asis1=asis1, asis2=asis2, + ambig_code1=ambig_code1, ambig_code2=ambig_code2, details=ass) + sf['loop'].add_data(row) + + finally: + self.numberSelection.clear() + self.originalNumberSelection.clear() + + # Enter a parse tree produced by VnmrPKParser#peak_3d. + def enterPeak_3d(self, ctx: VnmrPKParser.Peak_3dContext): # pylint: disable=unused-argument + if self.cur_subtype != 'peak3d': + self.num_of_dim = 3 + self.initSpectralDim() + + self.peaks3D += 1 + + self.atomSelectionSet.clear() + + # Exit a parse tree produced by VnmrPKParser#peak_3d. + def exitPeak_3d(self, ctx: VnmrPKParser.Peak_3dContext): + + try: + + if len(self.numberSelection) == 0: + self.peaks3D -= 1 + return + + index = int(str(ctx.Integer())) + + ass = None + if self.__has_assign: + ass = str(ctx.Assignment_3d_ex()) + if '?' in ass: + ass = None + + x_ppm = float(str(ctx.Float(0))) + x_dev = abs(float(str(ctx.Float(1)))) + y_ppm = float(str(ctx.Float(2))) + y_dev = abs(float(str(ctx.Float(3)))) + z_ppm = float(str(ctx.Float(4))) + z_dev = abs(float(str(ctx.Float(5)))) + + height = self.originalNumberSelection[0] + + if not self.hasPolySeq and not self.hasNonPolySeq: + return + + if x_ppm is None or y_ppm is None or z_ppm is None: + self.peaks3D -= 1 + return + + dstFunc = self.validatePeak3D(index, x_ppm, y_ppm, z_ppm, x_dev, y_dev, z_dev, None, None, None, + None, None, None, None, None, None, height, None, None, None) + + if dstFunc is None: + self.peaks3D -= 1 + return + + cur_spectral_dim = self.spectral_dim[self.num_of_dim][self.cur_list_id] + + cur_spectral_dim[1]['freq_hint'].append(x_ppm) + cur_spectral_dim[2]['freq_hint'].append(y_ppm) + cur_spectral_dim[3]['freq_hint'].append(z_ppm) + + has_assignments = False + + asis1 = asis2 = asis3 = None + + if ass is not None: + assignments = self.extractPeakAssignment(self.num_of_dim, ass, index) + + if assignments is not None: + + self.retrieveLocalSeqScheme() + + hasChainId = all(a['chain_id'] is not None for a in assignments) + hasCompId = all(a['comp_id'] is not None for a in assignments) + + a1 = assignments[0] + a2 = assignments[1] + a3 = assignments[2] + + if hasChainId and hasCompId: + chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + chainAssign3, asis3 = self.assignCoordPolymerSequenceWithChainId(a3['chain_id'], a3['seq_id'], a3['comp_id'], a3['atom_id'], index) + + elif hasChainId: + chainAssign1 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a1['chain_id'], a1['seq_id'], a1['atom_id'], index) + chainAssign2 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a2['chain_id'], a2['seq_id'], a2['atom_id'], index) + chainAssign3 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a3['chain_id'], a3['seq_id'], a3['atom_id'], index) + + elif hasCompId: + chainAssign1, asis1 = self.assignCoordPolymerSequence(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + chainAssign2, asis2 = self.assignCoordPolymerSequence(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + chainAssign3, asis3 = self.assignCoordPolymerSequence(a3['chain_id'], a3['seq_id'], a3['comp_id'], a3['atom_id'], index) + + else: + chainAssign1 = self.assignCoordPolymerSequenceWithoutCompId(a1['seq_id'], a1['atom_id'], index) + chainAssign2 = self.assignCoordPolymerSequenceWithoutCompId(a2['seq_id'], a2['atom_id'], index) + chainAssign3 = self.assignCoordPolymerSequenceWithoutCompId(a3['seq_id'], a3['atom_id'], index) + + if len(chainAssign1) > 0 and len(chainAssign2) > 0 and len(chainAssign3) > 0: + self.selectCoordAtoms(chainAssign1, a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + self.selectCoordAtoms(chainAssign2, a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + self.selectCoordAtoms(chainAssign3, a3['seq_id'], a3['comp_id'], a3['atom_id'], index) + + if len(self.atomSelectionSet) == self.num_of_dim: + has_assignments = True + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + + if self.createSfDict__: + sf = self.getSf() + + if self.debug: + print(f"subtype={self.cur_subtype} id={self.peaks3D} (index={index}) " + f"{ass} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " + f"{self.atomSelectionSet[2] if has_assignments else None} {dstFunc}") + + if self.createSfDict__ and sf is not None: + sf['id'] = index + sf['index_id'] += 1 + ambig_code1 = ambig_code2 = ambig_code3 = None + if has_assignments: + atom1 = self.atomSelectionSet[0][0] + atom2 = self.atomSelectionSet[1][0] + atom3 = self.atomSelectionSet[2][0] + if len(self.atomSelectionSet[0]) > 1: + ambig_code1 = self.csStat.getMaxAmbigCodeWoSetId(atom1['comp_id'], atom1['atom_id']) + if ambig_code1 == 0: + ambig_code1 = None + if len(self.atomSelectionSet[1]) > 1: + ambig_code2 = self.csStat.getMaxAmbigCodeWoSetId(atom2['comp_id'], atom2['atom_id']) + if ambig_code2 == 0: + ambig_code2 = None + if len(self.atomSelectionSet[2]) > 1: + ambig_code3 = self.csStat.getMaxAmbigCodeWoSetId(atom3['comp_id'], atom3['atom_id']) + if ambig_code3 == 0: + ambig_code3 = None + else: + atom1 = atom2 = atom3 = None + + row = getPkRow(self.cur_subtype, sf['id'], sf['index_id'], + sf['list_id'], self.entryId, dstFunc, + self.authToStarSeq, self.authToOrigSeq, self.offsetHolder, + atom1, atom2, atom3, asis1=asis1, asis2=asis2, asis3=asis3, + ambig_code1=ambig_code1, ambig_code2=ambig_code2, + ambig_code3=ambig_code3, details=ass) + sf['loop'].add_data(row) + + finally: + self.numberSelection.clear() + self.originalNumberSelection.clear() + + # Enter a parse tree produced by VnmrPKParser#peak_4d. + def enterPeak_4d(self, ctx: VnmrPKParser.Peak_4dContext): # pylint: disable=unused-argument + if self.cur_subtype != 'peak4d': + self.num_of_dim = 4 + self.initSpectralDim() + + self.peaks4D += 1 + + self.atomSelectionSet.clear() + + # Exit a parse tree produced by VnmrPKParser#peak_4d. + def exitPeak_4d(self, ctx: VnmrPKParser.Peak_4dContext): + + try: + + if len(self.numberSelection) == 0: + self.peaks4D -= 1 + return + + index = int(str(ctx.Integer())) + + ass = None + if self.__has_assign: + ass = str(ctx.Assignment_4d_ex()) + if '?' in ass: + ass = None + + x_ppm = float(str(ctx.Float(0))) + x_dev = abs(float(str(ctx.Float(1)))) + y_ppm = float(str(ctx.Float(2))) + y_dev = abs(float(str(ctx.Float(3)))) + z_ppm = float(str(ctx.Float(4))) + z_dev = abs(float(str(ctx.Float(5)))) + a_ppm = float(str(ctx.Float(6))) + a_dev = abs(float(str(ctx.Float(7)))) + + height = self.originalNumberSelection[0] + + if not self.hasPolySeq and not self.hasNonPolySeq: + return + + if x_ppm is None or y_ppm is None or z_ppm is None or a_ppm is None: + self.peaks4D -= 1 + return + + dstFunc = self.validatePeak4D(index, x_ppm, y_ppm, z_ppm, a_ppm, x_dev, y_dev, z_dev, a_dev, None, None, None, None, + None, None, None, None, None, None, None, None, height, None, None, None) + + if dstFunc is None: + self.peaks4D -= 1 + return + + cur_spectral_dim = self.spectral_dim[self.num_of_dim][self.cur_list_id] + + cur_spectral_dim[1]['freq_hint'].append(x_ppm) + cur_spectral_dim[2]['freq_hint'].append(y_ppm) + cur_spectral_dim[3]['freq_hint'].append(z_ppm) + cur_spectral_dim[4]['freq_hint'].append(a_ppm) + + has_assignments = False + + asis1 = asis2 = asis3 = asis4 = None + + if ass is not None: + assignments = self.extractPeakAssignment(self.num_of_dim, ass, index) + + if assignments is not None: + + self.retrieveLocalSeqScheme() + + hasChainId = all(a['chain_id'] is not None for a in assignments) + hasCompId = all(a['comp_id'] is not None for a in assignments) + + a1 = assignments[0] + a2 = assignments[1] + a3 = assignments[2] + a4 = assignments[3] + + if hasChainId and hasCompId: + chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + chainAssign3, asis3 = self.assignCoordPolymerSequenceWithChainId(a3['chain_id'], a3['seq_id'], a3['comp_id'], a3['atom_id'], index) + chainAssign4, asis4 = self.assignCoordPolymerSequenceWithChainId(a4['chain_id'], a4['seq_id'], a4['comp_id'], a4['atom_id'], index) + + elif hasChainId: + chainAssign1 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a1['chain_id'], a1['seq_id'], a1['atom_id'], index) + chainAssign2 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a2['chain_id'], a2['seq_id'], a2['atom_id'], index) + chainAssign3 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a3['chain_id'], a3['seq_id'], a3['atom_id'], index) + chainAssign4 = self.assignCoordPolymerSequenceWithChainIdWithoutCompId(a4['chain_id'], a4['seq_id'], a4['atom_id'], index) + + elif hasCompId: + chainAssign1, asis1 = self.assignCoordPolymerSequence(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + chainAssign2, asis2 = self.assignCoordPolymerSequence(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + chainAssign3, asis3 = self.assignCoordPolymerSequence(a3['chain_id'], a3['seq_id'], a3['comp_id'], a3['atom_id'], index) + chainAssign4, asis4 = self.assignCoordPolymerSequence(a4['chain_id'], a4['seq_id'], a4['comp_id'], a4['atom_id'], index) + + else: + chainAssign1 = self.assignCoordPolymerSequenceWithoutCompId(a1['seq_id'], a1['atom_id'], index) + chainAssign2 = self.assignCoordPolymerSequenceWithoutCompId(a2['seq_id'], a2['atom_id'], index) + chainAssign3 = self.assignCoordPolymerSequenceWithoutCompId(a3['seq_id'], a3['atom_id'], index) + chainAssign4 = self.assignCoordPolymerSequenceWithoutCompId(a4['seq_id'], a4['atom_id'], index) + + if len(chainAssign1) > 0 and len(chainAssign2) > 0 and len(chainAssign3) > 0 and len(chainAssign4) > 0: + self.selectCoordAtoms(chainAssign1, a1['seq_id'], a1['comp_id'], a1['atom_id'], index) + self.selectCoordAtoms(chainAssign2, a2['seq_id'], a2['comp_id'], a2['atom_id'], index) + self.selectCoordAtoms(chainAssign3, a3['seq_id'], a3['comp_id'], a3['atom_id'], index) + self.selectCoordAtoms(chainAssign4, a4['seq_id'], a4['comp_id'], a4['atom_id'], index) + + if len(self.atomSelectionSet) == self.num_of_dim: + has_assignments = True + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(4, self.atomSelectionSet[3][0]['atom_id'][0]) + + if self.createSfDict__: + sf = self.getSf() + + if self.debug: + print(f"subtype={self.cur_subtype} id={self.peaks4D} (index={index}) " + f"{ass} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " + f"{self.atomSelectionSet[2] if has_assignments else None} {self.atomSelectionSet[3] if has_assignments else None} {dstFunc}") + + if self.createSfDict__ and sf is not None: + sf['id'] = index + sf['index_id'] += 1 + ambig_code1 = ambig_code2 = ambig_code3 = ambig_code4 = None + if has_assignments: + atom1 = self.atomSelectionSet[0][0] + atom2 = self.atomSelectionSet[1][0] + atom3 = self.atomSelectionSet[2][0] + atom4 = self.atomSelectionSet[3][0] + if len(self.atomSelectionSet[0]) > 1: + ambig_code1 = self.csStat.getMaxAmbigCodeWoSetId(atom1['comp_id'], atom1['atom_id']) + if ambig_code1 == 0: + ambig_code1 = None + if len(self.atomSelectionSet[1]) > 1: + ambig_code2 = self.csStat.getMaxAmbigCodeWoSetId(atom2['comp_id'], atom2['atom_id']) + if ambig_code2 == 0: + ambig_code2 = None + if len(self.atomSelectionSet[2]) > 1: + ambig_code3 = self.csStat.getMaxAmbigCodeWoSetId(atom3['comp_id'], atom3['atom_id']) + if ambig_code3 == 0: + ambig_code3 = None + if len(self.atomSelectionSet[3]) > 1: + ambig_code4 = self.csStat.getMaxAmbigCodeWoSetId(atom4['comp_id'], atom4['atom_id']) + if ambig_code4 == 0: + ambig_code4 = None + else: + atom1 = atom2 = atom3 = atom4 = None + + row = getPkRow(self.cur_subtype, sf['id'], sf['index_id'], + sf['list_id'], self.entryId, dstFunc, + self.authToStarSeq, self.authToOrigSeq, self.offsetHolder, + atom1, atom2, atom3, atom4, asis1=asis1, asis2=asis2, asis3=asis3, asis4=asis4, + ambig_code1=ambig_code1, ambig_code2=ambig_code2, + ambig_code3=ambig_code3, ambig_code4=ambig_code4, details=ass) + sf['loop'].add_data(row) + + finally: + self.numberSelection.clear() + self.originalNumberSelection.clear() + + # Enter a parse tree produced by VnmrPKParser#number. + def enterNumber(self, ctx: VnmrPKParser.NumberContext): + if ctx.Float(): + value = str(ctx.Float()) + self.numberSelection.append(float(value)) + self.originalNumberSelection.append(value) + + elif ctx.Real(): + value = str(ctx.Real()) + self.numberSelection.append(float(value)) + self.originalNumberSelection.append(value) + + else: + value = str(ctx.Integer()) + self.numberSelection.append(int(value)) + self.originalNumberSelection.append(value) + + # Exit a parse tree produced by VnmrPKParser#number. + def exitNumber(self, ctx: VnmrPKParser.NumberContext): # pylint: disable=unused-argument + pass + + +# del VnmrPKParser diff --git a/wwpdb/utils/nmr/pk/VnmrPKReader.py b/wwpdb/utils/nmr/pk/VnmrPKReader.py new file mode 100644 index 00000000..c71dfe14 --- /dev/null +++ b/wwpdb/utils/nmr/pk/VnmrPKReader.py @@ -0,0 +1,218 @@ +## +# VnmrPKReader.py +# +# Update: +## +""" A collection of classes for parsing VNMR PK files. +""" +import sys +import os + +from antlr4 import InputStream, CommonTokenStream, ParseTreeWalker + +try: + from wwpdb.utils.nmr.mr.LexerErrorListener import LexerErrorListener + from wwpdb.utils.nmr.mr.ParserErrorListener import ParserErrorListener + from wwpdb.utils.nmr.pk.VnmrPKLexer import VnmrPKLexer + from wwpdb.utils.nmr.pk.VnmrPKParser import VnmrPKParser + from wwpdb.utils.nmr.pk.VnmrPKParserListener import VnmrPKParserListener + from wwpdb.utils.nmr.mr.ParserListenerUtil import (coordAssemblyChecker, + MAX_ERROR_REPORT, + REPRESENTATIVE_MODEL_ID, + REPRESENTATIVE_ALT_ID) + from wwpdb.utils.nmr.io.CifReader import CifReader + from wwpdb.utils.nmr.ChemCompUtil import ChemCompUtil + from wwpdb.utils.nmr.BMRBChemShiftStat import BMRBChemShiftStat + from wwpdb.utils.nmr.NEFTranslator.NEFTranslator import NEFTranslator +except ImportError: + from nmr.mr.LexerErrorListener import LexerErrorListener + from nmr.mr.ParserErrorListener import ParserErrorListener + from nmr.pk.VnmrPKLexer import VnmrPKLexer + from nmr.pk.VnmrPKParser import VnmrPKParser + from nmr.pk.VnmrPKParserListener import VnmrPKParserListener + from nmr.mr.ParserListenerUtil import (coordAssemblyChecker, + MAX_ERROR_REPORT, + REPRESENTATIVE_MODEL_ID, + REPRESENTATIVE_ALT_ID) + from nmr.io.CifReader import CifReader + from nmr.ChemCompUtil import ChemCompUtil + from nmr.BMRBChemShiftStat import BMRBChemShiftStat + from nmr.NEFTranslator.NEFTranslator import NEFTranslator + + +class VnmrPKReader: + """ Accessor methods for parsing VNMR PK files. + """ + + def __init__(self, verbose=True, log=sys.stdout, + representativeModelId=REPRESENTATIVE_MODEL_ID, + representativeAltId=REPRESENTATIVE_ALT_ID, + mrAtomNameMapping=None, + cR=None, caC=None, ccU=None, csStat=None, nefT=None, + reasons=None): + self.__verbose = verbose + self.__lfh = log + self.__debug = False + + self.__maxLexerErrorReport = MAX_ERROR_REPORT + self.__maxParserErrorReport = MAX_ERROR_REPORT + + self.__representativeModelId = representativeModelId + self.__representativeAltId = representativeAltId + self.__mrAtomNameMapping = mrAtomNameMapping + + # CCD accessing utility + self.__ccU = ChemCompUtil(verbose, log) if ccU is None else ccU + + if cR is not None and caC is None: + caC = coordAssemblyChecker(verbose, log, representativeModelId, representativeAltId, + cR, self.__ccU, None, None, fullCheck=False) + + self.__cR = cR + self.__caC = caC + + # BMRB chemical shift statistics + self.__csStat = BMRBChemShiftStat(verbose, log, self.__ccU) if csStat is None else csStat + + # NEFTranslator + self.__nefT = NEFTranslator(verbose, log, self.__ccU, self.__csStat) if nefT is None else nefT + if nefT is None: + self.__nefT.set_remediation_mode(True) + + # reasons for re-parsing request from the previous trial + self.__reasons = reasons + + def setDebugMode(self, debug): + self.__debug = debug + + def setLexerMaxErrorReport(self, maxErrReport): + self.__maxLexerErrorReport = maxErrReport + + def setParserMaxErrorReport(self, maxErrReport): + self.__maxParserErrorReport = maxErrReport + + def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): + """ Parse VNMR PK file. + @return: VnmrPKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. + """ + + ifh = None + + try: + + if isFilePath: + pkString = None + + if not os.access(pkFilePath, os.R_OK): + if self.__verbose: + self.__lfh.write(f"VnmrPKReader.parse() {pkFilePath} is not accessible.\n") + return None, None, None + + ifh = open(pkFilePath, 'r') # pylint: disable=consider-using-with + input = InputStream(ifh.read()) + + else: + pkFilePath, pkString = None, pkFilePath + + if pkString is None or len(pkString) == 0: + if self.__verbose: + self.__lfh.write("VnmrPKReader.parse() Empty string.\n") + return None, None, None + + input = InputStream(pkString) + + if cifFilePath is not None: + if not os.access(cifFilePath, os.R_OK): + if self.__verbose: + self.__lfh.write(f"VnmrPKReader.parse() {cifFilePath} is not accessible.\n") + return None, None, None + + if self.__cR is None: + self.__cR = CifReader(self.__verbose, self.__lfh) + if not self.__cR.parse(cifFilePath): + return None, None, None + + lexer = VnmrPKLexer(input) + lexer.removeErrorListeners() + + lexer_error_listener = LexerErrorListener(pkFilePath, maxErrorReport=self.__maxLexerErrorReport) + lexer.addErrorListener(lexer_error_listener) + + messageList = lexer_error_listener.getMessageList() + + if messageList is not None and self.__verbose: + for description in messageList: + self.__lfh.write(f"[Syntax error] line {description['line_number']}:{description['column_position']} {description['message']}\n") + if 'input' in description: + self.__lfh.write(f"{description['input']}\n") + self.__lfh.write(f"{description['marker']}\n") + + stream = CommonTokenStream(lexer) + parser = VnmrPKParser(stream) + # try with simpler/faster SLL prediction mode + # parser._interp.predictionMode = PredictionMode.SLL # pylint: disable=protected-access + parser.removeErrorListeners() + parser_error_listener = ParserErrorListener(pkFilePath, maxErrorReport=self.__maxParserErrorReport) + parser.addErrorListener(parser_error_listener) + tree = parser.vnmr_pk() + + walker = ParseTreeWalker() + listener = VnmrPKParserListener(self.__verbose, self.__lfh, + self.__representativeModelId, + self.__representativeAltId, + self.__mrAtomNameMapping, + self.__cR, self.__caC, + self.__ccU, self.__csStat, self.__nefT, + self.__reasons) + listener.setDebugMode(self.__debug) + listener.createSfDict(createSfDict) + if createSfDict: + if originalFileName is not None: + listener.setOriginaFileName(originalFileName) + if listIdCounter is not None: + listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) + if entryId is not None: + listener.setEntryId(entryId) + walker.walk(listener, tree) + + messageList = parser_error_listener.getMessageList() + + if messageList is not None and self.__verbose: + for description in messageList: + self.__lfh.write(f"[Syntax error] line {description['line_number']}:{description['column_position']} {description['message']}\n") + if 'input' in description: + self.__lfh.write(f"{description['input']}\n") + self.__lfh.write(f"{description['marker']}\n") + + if self.__verbose: + if listener.warningMessage is not None and len(listener.warningMessage) > 0: + print('\n'.join(listener.warningMessage)) + if isFilePath: + print(listener.getContentSubtype()) + + return listener, parser_error_listener, lexer_error_listener + + except IOError as e: + if self.__verbose: + self.__lfh.write(f"+VnmrPKReader.parse() ++ Error - {str(e)}\n") + return None, None, None + # pylint: disable=unreachable + """ debug code + except Exception as e: + if self.__verbose and isFilePath: + self.__lfh.write(f"+VnmrPKReader.parse() ++ Error - {pkFilePath!r} - {str(e)}\n") + return None, None, None + """ + finally: + if isFilePath and ifh is not None: + ifh.close() + + +if __name__ == "__main__": + reader = VnmrPKReader(True) + reader.setDebugMode(True) + reader.parse('../../tests-nmr/mock-data-vnmr-peak-list/vnmr.pk', + '../../tests-nmr/mock-data-remediation/2js7/2js7.cif') # dummy diff --git a/wwpdb/utils/nmr/pk/XeasyPKLexer.py b/wwpdb/utils/nmr/pk/XeasyPKLexer.py index acad04a1..e4348cde 100644 --- a/wwpdb/utils/nmr/pk/XeasyPKLexer.py +++ b/wwpdb/utils/nmr/pk/XeasyPKLexer.py @@ -10,194 +10,208 @@ def serializedATN(): return [ - 4,0,36,500,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,2,0,7,0,2,1,7,1,2, - 2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2, - 10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7, - 16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2, - 23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7, - 29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2, - 36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2,42,7, - 42,2,43,7,43,1,0,1,0,5,0,98,8,0,10,0,12,0,101,9,0,1,0,1,0,1,0,1, - 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, - 0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1, - 2,1,2,1,2,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1, - 3,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1, - 4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,3, - 6,186,8,6,1,6,1,6,1,7,3,7,191,8,7,1,7,1,7,3,7,195,8,7,1,8,3,8,198, - 8,8,1,8,1,8,3,8,202,8,8,1,8,1,8,3,8,206,8,8,1,8,3,8,209,8,8,1,9, - 1,9,1,9,1,9,1,9,1,9,3,9,217,8,9,1,10,1,10,1,11,4,11,222,8,11,11, - 11,12,11,223,1,12,4,12,227,8,12,11,12,12,12,228,1,12,5,12,232,8, - 12,10,12,12,12,235,9,12,1,12,5,12,238,8,12,10,12,12,12,241,9,12, - 1,12,5,12,244,8,12,10,12,12,12,247,9,12,1,12,1,12,1,13,4,13,252, - 8,13,11,13,12,13,253,1,13,5,13,257,8,13,10,13,12,13,260,9,13,1,13, - 5,13,263,8,13,10,13,12,13,266,9,13,1,13,5,13,269,8,13,10,13,12,13, - 272,9,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,3,16,282,8,16,1, - 17,1,17,3,17,286,8,17,1,18,1,18,3,18,290,8,18,1,19,1,19,5,19,294, - 8,19,10,19,12,19,297,9,19,1,20,4,20,300,8,20,11,20,12,20,301,1,20, - 1,20,1,21,4,21,307,8,21,11,21,12,21,308,1,22,1,22,1,22,5,22,314, - 8,22,10,22,12,22,317,9,22,1,22,1,22,1,22,1,22,1,23,1,23,1,23,4,23, - 326,8,23,11,23,12,23,327,1,23,1,23,4,23,332,8,23,11,23,12,23,333, - 1,23,1,23,4,23,338,8,23,11,23,12,23,339,1,23,1,23,1,23,1,23,1,23, - 1,23,3,23,348,8,23,1,23,5,23,351,8,23,10,23,12,23,354,9,23,1,23, - 1,23,1,23,1,23,1,24,1,24,1,24,4,24,363,8,24,11,24,12,24,364,1,24, - 1,24,4,24,369,8,24,11,24,12,24,370,1,24,1,24,4,24,375,8,24,11,24, - 12,24,376,1,24,1,24,1,24,1,24,1,24,1,24,3,24,385,8,24,1,24,5,24, - 388,8,24,10,24,12,24,391,9,24,1,24,1,24,1,24,1,24,1,25,3,25,398, - 8,25,1,25,1,25,1,26,4,26,403,8,26,11,26,12,26,404,1,26,1,26,1,27, - 4,27,410,8,27,11,27,12,27,411,1,27,1,27,1,28,1,28,1,29,4,29,419, - 8,29,11,29,12,29,420,1,29,1,29,1,30,4,30,426,8,30,11,30,12,30,427, - 1,30,1,30,1,31,3,31,433,8,31,1,31,1,31,1,32,1,32,1,33,4,33,440,8, - 33,11,33,12,33,441,1,33,1,33,1,34,4,34,447,8,34,11,34,12,34,448, - 1,34,1,34,1,35,1,35,1,36,4,36,456,8,36,11,36,12,36,457,1,36,1,36, - 1,37,4,37,463,8,37,11,37,12,37,464,1,37,1,37,1,38,1,38,1,39,4,39, - 472,8,39,11,39,12,39,473,1,39,1,39,1,40,4,40,479,8,40,11,40,12,40, - 480,1,40,1,40,1,41,1,41,1,42,4,42,488,8,42,11,42,12,42,489,1,42, - 1,42,1,43,4,43,495,8,43,11,43,12,43,496,1,43,1,43,1,315,0,44,7,1, - 9,2,11,3,13,4,15,5,17,6,19,7,21,8,23,9,25,0,27,0,29,0,31,10,33,11, - 35,12,37,0,39,0,41,0,43,0,45,0,47,13,49,14,51,15,53,16,55,17,57, - 18,59,19,61,20,63,21,65,22,67,23,69,24,71,25,73,26,75,27,77,28,79, - 29,81,30,83,31,85,32,87,33,89,34,91,35,93,36,7,0,1,2,3,4,5,6,10, - 2,0,9,10,13,13,2,0,43,43,45,45,2,0,69,69,101,101,1,0,48,57,2,0,10, - 10,13,13,2,0,65,90,97,122,5,0,35,35,42,43,45,46,63,63,95,95,2,0, - 34,34,39,39,2,0,9,9,32,32,4,0,33,33,38,38,59,59,92,92,541,0,7,1, - 0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,1, - 0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,31,1,0,0,0,0,33,1, - 0,0,0,0,35,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1, - 0,0,0,0,55,1,0,0,0,1,57,1,0,0,0,1,59,1,0,0,0,1,61,1,0,0,0,2,63,1, - 0,0,0,2,65,1,0,0,0,2,67,1,0,0,0,3,69,1,0,0,0,3,71,1,0,0,0,3,73,1, - 0,0,0,3,75,1,0,0,0,4,77,1,0,0,0,4,79,1,0,0,0,4,81,1,0,0,0,5,83,1, - 0,0,0,5,85,1,0,0,0,5,87,1,0,0,0,6,89,1,0,0,0,6,91,1,0,0,0,6,93,1, - 0,0,0,7,95,1,0,0,0,9,125,1,0,0,0,11,135,1,0,0,0,13,144,1,0,0,0,15, - 159,1,0,0,0,17,171,1,0,0,0,19,185,1,0,0,0,21,190,1,0,0,0,23,197, - 1,0,0,0,25,216,1,0,0,0,27,218,1,0,0,0,29,221,1,0,0,0,31,226,1,0, - 0,0,33,251,1,0,0,0,35,275,1,0,0,0,37,277,1,0,0,0,39,281,1,0,0,0, - 41,285,1,0,0,0,43,289,1,0,0,0,45,291,1,0,0,0,47,299,1,0,0,0,49,306, - 1,0,0,0,51,310,1,0,0,0,53,347,1,0,0,0,55,384,1,0,0,0,57,397,1,0, - 0,0,59,402,1,0,0,0,61,409,1,0,0,0,63,415,1,0,0,0,65,418,1,0,0,0, - 67,425,1,0,0,0,69,432,1,0,0,0,71,436,1,0,0,0,73,439,1,0,0,0,75,446, - 1,0,0,0,77,452,1,0,0,0,79,455,1,0,0,0,81,462,1,0,0,0,83,468,1,0, - 0,0,85,471,1,0,0,0,87,478,1,0,0,0,89,484,1,0,0,0,91,487,1,0,0,0, - 93,494,1,0,0,0,95,99,5,35,0,0,96,98,8,0,0,0,97,96,1,0,0,0,98,101, - 1,0,0,0,99,97,1,0,0,0,99,100,1,0,0,0,100,102,1,0,0,0,101,99,1,0, - 0,0,102,103,5,78,0,0,103,104,5,117,0,0,104,105,5,109,0,0,105,106, - 5,98,0,0,106,107,5,101,0,0,107,108,5,114,0,0,108,109,5,32,0,0,109, - 110,5,111,0,0,110,111,5,102,0,0,111,112,5,32,0,0,112,113,5,100,0, - 0,113,114,5,105,0,0,114,115,5,109,0,0,115,116,5,101,0,0,116,117, - 5,110,0,0,117,118,5,115,0,0,118,119,5,105,0,0,119,120,5,111,0,0, - 120,121,5,110,0,0,121,122,5,115,0,0,122,123,1,0,0,0,123,124,6,0, - 0,0,124,8,1,0,0,0,125,126,5,35,0,0,126,127,5,70,0,0,127,128,5,79, - 0,0,128,129,5,82,0,0,129,130,5,77,0,0,130,131,5,65,0,0,131,132,5, - 84,0,0,132,133,1,0,0,0,133,134,6,1,1,0,134,10,1,0,0,0,135,136,5, - 35,0,0,136,137,5,73,0,0,137,138,5,78,0,0,138,139,5,65,0,0,139,140, - 5,77,0,0,140,141,5,69,0,0,141,142,1,0,0,0,142,143,6,2,2,0,143,12, - 1,0,0,0,144,145,5,35,0,0,145,146,5,67,0,0,146,147,5,89,0,0,147,148, - 5,65,0,0,148,149,5,78,0,0,149,150,5,65,0,0,150,151,5,70,0,0,151, - 152,5,79,0,0,152,153,5,82,0,0,153,154,5,77,0,0,154,155,5,65,0,0, - 155,156,5,84,0,0,156,157,1,0,0,0,157,158,6,3,3,0,158,14,1,0,0,0, - 159,160,5,35,0,0,160,161,5,83,0,0,161,162,5,80,0,0,162,163,5,69, - 0,0,163,164,5,67,0,0,164,165,5,84,0,0,165,166,5,82,0,0,166,167,5, - 85,0,0,167,168,5,77,0,0,168,169,1,0,0,0,169,170,6,4,4,0,170,16,1, - 0,0,0,171,172,5,35,0,0,172,173,5,84,0,0,173,174,5,79,0,0,174,175, - 5,76,0,0,175,176,5,69,0,0,176,177,5,82,0,0,177,178,5,65,0,0,178, - 179,5,78,0,0,179,180,5,67,0,0,180,181,5,69,0,0,181,182,1,0,0,0,182, - 183,6,5,5,0,183,18,1,0,0,0,184,186,7,1,0,0,185,184,1,0,0,0,185,186, - 1,0,0,0,186,187,1,0,0,0,187,188,3,29,11,0,188,20,1,0,0,0,189,191, - 7,1,0,0,190,189,1,0,0,0,190,191,1,0,0,0,191,194,1,0,0,0,192,195, - 3,29,11,0,193,195,3,25,9,0,194,192,1,0,0,0,194,193,1,0,0,0,195,22, - 1,0,0,0,196,198,7,1,0,0,197,196,1,0,0,0,197,198,1,0,0,0,198,201, - 1,0,0,0,199,202,3,29,11,0,200,202,3,25,9,0,201,199,1,0,0,0,201,200, - 1,0,0,0,202,208,1,0,0,0,203,205,7,2,0,0,204,206,7,1,0,0,205,204, - 1,0,0,0,205,206,1,0,0,0,206,207,1,0,0,0,207,209,3,29,11,0,208,203, - 1,0,0,0,208,209,1,0,0,0,209,24,1,0,0,0,210,211,3,29,11,0,211,212, - 5,46,0,0,212,213,3,29,11,0,213,217,1,0,0,0,214,215,5,46,0,0,215, - 217,3,29,11,0,216,210,1,0,0,0,216,214,1,0,0,0,217,26,1,0,0,0,218, - 219,7,3,0,0,219,28,1,0,0,0,220,222,3,27,10,0,221,220,1,0,0,0,222, - 223,1,0,0,0,223,221,1,0,0,0,223,224,1,0,0,0,224,30,1,0,0,0,225,227, - 5,33,0,0,226,225,1,0,0,0,227,228,1,0,0,0,228,226,1,0,0,0,228,229, - 1,0,0,0,229,233,1,0,0,0,230,232,8,4,0,0,231,230,1,0,0,0,232,235, - 1,0,0,0,233,231,1,0,0,0,233,234,1,0,0,0,234,239,1,0,0,0,235,233, - 1,0,0,0,236,238,5,33,0,0,237,236,1,0,0,0,238,241,1,0,0,0,239,237, - 1,0,0,0,239,240,1,0,0,0,240,245,1,0,0,0,241,239,1,0,0,0,242,244, - 8,4,0,0,243,242,1,0,0,0,244,247,1,0,0,0,245,243,1,0,0,0,245,246, - 1,0,0,0,246,248,1,0,0,0,247,245,1,0,0,0,248,249,6,12,6,0,249,32, - 1,0,0,0,250,252,5,59,0,0,251,250,1,0,0,0,252,253,1,0,0,0,253,251, - 1,0,0,0,253,254,1,0,0,0,254,258,1,0,0,0,255,257,8,4,0,0,256,255, - 1,0,0,0,257,260,1,0,0,0,258,256,1,0,0,0,258,259,1,0,0,0,259,264, - 1,0,0,0,260,258,1,0,0,0,261,263,5,59,0,0,262,261,1,0,0,0,263,266, - 1,0,0,0,264,262,1,0,0,0,264,265,1,0,0,0,265,270,1,0,0,0,266,264, - 1,0,0,0,267,269,8,4,0,0,268,267,1,0,0,0,269,272,1,0,0,0,270,268, - 1,0,0,0,270,271,1,0,0,0,271,273,1,0,0,0,272,270,1,0,0,0,273,274, - 6,13,6,0,274,34,1,0,0,0,275,276,3,45,19,0,276,36,1,0,0,0,277,278, - 7,5,0,0,278,38,1,0,0,0,279,282,3,37,15,0,280,282,3,27,10,0,281,279, - 1,0,0,0,281,280,1,0,0,0,282,40,1,0,0,0,283,286,3,39,16,0,284,286, - 7,6,0,0,285,283,1,0,0,0,285,284,1,0,0,0,286,42,1,0,0,0,287,290,3, - 41,17,0,288,290,7,7,0,0,289,287,1,0,0,0,289,288,1,0,0,0,290,44,1, - 0,0,0,291,295,3,41,17,0,292,294,3,43,18,0,293,292,1,0,0,0,294,297, - 1,0,0,0,295,293,1,0,0,0,295,296,1,0,0,0,296,46,1,0,0,0,297,295,1, - 0,0,0,298,300,7,8,0,0,299,298,1,0,0,0,300,301,1,0,0,0,301,299,1, - 0,0,0,301,302,1,0,0,0,302,303,1,0,0,0,303,304,6,20,7,0,304,48,1, - 0,0,0,305,307,7,4,0,0,306,305,1,0,0,0,307,308,1,0,0,0,308,306,1, - 0,0,0,308,309,1,0,0,0,309,50,1,0,0,0,310,315,5,123,0,0,311,314,3, - 51,22,0,312,314,9,0,0,0,313,311,1,0,0,0,313,312,1,0,0,0,314,317, - 1,0,0,0,315,316,1,0,0,0,315,313,1,0,0,0,316,318,1,0,0,0,317,315, - 1,0,0,0,318,319,5,125,0,0,319,320,1,0,0,0,320,321,6,22,6,0,321,52, - 1,0,0,0,322,348,7,9,0,0,323,325,5,47,0,0,324,326,5,47,0,0,325,324, - 1,0,0,0,326,327,1,0,0,0,327,325,1,0,0,0,327,328,1,0,0,0,328,348, - 1,0,0,0,329,331,5,42,0,0,330,332,5,42,0,0,331,330,1,0,0,0,332,333, - 1,0,0,0,333,331,1,0,0,0,333,334,1,0,0,0,334,348,1,0,0,0,335,337, - 5,61,0,0,336,338,5,61,0,0,337,336,1,0,0,0,338,339,1,0,0,0,339,337, - 1,0,0,0,339,340,1,0,0,0,340,348,1,0,0,0,341,342,5,82,0,0,342,343, - 5,69,0,0,343,344,5,77,0,0,344,345,5,65,0,0,345,346,5,82,0,0,346, - 348,5,75,0,0,347,322,1,0,0,0,347,323,1,0,0,0,347,329,1,0,0,0,347, - 335,1,0,0,0,347,341,1,0,0,0,348,352,1,0,0,0,349,351,5,32,0,0,350, - 349,1,0,0,0,351,354,1,0,0,0,352,350,1,0,0,0,352,353,1,0,0,0,353, - 355,1,0,0,0,354,352,1,0,0,0,355,356,3,49,21,0,356,357,1,0,0,0,357, - 358,6,23,6,0,358,54,1,0,0,0,359,385,7,9,0,0,360,362,5,47,0,0,361, - 363,5,47,0,0,362,361,1,0,0,0,363,364,1,0,0,0,364,362,1,0,0,0,364, - 365,1,0,0,0,365,385,1,0,0,0,366,368,5,42,0,0,367,369,5,42,0,0,368, - 367,1,0,0,0,369,370,1,0,0,0,370,368,1,0,0,0,370,371,1,0,0,0,371, - 385,1,0,0,0,372,374,5,61,0,0,373,375,5,61,0,0,374,373,1,0,0,0,375, - 376,1,0,0,0,376,374,1,0,0,0,376,377,1,0,0,0,377,385,1,0,0,0,378, - 379,5,82,0,0,379,380,5,69,0,0,380,381,5,77,0,0,381,382,5,65,0,0, - 382,383,5,82,0,0,383,385,5,75,0,0,384,359,1,0,0,0,384,360,1,0,0, - 0,384,366,1,0,0,0,384,372,1,0,0,0,384,378,1,0,0,0,385,389,1,0,0, - 0,386,388,8,4,0,0,387,386,1,0,0,0,388,391,1,0,0,0,389,387,1,0,0, - 0,389,390,1,0,0,0,390,392,1,0,0,0,391,389,1,0,0,0,392,393,3,49,21, - 0,393,394,1,0,0,0,394,395,6,24,6,0,395,56,1,0,0,0,396,398,7,1,0, - 0,397,396,1,0,0,0,397,398,1,0,0,0,398,399,1,0,0,0,399,400,3,29,11, - 0,400,58,1,0,0,0,401,403,7,8,0,0,402,401,1,0,0,0,403,404,1,0,0,0, - 404,402,1,0,0,0,404,405,1,0,0,0,405,406,1,0,0,0,406,407,6,26,7,0, - 407,60,1,0,0,0,408,410,7,4,0,0,409,408,1,0,0,0,410,411,1,0,0,0,411, - 409,1,0,0,0,411,412,1,0,0,0,412,413,1,0,0,0,413,414,6,27,8,0,414, - 62,1,0,0,0,415,416,3,45,19,0,416,64,1,0,0,0,417,419,7,8,0,0,418, - 417,1,0,0,0,419,420,1,0,0,0,420,418,1,0,0,0,420,421,1,0,0,0,421, - 422,1,0,0,0,422,423,6,29,7,0,423,66,1,0,0,0,424,426,7,4,0,0,425, - 424,1,0,0,0,426,427,1,0,0,0,427,425,1,0,0,0,427,428,1,0,0,0,428, - 429,1,0,0,0,429,430,6,30,8,0,430,68,1,0,0,0,431,433,7,1,0,0,432, - 431,1,0,0,0,432,433,1,0,0,0,433,434,1,0,0,0,434,435,3,29,11,0,435, - 70,1,0,0,0,436,437,3,45,19,0,437,72,1,0,0,0,438,440,7,8,0,0,439, - 438,1,0,0,0,440,441,1,0,0,0,441,439,1,0,0,0,441,442,1,0,0,0,442, - 443,1,0,0,0,443,444,6,33,7,0,444,74,1,0,0,0,445,447,7,4,0,0,446, - 445,1,0,0,0,447,448,1,0,0,0,448,446,1,0,0,0,448,449,1,0,0,0,449, - 450,1,0,0,0,450,451,6,34,8,0,451,76,1,0,0,0,452,453,3,45,19,0,453, - 78,1,0,0,0,454,456,7,8,0,0,455,454,1,0,0,0,456,457,1,0,0,0,457,455, - 1,0,0,0,457,458,1,0,0,0,458,459,1,0,0,0,459,460,6,36,7,0,460,80, - 1,0,0,0,461,463,7,4,0,0,462,461,1,0,0,0,463,464,1,0,0,0,464,462, - 1,0,0,0,464,465,1,0,0,0,465,466,1,0,0,0,466,467,6,37,8,0,467,82, - 1,0,0,0,468,469,3,45,19,0,469,84,1,0,0,0,470,472,7,8,0,0,471,470, - 1,0,0,0,472,473,1,0,0,0,473,471,1,0,0,0,473,474,1,0,0,0,474,475, - 1,0,0,0,475,476,6,39,7,0,476,86,1,0,0,0,477,479,7,4,0,0,478,477, - 1,0,0,0,479,480,1,0,0,0,480,478,1,0,0,0,480,481,1,0,0,0,481,482, - 1,0,0,0,482,483,6,40,8,0,483,88,1,0,0,0,484,485,3,21,7,0,485,90, - 1,0,0,0,486,488,7,8,0,0,487,486,1,0,0,0,488,489,1,0,0,0,489,487, - 1,0,0,0,489,490,1,0,0,0,490,491,1,0,0,0,491,492,6,42,7,0,492,92, - 1,0,0,0,493,495,7,4,0,0,494,493,1,0,0,0,495,496,1,0,0,0,496,494, - 1,0,0,0,496,497,1,0,0,0,497,498,1,0,0,0,498,499,6,43,8,0,499,94, - 1,0,0,0,57,0,1,2,3,4,5,6,99,185,190,194,197,201,205,208,216,223, - 228,233,239,245,253,258,264,270,281,285,289,295,301,308,313,315, - 327,333,339,347,352,364,370,376,384,389,397,404,411,420,427,432, - 441,448,457,464,473,480,489,496,9,5,1,0,5,2,0,5,3,0,5,4,0,5,5,0, - 5,6,0,0,1,0,6,0,0,4,0,0 + 4,0,40,535,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,6,-1,2,0,7,0,2,1,7, + 1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,7, + 9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2, + 16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7, + 22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2, + 29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7, + 35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39,2,40,7,40,2,41,7,41,2, + 42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46,7,46,2,47,7,47,1,0,1, + 0,5,0,107,8,0,10,0,12,0,110,9,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, + 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,1, + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2, + 1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3, + 1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5, + 1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,3,6,195,8,6,1,6,1,6, + 1,7,3,7,200,8,7,1,7,1,7,3,7,204,8,7,1,8,3,8,207,8,8,1,8,1,8,3,8, + 211,8,8,1,8,1,8,3,8,215,8,8,1,8,3,8,218,8,8,1,9,1,9,1,9,1,9,1,9, + 1,9,3,9,226,8,9,1,10,1,10,1,11,4,11,231,8,11,11,11,12,11,232,1,12, + 4,12,236,8,12,11,12,12,12,237,1,12,1,12,1,13,4,13,243,8,13,11,13, + 12,13,244,1,13,5,13,248,8,13,10,13,12,13,251,9,13,1,13,5,13,254, + 8,13,10,13,12,13,257,9,13,1,13,5,13,260,8,13,10,13,12,13,263,9,13, + 1,13,1,13,1,14,4,14,268,8,14,11,14,12,14,269,1,14,5,14,273,8,14, + 10,14,12,14,276,9,14,1,14,5,14,279,8,14,10,14,12,14,282,9,14,1,14, + 5,14,285,8,14,10,14,12,14,288,9,14,1,14,1,14,1,15,1,15,1,16,1,16, + 1,17,1,17,3,17,298,8,17,1,18,1,18,3,18,302,8,18,1,19,1,19,3,19,306, + 8,19,1,20,1,20,5,20,310,8,20,10,20,12,20,313,9,20,1,21,4,21,316, + 8,21,11,21,12,21,317,1,21,1,21,1,22,4,22,323,8,22,11,22,12,22,324, + 1,23,1,23,1,23,5,23,330,8,23,10,23,12,23,333,9,23,1,23,1,23,1,23, + 1,23,1,24,1,24,1,24,4,24,342,8,24,11,24,12,24,343,1,24,1,24,4,24, + 348,8,24,11,24,12,24,349,1,24,1,24,4,24,354,8,24,11,24,12,24,355, + 1,24,1,24,1,24,1,24,1,24,1,24,3,24,364,8,24,1,24,5,24,367,8,24,10, + 24,12,24,370,9,24,1,24,1,24,1,24,1,24,1,25,1,25,1,25,4,25,379,8, + 25,11,25,12,25,380,1,25,1,25,4,25,385,8,25,11,25,12,25,386,1,25, + 1,25,4,25,391,8,25,11,25,12,25,392,1,25,1,25,1,25,1,25,1,25,1,25, + 3,25,401,8,25,1,25,5,25,404,8,25,10,25,12,25,407,9,25,1,25,1,25, + 1,25,1,25,1,26,3,26,414,8,26,1,26,1,26,1,27,4,27,419,8,27,11,27, + 12,27,420,1,27,1,27,1,28,4,28,426,8,28,11,28,12,28,427,1,28,1,28, + 1,29,1,29,1,30,4,30,435,8,30,11,30,12,30,436,1,30,1,30,1,31,4,31, + 442,8,31,11,31,12,31,443,1,31,1,31,1,32,3,32,449,8,32,1,32,1,32, + 1,33,1,33,1,34,4,34,456,8,34,11,34,12,34,457,1,34,1,34,1,35,4,35, + 463,8,35,11,35,12,35,464,1,35,1,35,1,36,1,36,1,37,4,37,472,8,37, + 11,37,12,37,473,1,37,1,37,1,38,4,38,479,8,38,11,38,12,38,480,1,38, + 1,38,1,39,1,39,1,40,4,40,488,8,40,11,40,12,40,489,1,40,1,40,1,41, + 4,41,495,8,41,11,41,12,41,496,1,41,1,41,1,42,1,42,1,43,4,43,504, + 8,43,11,43,12,43,505,1,43,1,43,1,44,4,44,511,8,44,11,44,12,44,512, + 1,44,1,44,1,45,4,45,518,8,45,11,45,12,45,519,1,46,4,46,523,8,46, + 11,46,12,46,524,1,46,1,46,1,47,4,47,530,8,47,11,47,12,47,531,1,47, + 1,47,1,331,0,48,8,1,10,2,12,3,14,4,16,5,18,6,20,7,22,8,24,9,26,0, + 28,0,30,0,32,10,34,11,36,12,38,13,40,0,42,0,44,0,46,0,48,0,50,14, + 52,15,54,16,56,17,58,18,60,19,62,20,64,21,66,22,68,23,70,24,72,25, + 74,26,76,27,78,28,80,29,82,30,84,31,86,32,88,33,90,34,92,35,94,36, + 96,37,98,38,100,39,102,40,8,0,1,2,3,4,5,6,7,12,2,0,9,10,13,13,2, + 0,43,43,45,45,2,0,69,69,101,101,1,0,48,57,2,0,33,33,35,35,2,0,10, + 10,13,13,2,0,65,90,97,122,4,0,42,43,45,46,63,63,95,95,2,0,34,34, + 39,39,2,0,9,9,32,32,3,0,38,38,59,59,92,92,3,0,9,10,13,13,32,32,579, + 0,8,1,0,0,0,0,10,1,0,0,0,0,12,1,0,0,0,0,14,1,0,0,0,0,16,1,0,0,0, + 0,18,1,0,0,0,0,20,1,0,0,0,0,22,1,0,0,0,0,24,1,0,0,0,0,32,1,0,0,0, + 0,34,1,0,0,0,0,36,1,0,0,0,0,38,1,0,0,0,0,50,1,0,0,0,0,52,1,0,0,0, + 0,54,1,0,0,0,0,56,1,0,0,0,0,58,1,0,0,0,1,60,1,0,0,0,1,62,1,0,0,0, + 1,64,1,0,0,0,2,66,1,0,0,0,2,68,1,0,0,0,2,70,1,0,0,0,3,72,1,0,0,0, + 3,74,1,0,0,0,3,76,1,0,0,0,3,78,1,0,0,0,4,80,1,0,0,0,4,82,1,0,0,0, + 4,84,1,0,0,0,5,86,1,0,0,0,5,88,1,0,0,0,5,90,1,0,0,0,6,92,1,0,0,0, + 6,94,1,0,0,0,6,96,1,0,0,0,7,98,1,0,0,0,7,100,1,0,0,0,7,102,1,0,0, + 0,8,104,1,0,0,0,10,134,1,0,0,0,12,144,1,0,0,0,14,153,1,0,0,0,16, + 168,1,0,0,0,18,180,1,0,0,0,20,194,1,0,0,0,22,199,1,0,0,0,24,206, + 1,0,0,0,26,225,1,0,0,0,28,227,1,0,0,0,30,230,1,0,0,0,32,235,1,0, + 0,0,34,242,1,0,0,0,36,267,1,0,0,0,38,291,1,0,0,0,40,293,1,0,0,0, + 42,297,1,0,0,0,44,301,1,0,0,0,46,305,1,0,0,0,48,307,1,0,0,0,50,315, + 1,0,0,0,52,322,1,0,0,0,54,326,1,0,0,0,56,363,1,0,0,0,58,400,1,0, + 0,0,60,413,1,0,0,0,62,418,1,0,0,0,64,425,1,0,0,0,66,431,1,0,0,0, + 68,434,1,0,0,0,70,441,1,0,0,0,72,448,1,0,0,0,74,452,1,0,0,0,76,455, + 1,0,0,0,78,462,1,0,0,0,80,468,1,0,0,0,82,471,1,0,0,0,84,478,1,0, + 0,0,86,484,1,0,0,0,88,487,1,0,0,0,90,494,1,0,0,0,92,500,1,0,0,0, + 94,503,1,0,0,0,96,510,1,0,0,0,98,517,1,0,0,0,100,522,1,0,0,0,102, + 529,1,0,0,0,104,108,5,35,0,0,105,107,8,0,0,0,106,105,1,0,0,0,107, + 110,1,0,0,0,108,106,1,0,0,0,108,109,1,0,0,0,109,111,1,0,0,0,110, + 108,1,0,0,0,111,112,5,78,0,0,112,113,5,117,0,0,113,114,5,109,0,0, + 114,115,5,98,0,0,115,116,5,101,0,0,116,117,5,114,0,0,117,118,5,32, + 0,0,118,119,5,111,0,0,119,120,5,102,0,0,120,121,5,32,0,0,121,122, + 5,100,0,0,122,123,5,105,0,0,123,124,5,109,0,0,124,125,5,101,0,0, + 125,126,5,110,0,0,126,127,5,115,0,0,127,128,5,105,0,0,128,129,5, + 111,0,0,129,130,5,110,0,0,130,131,5,115,0,0,131,132,1,0,0,0,132, + 133,6,0,0,0,133,9,1,0,0,0,134,135,5,35,0,0,135,136,5,70,0,0,136, + 137,5,79,0,0,137,138,5,82,0,0,138,139,5,77,0,0,139,140,5,65,0,0, + 140,141,5,84,0,0,141,142,1,0,0,0,142,143,6,1,1,0,143,11,1,0,0,0, + 144,145,5,35,0,0,145,146,5,73,0,0,146,147,5,78,0,0,147,148,5,65, + 0,0,148,149,5,77,0,0,149,150,5,69,0,0,150,151,1,0,0,0,151,152,6, + 2,2,0,152,13,1,0,0,0,153,154,5,35,0,0,154,155,5,67,0,0,155,156,5, + 89,0,0,156,157,5,65,0,0,157,158,5,78,0,0,158,159,5,65,0,0,159,160, + 5,70,0,0,160,161,5,79,0,0,161,162,5,82,0,0,162,163,5,77,0,0,163, + 164,5,65,0,0,164,165,5,84,0,0,165,166,1,0,0,0,166,167,6,3,3,0,167, + 15,1,0,0,0,168,169,5,35,0,0,169,170,5,83,0,0,170,171,5,80,0,0,171, + 172,5,69,0,0,172,173,5,67,0,0,173,174,5,84,0,0,174,175,5,82,0,0, + 175,176,5,85,0,0,176,177,5,77,0,0,177,178,1,0,0,0,178,179,6,4,4, + 0,179,17,1,0,0,0,180,181,5,35,0,0,181,182,5,84,0,0,182,183,5,79, + 0,0,183,184,5,76,0,0,184,185,5,69,0,0,185,186,5,82,0,0,186,187,5, + 65,0,0,187,188,5,78,0,0,188,189,5,67,0,0,189,190,5,69,0,0,190,191, + 1,0,0,0,191,192,6,5,5,0,192,19,1,0,0,0,193,195,7,1,0,0,194,193,1, + 0,0,0,194,195,1,0,0,0,195,196,1,0,0,0,196,197,3,30,11,0,197,21,1, + 0,0,0,198,200,7,1,0,0,199,198,1,0,0,0,199,200,1,0,0,0,200,203,1, + 0,0,0,201,204,3,30,11,0,202,204,3,26,9,0,203,201,1,0,0,0,203,202, + 1,0,0,0,204,23,1,0,0,0,205,207,7,1,0,0,206,205,1,0,0,0,206,207,1, + 0,0,0,207,210,1,0,0,0,208,211,3,30,11,0,209,211,3,26,9,0,210,208, + 1,0,0,0,210,209,1,0,0,0,211,217,1,0,0,0,212,214,7,2,0,0,213,215, + 7,1,0,0,214,213,1,0,0,0,214,215,1,0,0,0,215,216,1,0,0,0,216,218, + 3,30,11,0,217,212,1,0,0,0,217,218,1,0,0,0,218,25,1,0,0,0,219,220, + 3,30,11,0,220,221,5,46,0,0,221,222,3,30,11,0,222,226,1,0,0,0,223, + 224,5,46,0,0,224,226,3,30,11,0,225,219,1,0,0,0,225,223,1,0,0,0,226, + 27,1,0,0,0,227,228,7,3,0,0,228,29,1,0,0,0,229,231,3,28,10,0,230, + 229,1,0,0,0,231,232,1,0,0,0,232,230,1,0,0,0,232,233,1,0,0,0,233, + 31,1,0,0,0,234,236,7,4,0,0,235,234,1,0,0,0,236,237,1,0,0,0,237,235, + 1,0,0,0,237,238,1,0,0,0,238,239,1,0,0,0,239,240,6,12,6,0,240,33, + 1,0,0,0,241,243,5,33,0,0,242,241,1,0,0,0,243,244,1,0,0,0,244,242, + 1,0,0,0,244,245,1,0,0,0,245,249,1,0,0,0,246,248,8,5,0,0,247,246, + 1,0,0,0,248,251,1,0,0,0,249,247,1,0,0,0,249,250,1,0,0,0,250,255, + 1,0,0,0,251,249,1,0,0,0,252,254,5,33,0,0,253,252,1,0,0,0,254,257, + 1,0,0,0,255,253,1,0,0,0,255,256,1,0,0,0,256,261,1,0,0,0,257,255, + 1,0,0,0,258,260,8,5,0,0,259,258,1,0,0,0,260,263,1,0,0,0,261,259, + 1,0,0,0,261,262,1,0,0,0,262,264,1,0,0,0,263,261,1,0,0,0,264,265, + 6,13,7,0,265,35,1,0,0,0,266,268,5,59,0,0,267,266,1,0,0,0,268,269, + 1,0,0,0,269,267,1,0,0,0,269,270,1,0,0,0,270,274,1,0,0,0,271,273, + 8,5,0,0,272,271,1,0,0,0,273,276,1,0,0,0,274,272,1,0,0,0,274,275, + 1,0,0,0,275,280,1,0,0,0,276,274,1,0,0,0,277,279,5,59,0,0,278,277, + 1,0,0,0,279,282,1,0,0,0,280,278,1,0,0,0,280,281,1,0,0,0,281,286, + 1,0,0,0,282,280,1,0,0,0,283,285,8,5,0,0,284,283,1,0,0,0,285,288, + 1,0,0,0,286,284,1,0,0,0,286,287,1,0,0,0,287,289,1,0,0,0,288,286, + 1,0,0,0,289,290,6,14,7,0,290,37,1,0,0,0,291,292,3,48,20,0,292,39, + 1,0,0,0,293,294,7,6,0,0,294,41,1,0,0,0,295,298,3,40,16,0,296,298, + 3,28,10,0,297,295,1,0,0,0,297,296,1,0,0,0,298,43,1,0,0,0,299,302, + 3,42,17,0,300,302,7,7,0,0,301,299,1,0,0,0,301,300,1,0,0,0,302,45, + 1,0,0,0,303,306,3,44,18,0,304,306,7,8,0,0,305,303,1,0,0,0,305,304, + 1,0,0,0,306,47,1,0,0,0,307,311,3,44,18,0,308,310,3,46,19,0,309,308, + 1,0,0,0,310,313,1,0,0,0,311,309,1,0,0,0,311,312,1,0,0,0,312,49,1, + 0,0,0,313,311,1,0,0,0,314,316,7,9,0,0,315,314,1,0,0,0,316,317,1, + 0,0,0,317,315,1,0,0,0,317,318,1,0,0,0,318,319,1,0,0,0,319,320,6, + 21,8,0,320,51,1,0,0,0,321,323,7,5,0,0,322,321,1,0,0,0,323,324,1, + 0,0,0,324,322,1,0,0,0,324,325,1,0,0,0,325,53,1,0,0,0,326,331,5,123, + 0,0,327,330,3,54,23,0,328,330,9,0,0,0,329,327,1,0,0,0,329,328,1, + 0,0,0,330,333,1,0,0,0,331,332,1,0,0,0,331,329,1,0,0,0,332,334,1, + 0,0,0,333,331,1,0,0,0,334,335,5,125,0,0,335,336,1,0,0,0,336,337, + 6,23,7,0,337,55,1,0,0,0,338,364,7,10,0,0,339,341,5,47,0,0,340,342, + 5,47,0,0,341,340,1,0,0,0,342,343,1,0,0,0,343,341,1,0,0,0,343,344, + 1,0,0,0,344,364,1,0,0,0,345,347,5,42,0,0,346,348,5,42,0,0,347,346, + 1,0,0,0,348,349,1,0,0,0,349,347,1,0,0,0,349,350,1,0,0,0,350,364, + 1,0,0,0,351,353,5,61,0,0,352,354,5,61,0,0,353,352,1,0,0,0,354,355, + 1,0,0,0,355,353,1,0,0,0,355,356,1,0,0,0,356,364,1,0,0,0,357,358, + 5,82,0,0,358,359,5,69,0,0,359,360,5,77,0,0,360,361,5,65,0,0,361, + 362,5,82,0,0,362,364,5,75,0,0,363,338,1,0,0,0,363,339,1,0,0,0,363, + 345,1,0,0,0,363,351,1,0,0,0,363,357,1,0,0,0,364,368,1,0,0,0,365, + 367,5,32,0,0,366,365,1,0,0,0,367,370,1,0,0,0,368,366,1,0,0,0,368, + 369,1,0,0,0,369,371,1,0,0,0,370,368,1,0,0,0,371,372,3,52,22,0,372, + 373,1,0,0,0,373,374,6,24,7,0,374,57,1,0,0,0,375,401,7,10,0,0,376, + 378,5,47,0,0,377,379,5,47,0,0,378,377,1,0,0,0,379,380,1,0,0,0,380, + 378,1,0,0,0,380,381,1,0,0,0,381,401,1,0,0,0,382,384,5,42,0,0,383, + 385,5,42,0,0,384,383,1,0,0,0,385,386,1,0,0,0,386,384,1,0,0,0,386, + 387,1,0,0,0,387,401,1,0,0,0,388,390,5,61,0,0,389,391,5,61,0,0,390, + 389,1,0,0,0,391,392,1,0,0,0,392,390,1,0,0,0,392,393,1,0,0,0,393, + 401,1,0,0,0,394,395,5,82,0,0,395,396,5,69,0,0,396,397,5,77,0,0,397, + 398,5,65,0,0,398,399,5,82,0,0,399,401,5,75,0,0,400,375,1,0,0,0,400, + 376,1,0,0,0,400,382,1,0,0,0,400,388,1,0,0,0,400,394,1,0,0,0,401, + 405,1,0,0,0,402,404,8,5,0,0,403,402,1,0,0,0,404,407,1,0,0,0,405, + 403,1,0,0,0,405,406,1,0,0,0,406,408,1,0,0,0,407,405,1,0,0,0,408, + 409,3,52,22,0,409,410,1,0,0,0,410,411,6,25,7,0,411,59,1,0,0,0,412, + 414,7,1,0,0,413,412,1,0,0,0,413,414,1,0,0,0,414,415,1,0,0,0,415, + 416,3,30,11,0,416,61,1,0,0,0,417,419,7,9,0,0,418,417,1,0,0,0,419, + 420,1,0,0,0,420,418,1,0,0,0,420,421,1,0,0,0,421,422,1,0,0,0,422, + 423,6,27,8,0,423,63,1,0,0,0,424,426,7,5,0,0,425,424,1,0,0,0,426, + 427,1,0,0,0,427,425,1,0,0,0,427,428,1,0,0,0,428,429,1,0,0,0,429, + 430,6,28,9,0,430,65,1,0,0,0,431,432,3,48,20,0,432,67,1,0,0,0,433, + 435,7,9,0,0,434,433,1,0,0,0,435,436,1,0,0,0,436,434,1,0,0,0,436, + 437,1,0,0,0,437,438,1,0,0,0,438,439,6,30,8,0,439,69,1,0,0,0,440, + 442,7,5,0,0,441,440,1,0,0,0,442,443,1,0,0,0,443,441,1,0,0,0,443, + 444,1,0,0,0,444,445,1,0,0,0,445,446,6,31,9,0,446,71,1,0,0,0,447, + 449,7,1,0,0,448,447,1,0,0,0,448,449,1,0,0,0,449,450,1,0,0,0,450, + 451,3,30,11,0,451,73,1,0,0,0,452,453,3,48,20,0,453,75,1,0,0,0,454, + 456,7,9,0,0,455,454,1,0,0,0,456,457,1,0,0,0,457,455,1,0,0,0,457, + 458,1,0,0,0,458,459,1,0,0,0,459,460,6,34,8,0,460,77,1,0,0,0,461, + 463,7,5,0,0,462,461,1,0,0,0,463,464,1,0,0,0,464,462,1,0,0,0,464, + 465,1,0,0,0,465,466,1,0,0,0,466,467,6,35,9,0,467,79,1,0,0,0,468, + 469,3,48,20,0,469,81,1,0,0,0,470,472,7,9,0,0,471,470,1,0,0,0,472, + 473,1,0,0,0,473,471,1,0,0,0,473,474,1,0,0,0,474,475,1,0,0,0,475, + 476,6,37,8,0,476,83,1,0,0,0,477,479,7,5,0,0,478,477,1,0,0,0,479, + 480,1,0,0,0,480,478,1,0,0,0,480,481,1,0,0,0,481,482,1,0,0,0,482, + 483,6,38,9,0,483,85,1,0,0,0,484,485,3,48,20,0,485,87,1,0,0,0,486, + 488,7,9,0,0,487,486,1,0,0,0,488,489,1,0,0,0,489,487,1,0,0,0,489, + 490,1,0,0,0,490,491,1,0,0,0,491,492,6,40,8,0,492,89,1,0,0,0,493, + 495,7,5,0,0,494,493,1,0,0,0,495,496,1,0,0,0,496,494,1,0,0,0,496, + 497,1,0,0,0,497,498,1,0,0,0,498,499,6,41,9,0,499,91,1,0,0,0,500, + 501,3,22,7,0,501,93,1,0,0,0,502,504,7,9,0,0,503,502,1,0,0,0,504, + 505,1,0,0,0,505,503,1,0,0,0,505,506,1,0,0,0,506,507,1,0,0,0,507, + 508,6,43,8,0,508,95,1,0,0,0,509,511,7,5,0,0,510,509,1,0,0,0,511, + 512,1,0,0,0,512,510,1,0,0,0,512,513,1,0,0,0,513,514,1,0,0,0,514, + 515,6,44,9,0,515,97,1,0,0,0,516,518,8,11,0,0,517,516,1,0,0,0,518, + 519,1,0,0,0,519,517,1,0,0,0,519,520,1,0,0,0,520,99,1,0,0,0,521,523, + 7,9,0,0,522,521,1,0,0,0,523,524,1,0,0,0,524,522,1,0,0,0,524,525, + 1,0,0,0,525,526,1,0,0,0,526,527,6,46,8,0,527,101,1,0,0,0,528,530, + 7,5,0,0,529,528,1,0,0,0,530,531,1,0,0,0,531,529,1,0,0,0,531,532, + 1,0,0,0,532,533,1,0,0,0,533,534,6,47,10,0,534,103,1,0,0,0,62,0,1, + 2,3,4,5,6,7,108,194,199,203,206,210,214,217,225,232,237,244,249, + 255,261,269,274,280,286,297,301,305,311,317,324,329,331,343,349, + 355,363,368,380,386,392,400,405,413,420,427,436,443,448,457,464, + 473,480,489,496,505,512,519,524,531,11,5,1,0,5,2,0,5,3,0,5,4,0,5, + 5,0,5,6,0,2,7,0,0,1,0,6,0,0,4,0,0,2,0,0 ] class XeasyPKLexer(Lexer): @@ -212,6 +226,7 @@ class XeasyPKLexer(Lexer): CYANA_FORMAT_MODE = 4 SPECTRUM_MODE = 5 TOLERANCE_MODE = 6 + COMMENT_MODE = 7 Num_of_dim = 1 Format = 2 @@ -222,61 +237,69 @@ class XeasyPKLexer(Lexer): Integer = 7 Float = 8 Real = 9 - EXCLM_COMMENT = 10 - SMCLN_COMMENT = 11 - Simple_name = 12 - SPACE = 13 - RETURN = 14 - ENCLOSE_COMMENT = 15 - SECTION_COMMENT = 16 - LINE_COMMENT = 17 - Integer_ND = 18 - SPACE_ND = 19 - RETURN_ND = 20 - Simple_name_FO = 21 - SPACE_FO = 22 - RETURN_FO = 23 - Integer_IN = 24 - Simple_name_IN = 25 - SPACE_IN = 26 - RETURN_IN = 27 - Simple_name_CY = 28 - SPACE_CY = 29 - RETURN_CY = 30 - Simple_name_SP = 31 - SPACE_SP = 32 - RETURN_SP = 33 - Float_TO = 34 - TOACE_TO = 35 - RETURN_TO = 36 + COMMENT = 10 + EXCLM_COMMENT = 11 + SMCLN_COMMENT = 12 + Simple_name = 13 + SPACE = 14 + RETURN = 15 + ENCLOSE_COMMENT = 16 + SECTION_COMMENT = 17 + LINE_COMMENT = 18 + Integer_ND = 19 + SPACE_ND = 20 + RETURN_ND = 21 + Simple_name_FO = 22 + SPACE_FO = 23 + RETURN_FO = 24 + Integer_IN = 25 + Simple_name_IN = 26 + SPACE_IN = 27 + RETURN_IN = 28 + Simple_name_CY = 29 + SPACE_CY = 30 + RETURN_CY = 31 + Simple_name_SP = 32 + SPACE_SP = 33 + RETURN_SP = 34 + Float_TO = 35 + TOACE_TO = 36 + RETURN_TO = 37 + Any_name = 38 + SPACE_CM = 39 + RETURN_CM = 40 channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] modeNames = [ "DEFAULT_MODE", "NUM_OF_DIM_MODE", "FORMAT_MODE", "INAME_MODE", - "CYANA_FORMAT_MODE", "SPECTRUM_MODE", "TOLERANCE_MODE" ] + "CYANA_FORMAT_MODE", "SPECTRUM_MODE", "TOLERANCE_MODE", + "COMMENT_MODE" ] literalNames = [ "", "'#FORMAT'", "'#INAME'", "'#CYANAFORMAT'", "'#SPECTRUM'", "'#TOLERANCE'" ] symbolicNames = [ "", "Num_of_dim", "Format", "Iname", "Cyana_format", "Spectrum", - "Tolerance", "Integer", "Float", "Real", "EXCLM_COMMENT", "SMCLN_COMMENT", - "Simple_name", "SPACE", "RETURN", "ENCLOSE_COMMENT", "SECTION_COMMENT", - "LINE_COMMENT", "Integer_ND", "SPACE_ND", "RETURN_ND", "Simple_name_FO", - "SPACE_FO", "RETURN_FO", "Integer_IN", "Simple_name_IN", "SPACE_IN", - "RETURN_IN", "Simple_name_CY", "SPACE_CY", "RETURN_CY", "Simple_name_SP", - "SPACE_SP", "RETURN_SP", "Float_TO", "TOACE_TO", "RETURN_TO" ] + "Tolerance", "Integer", "Float", "Real", "COMMENT", "EXCLM_COMMENT", + "SMCLN_COMMENT", "Simple_name", "SPACE", "RETURN", "ENCLOSE_COMMENT", + "SECTION_COMMENT", "LINE_COMMENT", "Integer_ND", "SPACE_ND", + "RETURN_ND", "Simple_name_FO", "SPACE_FO", "RETURN_FO", "Integer_IN", + "Simple_name_IN", "SPACE_IN", "RETURN_IN", "Simple_name_CY", + "SPACE_CY", "RETURN_CY", "Simple_name_SP", "SPACE_SP", "RETURN_SP", + "Float_TO", "TOACE_TO", "RETURN_TO", "Any_name", "SPACE_CM", + "RETURN_CM" ] ruleNames = [ "Num_of_dim", "Format", "Iname", "Cyana_format", "Spectrum", "Tolerance", "Integer", "Float", "Real", "DEC_DOT_DEC", - "DEC_DIGIT", "DECIMAL", "EXCLM_COMMENT", "SMCLN_COMMENT", + "DEC_DIGIT", "DECIMAL", "COMMENT", "EXCLM_COMMENT", "SMCLN_COMMENT", "Simple_name", "ALPHA", "ALPHA_NUM", "START_CHAR", "NAME_CHAR", "SIMPLE_NAME", "SPACE", "RETURN", "ENCLOSE_COMMENT", "SECTION_COMMENT", "LINE_COMMENT", "Integer_ND", "SPACE_ND", "RETURN_ND", "Simple_name_FO", "SPACE_FO", "RETURN_FO", "Integer_IN", "Simple_name_IN", "SPACE_IN", "RETURN_IN", "Simple_name_CY", "SPACE_CY", "RETURN_CY", "Simple_name_SP", "SPACE_SP", - "RETURN_SP", "Float_TO", "TOACE_TO", "RETURN_TO" ] + "RETURN_SP", "Float_TO", "TOACE_TO", "RETURN_TO", "Any_name", + "SPACE_CM", "RETURN_CM" ] grammarFileName = "XeasyPKLexer.g4" diff --git a/wwpdb/utils/nmr/pk/XeasyPKParser.py b/wwpdb/utils/nmr/pk/XeasyPKParser.py index 5b8dedf8..96989f4e 100644 --- a/wwpdb/utils/nmr/pk/XeasyPKParser.py +++ b/wwpdb/utils/nmr/pk/XeasyPKParser.py @@ -10,64 +10,85 @@ def serializedATN(): return [ - 4,1,36,176,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 4,1,40,223,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, - 2,14,7,14,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,5,0,40,8,0,10,0,12, - 0,43,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3, - 1,3,1,4,1,4,1,4,1,4,1,5,1,5,4,5,66,8,5,11,5,12,5,67,1,5,1,5,1,6, - 1,6,4,6,74,8,6,11,6,12,6,75,1,6,1,6,1,7,4,7,81,8,7,11,7,12,7,82, - 1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, - 5,8,101,8,8,10,8,12,8,104,9,8,1,9,4,9,107,8,9,11,9,12,9,108,1,10, - 1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10, - 1,10,1,10,1,10,1,10,1,10,5,10,130,8,10,10,10,12,10,133,9,10,1,11, - 4,11,136,8,11,11,11,12,11,137,1,12,1,12,1,12,1,12,1,12,1,12,1,12, + 2,14,7,14,2,15,7,15,1,0,3,0,34,8,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, + 0,1,0,5,0,45,8,0,10,0,12,0,48,9,0,1,0,1,0,1,1,1,1,1,1,1,1,1,2,1, + 2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,4,1,4,1,4,1,4,1,5,1,5,4,5,71,8,5, + 11,5,12,5,72,1,5,1,5,1,6,1,6,4,6,79,8,6,11,6,12,6,80,1,6,1,6,1,7, + 4,7,86,8,7,11,7,12,7,87,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8, + 1,8,1,8,3,8,102,8,8,1,8,1,8,3,8,106,8,8,1,8,1,8,1,8,3,8,111,8,8, + 1,8,1,8,3,8,115,8,8,5,8,117,8,8,10,8,12,8,120,9,8,1,9,4,9,123,8, + 9,11,9,12,9,124,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10, + 1,10,1,10,1,10,1,10,3,10,141,8,10,1,10,1,10,3,10,145,8,10,1,10,1, + 10,1,10,1,10,3,10,151,8,10,1,10,1,10,3,10,155,8,10,5,10,157,8,10, + 10,10,12,10,160,9,10,1,11,4,11,163,8,11,11,11,12,11,164,1,12,1,12, 1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12, - 1,12,1,12,5,12,162,8,12,10,12,12,12,165,9,12,1,13,1,13,1,14,1,14, - 1,14,3,14,172,8,14,3,14,174,8,14,1,14,0,0,15,0,2,4,6,8,10,12,14, - 16,18,20,22,24,26,28,0,1,2,0,7,9,12,12,179,0,41,1,0,0,0,2,46,1,0, - 0,0,4,50,1,0,0,0,6,54,1,0,0,0,8,59,1,0,0,0,10,63,1,0,0,0,12,71,1, - 0,0,0,14,80,1,0,0,0,16,84,1,0,0,0,18,106,1,0,0,0,20,110,1,0,0,0, - 22,135,1,0,0,0,24,139,1,0,0,0,26,166,1,0,0,0,28,173,1,0,0,0,30,40, - 3,2,1,0,31,40,3,4,2,0,32,40,3,6,3,0,33,40,3,8,4,0,34,40,3,10,5,0, - 35,40,3,12,6,0,36,40,3,14,7,0,37,40,3,18,9,0,38,40,3,22,11,0,39, - 30,1,0,0,0,39,31,1,0,0,0,39,32,1,0,0,0,39,33,1,0,0,0,39,34,1,0,0, - 0,39,35,1,0,0,0,39,36,1,0,0,0,39,37,1,0,0,0,39,38,1,0,0,0,40,43, - 1,0,0,0,41,39,1,0,0,0,41,42,1,0,0,0,42,44,1,0,0,0,43,41,1,0,0,0, - 44,45,5,0,0,1,45,1,1,0,0,0,46,47,5,1,0,0,47,48,5,18,0,0,48,49,5, - 20,0,0,49,3,1,0,0,0,50,51,5,2,0,0,51,52,5,21,0,0,52,53,5,23,0,0, - 53,5,1,0,0,0,54,55,5,3,0,0,55,56,5,24,0,0,56,57,5,25,0,0,57,58,5, - 27,0,0,58,7,1,0,0,0,59,60,5,4,0,0,60,61,5,28,0,0,61,62,5,30,0,0, - 62,9,1,0,0,0,63,65,5,5,0,0,64,66,5,31,0,0,65,64,1,0,0,0,66,67,1, - 0,0,0,67,65,1,0,0,0,67,68,1,0,0,0,68,69,1,0,0,0,69,70,5,33,0,0,70, - 11,1,0,0,0,71,73,5,6,0,0,72,74,5,34,0,0,73,72,1,0,0,0,74,75,1,0, - 0,0,75,73,1,0,0,0,75,76,1,0,0,0,76,77,1,0,0,0,77,78,5,36,0,0,78, - 13,1,0,0,0,79,81,3,16,8,0,80,79,1,0,0,0,81,82,1,0,0,0,82,80,1,0, - 0,0,82,83,1,0,0,0,83,15,1,0,0,0,84,85,5,7,0,0,85,86,5,8,0,0,86,87, - 5,8,0,0,87,88,5,7,0,0,88,89,5,12,0,0,89,90,3,26,13,0,90,91,3,26, - 13,0,91,92,5,12,0,0,92,93,5,7,0,0,93,94,3,28,14,0,94,95,3,28,14, - 0,95,102,5,14,0,0,96,97,3,28,14,0,97,98,3,28,14,0,98,99,5,14,0,0, - 99,101,1,0,0,0,100,96,1,0,0,0,101,104,1,0,0,0,102,100,1,0,0,0,102, - 103,1,0,0,0,103,17,1,0,0,0,104,102,1,0,0,0,105,107,3,20,10,0,106, - 105,1,0,0,0,107,108,1,0,0,0,108,106,1,0,0,0,108,109,1,0,0,0,109, - 19,1,0,0,0,110,111,5,7,0,0,111,112,5,8,0,0,112,113,5,8,0,0,113,114, - 5,8,0,0,114,115,5,7,0,0,115,116,5,12,0,0,116,117,3,26,13,0,117,118, - 3,26,13,0,118,119,5,12,0,0,119,120,5,7,0,0,120,121,3,28,14,0,121, - 122,3,28,14,0,122,123,3,28,14,0,123,131,5,14,0,0,124,125,3,28,14, - 0,125,126,3,28,14,0,126,127,3,28,14,0,127,128,5,14,0,0,128,130,1, - 0,0,0,129,124,1,0,0,0,130,133,1,0,0,0,131,129,1,0,0,0,131,132,1, - 0,0,0,132,21,1,0,0,0,133,131,1,0,0,0,134,136,3,24,12,0,135,134,1, - 0,0,0,136,137,1,0,0,0,137,135,1,0,0,0,137,138,1,0,0,0,138,23,1,0, - 0,0,139,140,5,7,0,0,140,141,5,8,0,0,141,142,5,8,0,0,142,143,5,8, - 0,0,143,144,5,8,0,0,144,145,5,7,0,0,145,146,5,12,0,0,146,147,3,26, - 13,0,147,148,3,26,13,0,148,149,5,12,0,0,149,150,5,7,0,0,150,151, - 3,28,14,0,151,152,3,28,14,0,152,153,3,28,14,0,153,154,3,28,14,0, - 154,163,5,14,0,0,155,156,3,28,14,0,156,157,3,28,14,0,157,158,3,28, - 14,0,158,159,3,28,14,0,159,160,5,14,0,0,160,162,1,0,0,0,161,155, - 1,0,0,0,162,165,1,0,0,0,163,161,1,0,0,0,163,164,1,0,0,0,164,25,1, - 0,0,0,165,163,1,0,0,0,166,167,7,0,0,0,167,27,1,0,0,0,168,174,5,7, - 0,0,169,171,5,12,0,0,170,172,5,7,0,0,171,170,1,0,0,0,171,172,1,0, - 0,0,172,174,1,0,0,0,173,168,1,0,0,0,173,169,1,0,0,0,174,29,1,0,0, - 0,12,39,41,67,75,82,102,108,131,137,163,171,173 + 1,12,3,12,183,8,12,1,12,1,12,3,12,187,8,12,1,12,1,12,1,12,1,12,1, + 12,3,12,194,8,12,1,12,1,12,3,12,198,8,12,5,12,200,8,12,10,12,12, + 12,203,9,12,1,13,1,13,1,14,1,14,1,14,3,14,210,8,14,3,14,212,8,14, + 1,15,1,15,5,15,216,8,15,10,15,12,15,219,9,15,1,15,1,15,1,15,0,0, + 16,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,0,2,2,0,7,9,13,13, + 1,1,40,40,239,0,33,1,0,0,0,2,51,1,0,0,0,4,55,1,0,0,0,6,59,1,0,0, + 0,8,64,1,0,0,0,10,68,1,0,0,0,12,76,1,0,0,0,14,85,1,0,0,0,16,89,1, + 0,0,0,18,122,1,0,0,0,20,126,1,0,0,0,22,162,1,0,0,0,24,166,1,0,0, + 0,26,204,1,0,0,0,28,211,1,0,0,0,30,213,1,0,0,0,32,34,5,15,0,0,33, + 32,1,0,0,0,33,34,1,0,0,0,34,46,1,0,0,0,35,45,3,2,1,0,36,45,3,4,2, + 0,37,45,3,6,3,0,38,45,3,8,4,0,39,45,3,10,5,0,40,45,3,12,6,0,41,45, + 3,14,7,0,42,45,3,18,9,0,43,45,3,22,11,0,44,35,1,0,0,0,44,36,1,0, + 0,0,44,37,1,0,0,0,44,38,1,0,0,0,44,39,1,0,0,0,44,40,1,0,0,0,44,41, + 1,0,0,0,44,42,1,0,0,0,44,43,1,0,0,0,45,48,1,0,0,0,46,44,1,0,0,0, + 46,47,1,0,0,0,47,49,1,0,0,0,48,46,1,0,0,0,49,50,5,0,0,1,50,1,1,0, + 0,0,51,52,5,1,0,0,52,53,5,19,0,0,53,54,5,21,0,0,54,3,1,0,0,0,55, + 56,5,2,0,0,56,57,5,22,0,0,57,58,5,24,0,0,58,5,1,0,0,0,59,60,5,3, + 0,0,60,61,5,25,0,0,61,62,5,26,0,0,62,63,5,28,0,0,63,7,1,0,0,0,64, + 65,5,4,0,0,65,66,5,29,0,0,66,67,5,31,0,0,67,9,1,0,0,0,68,70,5,5, + 0,0,69,71,5,32,0,0,70,69,1,0,0,0,71,72,1,0,0,0,72,70,1,0,0,0,72, + 73,1,0,0,0,73,74,1,0,0,0,74,75,5,34,0,0,75,11,1,0,0,0,76,78,5,6, + 0,0,77,79,5,35,0,0,78,77,1,0,0,0,79,80,1,0,0,0,80,78,1,0,0,0,80, + 81,1,0,0,0,81,82,1,0,0,0,82,83,5,37,0,0,83,13,1,0,0,0,84,86,3,16, + 8,0,85,84,1,0,0,0,86,87,1,0,0,0,87,85,1,0,0,0,87,88,1,0,0,0,88,15, + 1,0,0,0,89,90,5,7,0,0,90,91,5,8,0,0,91,92,5,8,0,0,92,93,5,7,0,0, + 93,94,5,13,0,0,94,95,3,26,13,0,95,96,3,26,13,0,96,97,5,13,0,0,97, + 98,5,7,0,0,98,99,3,28,14,0,99,101,3,28,14,0,100,102,5,7,0,0,101, + 100,1,0,0,0,101,102,1,0,0,0,102,105,1,0,0,0,103,106,5,15,0,0,104, + 106,3,30,15,0,105,103,1,0,0,0,105,104,1,0,0,0,106,118,1,0,0,0,107, + 108,3,28,14,0,108,110,3,28,14,0,109,111,5,7,0,0,110,109,1,0,0,0, + 110,111,1,0,0,0,111,114,1,0,0,0,112,115,5,15,0,0,113,115,3,30,15, + 0,114,112,1,0,0,0,114,113,1,0,0,0,115,117,1,0,0,0,116,107,1,0,0, + 0,117,120,1,0,0,0,118,116,1,0,0,0,118,119,1,0,0,0,119,17,1,0,0,0, + 120,118,1,0,0,0,121,123,3,20,10,0,122,121,1,0,0,0,123,124,1,0,0, + 0,124,122,1,0,0,0,124,125,1,0,0,0,125,19,1,0,0,0,126,127,5,7,0,0, + 127,128,5,8,0,0,128,129,5,8,0,0,129,130,5,8,0,0,130,131,5,7,0,0, + 131,132,5,13,0,0,132,133,3,26,13,0,133,134,3,26,13,0,134,135,5,13, + 0,0,135,136,5,7,0,0,136,137,3,28,14,0,137,138,3,28,14,0,138,140, + 3,28,14,0,139,141,5,7,0,0,140,139,1,0,0,0,140,141,1,0,0,0,141,144, + 1,0,0,0,142,145,5,15,0,0,143,145,3,30,15,0,144,142,1,0,0,0,144,143, + 1,0,0,0,145,158,1,0,0,0,146,147,3,28,14,0,147,148,3,28,14,0,148, + 150,3,28,14,0,149,151,5,7,0,0,150,149,1,0,0,0,150,151,1,0,0,0,151, + 154,1,0,0,0,152,155,5,15,0,0,153,155,3,30,15,0,154,152,1,0,0,0,154, + 153,1,0,0,0,155,157,1,0,0,0,156,146,1,0,0,0,157,160,1,0,0,0,158, + 156,1,0,0,0,158,159,1,0,0,0,159,21,1,0,0,0,160,158,1,0,0,0,161,163, + 3,24,12,0,162,161,1,0,0,0,163,164,1,0,0,0,164,162,1,0,0,0,164,165, + 1,0,0,0,165,23,1,0,0,0,166,167,5,7,0,0,167,168,5,8,0,0,168,169,5, + 8,0,0,169,170,5,8,0,0,170,171,5,8,0,0,171,172,5,7,0,0,172,173,5, + 13,0,0,173,174,3,26,13,0,174,175,3,26,13,0,175,176,5,13,0,0,176, + 177,5,7,0,0,177,178,3,28,14,0,178,179,3,28,14,0,179,180,3,28,14, + 0,180,182,3,28,14,0,181,183,5,7,0,0,182,181,1,0,0,0,182,183,1,0, + 0,0,183,186,1,0,0,0,184,187,5,15,0,0,185,187,3,30,15,0,186,184,1, + 0,0,0,186,185,1,0,0,0,187,201,1,0,0,0,188,189,3,28,14,0,189,190, + 3,28,14,0,190,191,3,28,14,0,191,193,3,28,14,0,192,194,5,7,0,0,193, + 192,1,0,0,0,193,194,1,0,0,0,194,197,1,0,0,0,195,198,5,15,0,0,196, + 198,3,30,15,0,197,195,1,0,0,0,197,196,1,0,0,0,198,200,1,0,0,0,199, + 188,1,0,0,0,200,203,1,0,0,0,201,199,1,0,0,0,201,202,1,0,0,0,202, + 25,1,0,0,0,203,201,1,0,0,0,204,205,7,0,0,0,205,27,1,0,0,0,206,212, + 5,7,0,0,207,209,5,13,0,0,208,210,5,7,0,0,209,208,1,0,0,0,209,210, + 1,0,0,0,210,212,1,0,0,0,211,206,1,0,0,0,211,207,1,0,0,0,212,29,1, + 0,0,0,213,217,5,10,0,0,214,216,5,38,0,0,215,214,1,0,0,0,216,219, + 1,0,0,0,217,215,1,0,0,0,217,218,1,0,0,0,218,220,1,0,0,0,219,217, + 1,0,0,0,220,221,7,1,0,0,221,31,1,0,0,0,26,33,44,46,72,80,87,101, + 105,110,114,118,124,140,144,150,154,158,164,182,186,193,197,201, + 209,211,217 ] class XeasyPKParser ( Parser ): @@ -85,13 +106,14 @@ class XeasyPKParser ( Parser ): symbolicNames = [ "", "Num_of_dim", "Format", "Iname", "Cyana_format", "Spectrum", "Tolerance", "Integer", "Float", "Real", - "EXCLM_COMMENT", "SMCLN_COMMENT", "Simple_name", "SPACE", - "RETURN", "ENCLOSE_COMMENT", "SECTION_COMMENT", "LINE_COMMENT", - "Integer_ND", "SPACE_ND", "RETURN_ND", "Simple_name_FO", - "SPACE_FO", "RETURN_FO", "Integer_IN", "Simple_name_IN", - "SPACE_IN", "RETURN_IN", "Simple_name_CY", "SPACE_CY", - "RETURN_CY", "Simple_name_SP", "SPACE_SP", "RETURN_SP", - "Float_TO", "TOACE_TO", "RETURN_TO" ] + "COMMENT", "EXCLM_COMMENT", "SMCLN_COMMENT", "Simple_name", + "SPACE", "RETURN", "ENCLOSE_COMMENT", "SECTION_COMMENT", + "LINE_COMMENT", "Integer_ND", "SPACE_ND", "RETURN_ND", + "Simple_name_FO", "SPACE_FO", "RETURN_FO", "Integer_IN", + "Simple_name_IN", "SPACE_IN", "RETURN_IN", "Simple_name_CY", + "SPACE_CY", "RETURN_CY", "Simple_name_SP", "SPACE_SP", + "RETURN_SP", "Float_TO", "TOACE_TO", "RETURN_TO", + "Any_name", "SPACE_CM", "RETURN_CM" ] RULE_xeasy_pk = 0 RULE_dimension = 1 @@ -108,10 +130,12 @@ class XeasyPKParser ( Parser ): RULE_peak_4d = 12 RULE_number = 13 RULE_assign = 14 + RULE_comment = 15 ruleNames = [ "xeasy_pk", "dimension", "format", "iname", "cyana_format", "spectrum", "tolerance", "peak_list_2d", "peak_2d", "peak_list_3d", - "peak_3d", "peak_list_4d", "peak_4d", "number", "assign" ] + "peak_3d", "peak_list_4d", "peak_4d", "number", "assign", + "comment" ] EOF = Token.EOF Num_of_dim=1 @@ -123,33 +147,37 @@ class XeasyPKParser ( Parser ): Integer=7 Float=8 Real=9 - EXCLM_COMMENT=10 - SMCLN_COMMENT=11 - Simple_name=12 - SPACE=13 - RETURN=14 - ENCLOSE_COMMENT=15 - SECTION_COMMENT=16 - LINE_COMMENT=17 - Integer_ND=18 - SPACE_ND=19 - RETURN_ND=20 - Simple_name_FO=21 - SPACE_FO=22 - RETURN_FO=23 - Integer_IN=24 - Simple_name_IN=25 - SPACE_IN=26 - RETURN_IN=27 - Simple_name_CY=28 - SPACE_CY=29 - RETURN_CY=30 - Simple_name_SP=31 - SPACE_SP=32 - RETURN_SP=33 - Float_TO=34 - TOACE_TO=35 - RETURN_TO=36 + COMMENT=10 + EXCLM_COMMENT=11 + SMCLN_COMMENT=12 + Simple_name=13 + SPACE=14 + RETURN=15 + ENCLOSE_COMMENT=16 + SECTION_COMMENT=17 + LINE_COMMENT=18 + Integer_ND=19 + SPACE_ND=20 + RETURN_ND=21 + Simple_name_FO=22 + SPACE_FO=23 + RETURN_FO=24 + Integer_IN=25 + Simple_name_IN=26 + SPACE_IN=27 + RETURN_IN=28 + Simple_name_CY=29 + SPACE_CY=30 + RETURN_CY=31 + Simple_name_SP=32 + SPACE_SP=33 + RETURN_SP=34 + Float_TO=35 + TOACE_TO=36 + RETURN_TO=37 + Any_name=38 + SPACE_CM=39 + RETURN_CM=40 def __init__(self, input:TokenStream, output:TextIO = sys.stdout): super().__init__(input, output) @@ -170,6 +198,9 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): def EOF(self): return self.getToken(XeasyPKParser.EOF, 0) + def RETURN(self): + return self.getToken(XeasyPKParser.RETURN, 0) + def dimension(self, i:int=None): if i is None: return self.getTypedRuleContexts(XeasyPKParser.DimensionContext) @@ -254,64 +285,72 @@ def xeasy_pk(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 41 + self.state = 33 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==15: + self.state = 32 + self.match(XeasyPKParser.RETURN) + + + self.state = 46 self._errHandler.sync(self) _la = self._input.LA(1) while (((_la) & ~0x3f) == 0 and ((1 << _la) & 254) != 0): - self.state = 39 + self.state = 44 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,0,self._ctx) + la_ = self._interp.adaptivePredict(self._input,1,self._ctx) if la_ == 1: - self.state = 30 + self.state = 35 self.dimension() pass elif la_ == 2: - self.state = 31 + self.state = 36 self.format_() pass elif la_ == 3: - self.state = 32 + self.state = 37 self.iname() pass elif la_ == 4: - self.state = 33 + self.state = 38 self.cyana_format() pass elif la_ == 5: - self.state = 34 + self.state = 39 self.spectrum() pass elif la_ == 6: - self.state = 35 + self.state = 40 self.tolerance() pass elif la_ == 7: - self.state = 36 + self.state = 41 self.peak_list_2d() pass elif la_ == 8: - self.state = 37 + self.state = 42 self.peak_list_3d() pass elif la_ == 9: - self.state = 38 + self.state = 43 self.peak_list_4d() pass - self.state = 43 + self.state = 48 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 44 + self.state = 49 self.match(XeasyPKParser.EOF) except RecognitionException as re: localctx.exception = re @@ -358,11 +397,11 @@ def dimension(self): self.enterRule(localctx, 2, self.RULE_dimension) try: self.enterOuterAlt(localctx, 1) - self.state = 46 + self.state = 51 self.match(XeasyPKParser.Num_of_dim) - self.state = 47 + self.state = 52 self.match(XeasyPKParser.Integer_ND) - self.state = 48 + self.state = 53 self.match(XeasyPKParser.RETURN_ND) except RecognitionException as re: localctx.exception = re @@ -409,11 +448,11 @@ def format_(self): self.enterRule(localctx, 4, self.RULE_format) try: self.enterOuterAlt(localctx, 1) - self.state = 50 + self.state = 55 self.match(XeasyPKParser.Format) - self.state = 51 + self.state = 56 self.match(XeasyPKParser.Simple_name_FO) - self.state = 52 + self.state = 57 self.match(XeasyPKParser.RETURN_FO) except RecognitionException as re: localctx.exception = re @@ -463,13 +502,13 @@ def iname(self): self.enterRule(localctx, 6, self.RULE_iname) try: self.enterOuterAlt(localctx, 1) - self.state = 54 + self.state = 59 self.match(XeasyPKParser.Iname) - self.state = 55 + self.state = 60 self.match(XeasyPKParser.Integer_IN) - self.state = 56 + self.state = 61 self.match(XeasyPKParser.Simple_name_IN) - self.state = 57 + self.state = 62 self.match(XeasyPKParser.RETURN_IN) except RecognitionException as re: localctx.exception = re @@ -516,11 +555,11 @@ def cyana_format(self): self.enterRule(localctx, 8, self.RULE_cyana_format) try: self.enterOuterAlt(localctx, 1) - self.state = 59 + self.state = 64 self.match(XeasyPKParser.Cyana_format) - self.state = 60 + self.state = 65 self.match(XeasyPKParser.Simple_name_CY) - self.state = 61 + self.state = 66 self.match(XeasyPKParser.RETURN_CY) except RecognitionException as re: localctx.exception = re @@ -571,21 +610,21 @@ def spectrum(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 63 + self.state = 68 self.match(XeasyPKParser.Spectrum) - self.state = 65 + self.state = 70 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 64 + self.state = 69 self.match(XeasyPKParser.Simple_name_SP) - self.state = 67 + self.state = 72 self._errHandler.sync(self) _la = self._input.LA(1) - if not (_la==31): + if not (_la==32): break - self.state = 69 + self.state = 74 self.match(XeasyPKParser.RETURN_SP) except RecognitionException as re: localctx.exception = re @@ -636,21 +675,21 @@ def tolerance(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 71 + self.state = 76 self.match(XeasyPKParser.Tolerance) - self.state = 73 + self.state = 78 self._errHandler.sync(self) _la = self._input.LA(1) while True: - self.state = 72 + self.state = 77 self.match(XeasyPKParser.Float_TO) - self.state = 75 + self.state = 80 self._errHandler.sync(self) _la = self._input.LA(1) - if not (_la==34): + if not (_la==35): break - self.state = 77 + self.state = 82 self.match(XeasyPKParser.RETURN_TO) except RecognitionException as re: localctx.exception = re @@ -695,19 +734,19 @@ def peak_list_2d(self): self.enterRule(localctx, 14, self.RULE_peak_list_2d) try: self.enterOuterAlt(localctx, 1) - self.state = 80 + self.state = 85 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 79 + self.state = 84 self.peak_2d() else: raise NoViableAltException(self) - self.state = 82 + self.state = 87 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,4,self._ctx) + _alt = self._interp.adaptivePredict(self._input,5,self._ctx) except RecognitionException as re: localctx.exception = re @@ -763,6 +802,13 @@ def RETURN(self, i:int=None): else: return self.getToken(XeasyPKParser.RETURN, i) + def comment(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(XeasyPKParser.CommentContext) + else: + return self.getTypedRuleContext(XeasyPKParser.CommentContext,i) + + def getRuleIndex(self): return XeasyPKParser.RULE_peak_2d @@ -781,46 +827,87 @@ def peak_2d(self): localctx = XeasyPKParser.Peak_2dContext(self, self._ctx, self.state) self.enterRule(localctx, 16, self.RULE_peak_2d) + self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 84 + self.state = 89 self.match(XeasyPKParser.Integer) - self.state = 85 + self.state = 90 self.match(XeasyPKParser.Float) - self.state = 86 + self.state = 91 self.match(XeasyPKParser.Float) - self.state = 87 + self.state = 92 self.match(XeasyPKParser.Integer) - self.state = 88 + self.state = 93 self.match(XeasyPKParser.Simple_name) - self.state = 89 + self.state = 94 self.number() - self.state = 90 + self.state = 95 self.number() - self.state = 91 + self.state = 96 self.match(XeasyPKParser.Simple_name) - self.state = 92 + self.state = 97 self.match(XeasyPKParser.Integer) - self.state = 93 + self.state = 98 self.assign() - self.state = 94 + self.state = 99 self.assign() - self.state = 95 - self.match(XeasyPKParser.RETURN) - self.state = 102 + self.state = 101 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==7: + self.state = 100 + self.match(XeasyPKParser.Integer) + + + self.state = 105 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,5,self._ctx) + token = self._input.LA(1) + if token in [15]: + self.state = 103 + self.match(XeasyPKParser.RETURN) + pass + elif token in [10]: + self.state = 104 + self.comment() + pass + else: + raise NoViableAltException(self) + + self.state = 118 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,10,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 96 + self.state = 107 self.assign() - self.state = 97 + self.state = 108 self.assign() - self.state = 98 - self.match(XeasyPKParser.RETURN) - self.state = 104 + self.state = 110 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==7: + self.state = 109 + self.match(XeasyPKParser.Integer) + + + self.state = 114 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + self.state = 112 + self.match(XeasyPKParser.RETURN) + pass + elif token in [10]: + self.state = 113 + self.comment() + pass + else: + raise NoViableAltException(self) + + self.state = 120 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,5,self._ctx) + _alt = self._interp.adaptivePredict(self._input,10,self._ctx) except RecognitionException as re: localctx.exception = re @@ -865,19 +952,19 @@ def peak_list_3d(self): self.enterRule(localctx, 18, self.RULE_peak_list_3d) try: self.enterOuterAlt(localctx, 1) - self.state = 106 + self.state = 122 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 105 + self.state = 121 self.peak_3d() else: raise NoViableAltException(self) - self.state = 108 + self.state = 124 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,6,self._ctx) + _alt = self._interp.adaptivePredict(self._input,11,self._ctx) except RecognitionException as re: localctx.exception = re @@ -933,6 +1020,13 @@ def RETURN(self, i:int=None): else: return self.getToken(XeasyPKParser.RETURN, i) + def comment(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(XeasyPKParser.CommentContext) + else: + return self.getTypedRuleContext(XeasyPKParser.CommentContext,i) + + def getRuleIndex(self): return XeasyPKParser.RULE_peak_3d @@ -951,52 +1045,93 @@ def peak_3d(self): localctx = XeasyPKParser.Peak_3dContext(self, self._ctx, self.state) self.enterRule(localctx, 20, self.RULE_peak_3d) + self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 110 + self.state = 126 self.match(XeasyPKParser.Integer) - self.state = 111 + self.state = 127 self.match(XeasyPKParser.Float) - self.state = 112 + self.state = 128 self.match(XeasyPKParser.Float) - self.state = 113 + self.state = 129 self.match(XeasyPKParser.Float) - self.state = 114 + self.state = 130 self.match(XeasyPKParser.Integer) - self.state = 115 + self.state = 131 self.match(XeasyPKParser.Simple_name) - self.state = 116 + self.state = 132 self.number() - self.state = 117 + self.state = 133 self.number() - self.state = 118 + self.state = 134 self.match(XeasyPKParser.Simple_name) - self.state = 119 + self.state = 135 self.match(XeasyPKParser.Integer) - self.state = 120 + self.state = 136 self.assign() - self.state = 121 + self.state = 137 self.assign() - self.state = 122 + self.state = 138 self.assign() - self.state = 123 - self.match(XeasyPKParser.RETURN) - self.state = 131 + self.state = 140 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==7: + self.state = 139 + self.match(XeasyPKParser.Integer) + + + self.state = 144 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + self.state = 142 + self.match(XeasyPKParser.RETURN) + pass + elif token in [10]: + self.state = 143 + self.comment() + pass + else: + raise NoViableAltException(self) + + self.state = 158 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,7,self._ctx) + _alt = self._interp.adaptivePredict(self._input,16,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 124 + self.state = 146 self.assign() - self.state = 125 + self.state = 147 self.assign() - self.state = 126 + self.state = 148 self.assign() - self.state = 127 - self.match(XeasyPKParser.RETURN) - self.state = 133 + self.state = 150 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==7: + self.state = 149 + self.match(XeasyPKParser.Integer) + + + self.state = 154 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + self.state = 152 + self.match(XeasyPKParser.RETURN) + pass + elif token in [10]: + self.state = 153 + self.comment() + pass + else: + raise NoViableAltException(self) + + self.state = 160 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,7,self._ctx) + _alt = self._interp.adaptivePredict(self._input,16,self._ctx) except RecognitionException as re: localctx.exception = re @@ -1041,19 +1176,19 @@ def peak_list_4d(self): self.enterRule(localctx, 22, self.RULE_peak_list_4d) try: self.enterOuterAlt(localctx, 1) - self.state = 135 + self.state = 162 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 134 + self.state = 161 self.peak_4d() else: raise NoViableAltException(self) - self.state = 137 + self.state = 164 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,8,self._ctx) + _alt = self._interp.adaptivePredict(self._input,17,self._ctx) except RecognitionException as re: localctx.exception = re @@ -1109,6 +1244,13 @@ def RETURN(self, i:int=None): else: return self.getToken(XeasyPKParser.RETURN, i) + def comment(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(XeasyPKParser.CommentContext) + else: + return self.getTypedRuleContext(XeasyPKParser.CommentContext,i) + + def getRuleIndex(self): return XeasyPKParser.RULE_peak_4d @@ -1127,58 +1269,99 @@ def peak_4d(self): localctx = XeasyPKParser.Peak_4dContext(self, self._ctx, self.state) self.enterRule(localctx, 24, self.RULE_peak_4d) + self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 139 + self.state = 166 self.match(XeasyPKParser.Integer) - self.state = 140 + self.state = 167 self.match(XeasyPKParser.Float) - self.state = 141 + self.state = 168 self.match(XeasyPKParser.Float) - self.state = 142 + self.state = 169 self.match(XeasyPKParser.Float) - self.state = 143 + self.state = 170 self.match(XeasyPKParser.Float) - self.state = 144 + self.state = 171 self.match(XeasyPKParser.Integer) - self.state = 145 + self.state = 172 self.match(XeasyPKParser.Simple_name) - self.state = 146 + self.state = 173 self.number() - self.state = 147 + self.state = 174 self.number() - self.state = 148 + self.state = 175 self.match(XeasyPKParser.Simple_name) - self.state = 149 + self.state = 176 self.match(XeasyPKParser.Integer) - self.state = 150 + self.state = 177 self.assign() - self.state = 151 + self.state = 178 self.assign() - self.state = 152 + self.state = 179 self.assign() - self.state = 153 + self.state = 180 self.assign() - self.state = 154 - self.match(XeasyPKParser.RETURN) - self.state = 163 + self.state = 182 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==7: + self.state = 181 + self.match(XeasyPKParser.Integer) + + + self.state = 186 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + self.state = 184 + self.match(XeasyPKParser.RETURN) + pass + elif token in [10]: + self.state = 185 + self.comment() + pass + else: + raise NoViableAltException(self) + + self.state = 201 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,9,self._ctx) + _alt = self._interp.adaptivePredict(self._input,22,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: - self.state = 155 + self.state = 188 self.assign() - self.state = 156 + self.state = 189 self.assign() - self.state = 157 + self.state = 190 self.assign() - self.state = 158 + self.state = 191 self.assign() - self.state = 159 - self.match(XeasyPKParser.RETURN) - self.state = 165 + self.state = 193 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==7: + self.state = 192 + self.match(XeasyPKParser.Integer) + + + self.state = 197 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + self.state = 195 + self.match(XeasyPKParser.RETURN) + pass + elif token in [10]: + self.state = 196 + self.comment() + pass + else: + raise NoViableAltException(self) + + self.state = 203 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,9,self._ctx) + _alt = self._interp.adaptivePredict(self._input,22,self._ctx) except RecognitionException as re: localctx.exception = re @@ -1229,9 +1412,9 @@ def number(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 166 + self.state = 204 _la = self._input.LA(1) - if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 4992) != 0)): + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 9088) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) @@ -1277,23 +1460,23 @@ def assign(self): localctx = XeasyPKParser.AssignContext(self, self._ctx, self.state) self.enterRule(localctx, 28, self.RULE_assign) try: - self.state = 173 + self.state = 211 self._errHandler.sync(self) token = self._input.LA(1) if token in [7]: self.enterOuterAlt(localctx, 1) - self.state = 168 + self.state = 206 self.match(XeasyPKParser.Integer) pass - elif token in [12]: + elif token in [13]: self.enterOuterAlt(localctx, 2) - self.state = 169 + self.state = 207 self.match(XeasyPKParser.Simple_name) - self.state = 171 + self.state = 209 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,10,self._ctx) + la_ = self._interp.adaptivePredict(self._input,23,self._ctx) if la_ == 1: - self.state = 170 + self.state = 208 self.match(XeasyPKParser.Integer) @@ -1310,6 +1493,77 @@ def assign(self): return localctx + class CommentContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def COMMENT(self): + return self.getToken(XeasyPKParser.COMMENT, 0) + + def RETURN_CM(self): + return self.getToken(XeasyPKParser.RETURN_CM, 0) + + def EOF(self): + return self.getToken(XeasyPKParser.EOF, 0) + + def Any_name(self, i:int=None): + if i is None: + return self.getTokens(XeasyPKParser.Any_name) + else: + return self.getToken(XeasyPKParser.Any_name, i) + + def getRuleIndex(self): + return XeasyPKParser.RULE_comment + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterComment" ): + listener.enterComment(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitComment" ): + listener.exitComment(self) + + + + + def comment(self): + + localctx = XeasyPKParser.CommentContext(self, self._ctx, self.state) + self.enterRule(localctx, 30, self.RULE_comment) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 213 + self.match(XeasyPKParser.COMMENT) + self.state = 217 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==38: + self.state = 214 + self.match(XeasyPKParser.Any_name) + self.state = 219 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 220 + _la = self._input.LA(1) + if not(_la==-1 or _la==40): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + diff --git a/wwpdb/utils/nmr/pk/XeasyPKParserListener.py b/wwpdb/utils/nmr/pk/XeasyPKParserListener.py index 1b28267e..7e4baed3 100644 --- a/wwpdb/utils/nmr/pk/XeasyPKParserListener.py +++ b/wwpdb/utils/nmr/pk/XeasyPKParserListener.py @@ -8,6 +8,7 @@ """ import sys import re +import copy from antlr4 import ParseTreeListener @@ -36,6 +37,7 @@ class XeasyPKParserListener(ParseTreeListener, BasePKParserListener): __index = None __labels = None __atomNumberDict = None + __lastComment = None def __init__(self, verbose=True, log=sys.stdout, representativeModelId=REPRESENTATIVE_MODEL_ID, @@ -157,6 +159,7 @@ def enterPeak_2d(self, ctx: XeasyPKParser.Peak_2dContext): # pylint: disable=un self.peaks2D += 1 self.atomSelectionSet.clear() + self.__lastComment = None # Exit a parse tree produced by XeasyPKParser#peak_2d. def exitPeak_2d(self, ctx: XeasyPKParser.Peak_2dContext): @@ -177,10 +180,11 @@ def exitPeak_2d(self, ctx: XeasyPKParser.Peak_2dContext): # integral_method = str(ctx.Simple_name(1)) type = int(str(ctx.Integer(2))) - x_ass = self.assignmentSelection[0] - y_ass = self.assignmentSelection[1] - if len(self.assignmentSelection) > self.num_of_dim: # ignore multiple assignments for a peak - x_ass = y_ass = None + a1 = self.assignmentSelection[0] + a2 = self.assignmentSelection[1] + + if len(self.assignmentSelection) > self.num_of_dim or ctx.assign(self.num_of_dim): # ignore multiple assignments for a peak + a1 = a2 = None if not self.hasPolySeq and not self.hasNonPolySeq: return @@ -205,15 +209,20 @@ def exitPeak_2d(self, ctx: XeasyPKParser.Peak_2dContext): asis1 = asis2 = None - if x_ass is not None and y_ass is not None: - assignments = [{}] * self.num_of_dim + if a1 is not None and a2 is not None: + + if isinstance(a1, dict) and isinstance(a2, dict): + assignments = [a1, a2] + + else: + assignments = [{}] * self.num_of_dim - assignment0 = self.extractPeakAssignment(1, x_ass, index) - if assignment0 is not None: - assignments[0] = assignment0[0] - assignment1 = self.extractPeakAssignment(1, y_ass, index) - if assignment1 is not None: - assignments[1] = assignment1[0] + assignment0 = self.extractPeakAssignment(1, a1, index) + if assignment0 is not None: + a1 = assignment0[0] + assignment1 = self.extractPeakAssignment(1, a2, index) + if assignment1 is not None: + a2 = assignment1[0] if all(len(a) > 0 for a in assignments): @@ -222,9 +231,6 @@ def exitPeak_2d(self, ctx: XeasyPKParser.Peak_2dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -255,7 +261,7 @@ def exitPeak_2d(self, ctx: XeasyPKParser.Peak_2dContext): if self.debug: print(f"subtype={self.cur_subtype} id={self.peaks2D} (index={index}) " - f"{x_ass}, {y_ass} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} {dstFunc}") + f"{a1}, {a2} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} {dstFunc}") if self.createSfDict__ and sf is not None: sf['id'] = index @@ -279,7 +285,7 @@ def exitPeak_2d(self, ctx: XeasyPKParser.Peak_2dContext): sf['list_id'], self.entryId, dstFunc, self.authToStarSeq, self.authToOrigSeq, self.offsetHolder, atom1, atom2, asis1=asis1, asis2=asis2, - ambig_code1=ambig_code1, ambig_code2=ambig_code2) + ambig_code1=ambig_code1, ambig_code2=ambig_code2, details=self.__lastComment) sf['loop'].add_data(row) finally: @@ -302,6 +308,7 @@ def enterPeak_3d(self, ctx: XeasyPKParser.Peak_3dContext): # pylint: disable=un self.peaks3D += 1 self.atomSelectionSet.clear() + self.__lastComment = None # Exit a parse tree produced by XeasyPKParser#peak_3d. def exitPeak_3d(self, ctx: XeasyPKParser.Peak_3dContext): @@ -323,11 +330,12 @@ def exitPeak_3d(self, ctx: XeasyPKParser.Peak_3dContext): # integral_method = str(ctx.Simple_name(1)) type = int(str(ctx.Integer(2))) - x_ass = self.assignmentSelection[0] - y_ass = self.assignmentSelection[1] - z_ass = self.assignmentSelection[2] - if len(self.assignmentSelection) > self.num_of_dim: # ignore multiple assignments for a peak - x_ass = y_ass = z_ass = None + a1 = self.assignmentSelection[0] + a2 = self.assignmentSelection[1] + a3 = self.assignmentSelection[2] + + if len(self.assignmentSelection) > self.num_of_dim or ctx.assign(self.num_of_dim): # ignore multiple assignments for a peak + a1 = a2 = a3 = None if not self.hasPolySeq and not self.hasNonPolySeq: return @@ -353,18 +361,23 @@ def exitPeak_3d(self, ctx: XeasyPKParser.Peak_3dContext): asis1 = asis2 = asis3 = None - if x_ass is not None and y_ass is not None and z_ass is not None: - assignments = [{}] * self.num_of_dim + if a1 is not None and a2 is not None and a3 is not None: - assignment0 = self.extractPeakAssignment(1, x_ass, index) - if assignment0 is not None: - assignments[0] = assignment0[0] - assignment1 = self.extractPeakAssignment(1, y_ass, index) - if assignment1 is not None: - assignments[1] = assignment1[0] - assignment2 = self.extractPeakAssignment(1, z_ass, index) - if assignment2 is not None: - assignments[2] = assignment2[0] + if isinstance(a1, dict) and isinstance(a2, dict) and isinstance(a3, dict): + assignments = [a1, a2, a3] + + else: + assignments = [{}] * self.num_of_dim + + assignment0 = self.extractPeakAssignment(1, a1, index) + if assignment0 is not None: + a1 = assignment0[0] + assignment1 = self.extractPeakAssignment(1, a2, index) + if assignment1 is not None: + a2 = assignment1[0] + assignment2 = self.extractPeakAssignment(1, a3, index) + if assignment2 is not None: + a3 = assignment2[0] if all(len(a) > 0 for a in assignments): @@ -373,10 +386,6 @@ def exitPeak_3d(self, ctx: XeasyPKParser.Peak_3dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -404,16 +413,16 @@ def exitPeak_3d(self, ctx: XeasyPKParser.Peak_3dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() if self.debug: print(f"subtype={self.cur_subtype} id={self.peaks3D} (index={index}) " - f"{x_ass}, {y_ass}, {z_ass} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " + f"{a1}, {a2}, {a3} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " f"{self.atomSelectionSet[2] if has_assignments else None} {dstFunc}") if self.createSfDict__ and sf is not None: @@ -444,7 +453,7 @@ def exitPeak_3d(self, ctx: XeasyPKParser.Peak_3dContext): self.authToStarSeq, self.authToOrigSeq, self.offsetHolder, atom1, atom2, atom3, asis1=asis1, asis2=asis2, asis3=asis3, ambig_code1=ambig_code1, ambig_code2=ambig_code2, - ambig_code3=ambig_code3) + ambig_code3=ambig_code3, details=self.__lastComment) sf['loop'].add_data(row) finally: @@ -467,6 +476,7 @@ def enterPeak_4d(self, ctx: XeasyPKParser.Peak_4dContext): # pylint: disable=un self.peaks4D += 1 self.atomSelectionSet.clear() + self.__lastComment = None # Exit a parse tree produced by XeasyPKParser#peak_4d. def exitPeak_4d(self, ctx: XeasyPKParser.Peak_4dContext): @@ -489,12 +499,13 @@ def exitPeak_4d(self, ctx: XeasyPKParser.Peak_4dContext): # integral_method = str(ctx.Simple_name(1)) type = int(str(ctx.Integer(2))) - x_ass = self.assignmentSelection[0] - y_ass = self.assignmentSelection[1] - z_ass = self.assignmentSelection[2] - a_ass = self.assignmentSelection[3] - if len(self.assignmentSelection) > self.num_of_dim: # ignore multiple assignments for a peak - x_ass = y_ass = z_ass = a_ass = None + a1 = self.assignmentSelection[0] + a2 = self.assignmentSelection[1] + a3 = self.assignmentSelection[2] + a4 = self.assignmentSelection[3] + + if len(self.assignmentSelection) > self.num_of_dim or ctx.assign(self.num_of_dim): # ignore multiple assignments for a peak + a1 = a2 = a3 = a4 = None if not self.hasPolySeq and not self.hasNonPolySeq: return @@ -521,21 +532,26 @@ def exitPeak_4d(self, ctx: XeasyPKParser.Peak_4dContext): asis1 = asis2 = asis3 = asis4 = None - if x_ass is not None and y_ass is not None and z_ass is not None and a_ass is not None: - assignments = [{}] * self.num_of_dim - - assignment0 = self.extractPeakAssignment(1, x_ass, index) - if assignment0 is not None: - assignments[0] = assignment0[0] - assignment1 = self.extractPeakAssignment(1, y_ass, index) - if assignment1 is not None: - assignments[1] = assignment1[0] - assignment2 = self.extractPeakAssignment(1, z_ass, index) - if assignment2 is not None: - assignments[2] = assignment2[0] - assignment3 = self.extractPeakAssignment(1, a_ass, index) - if assignment3 is not None: - assignments[3] = assignment3[0] + if a1 is not None and a2 is not None and a3 is not None and a4 is not None: + + if isinstance(a1, dict) and isinstance(a2, dict) and isinstance(a3, dict) and isinstance(a4, dict): + assignments = [a1, a2, a3, a4] + + else: + assignments = [{}] * self.num_of_dim + + assignment0 = self.extractPeakAssignment(1, a1, index) + if assignment0 is not None: + a1 = assignment0[0] + assignment1 = self.extractPeakAssignment(1, a2, index) + if assignment1 is not None: + a2 = assignment1[0] + assignment2 = self.extractPeakAssignment(1, a3, index) + if assignment2 is not None: + a3 = assignment2[0] + assignment3 = self.extractPeakAssignment(1, a4, index) + if assignment3 is not None: + a4 = assignment3[0] if all(len(a) > 0 for a in assignments): @@ -544,11 +560,6 @@ def exitPeak_4d(self, ctx: XeasyPKParser.Peak_4dContext): hasChainId = all(a['chain_id'] is not None for a in assignments) hasCompId = all(a['comp_id'] is not None for a in assignments) - a1 = assignments[0] - a2 = assignments[1] - a3 = assignments[2] - a4 = assignments[3] - if hasChainId and hasCompId: chainAssign1, asis1 = self.assignCoordPolymerSequenceWithChainId(a1['chain_id'], a1['seq_id'], a1['comp_id'], a1['atom_id'], index) chainAssign2, asis2 = self.assignCoordPolymerSequenceWithChainId(a2['chain_id'], a2['seq_id'], a2['comp_id'], a2['atom_id'], index) @@ -581,17 +592,17 @@ def exitPeak_4d(self, ctx: XeasyPKParser.Peak_4dContext): if len(self.atomSelectionSet) == self.num_of_dim: has_assignments = True - has_assignments &= self.fillAtomTypeInCase(1, a1['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(2, a2['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(3, a3['atom_id'][0]) - has_assignments &= self.fillAtomTypeInCase(4, a4['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(1, self.atomSelectionSet[0][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(2, self.atomSelectionSet[1][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(3, self.atomSelectionSet[2][0]['atom_id'][0]) + has_assignments &= self.fillAtomTypeInCase(4, self.atomSelectionSet[3][0]['atom_id'][0]) if self.createSfDict__: sf = self.getSf() if self.debug: print(f"subtype={self.cur_subtype} id={self.peaks4D} (index={index}) " - f"{x_ass}, {y_ass}, {z_ass}, {a_ass} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " + f"{a1}, {a2}, {a3}, {a4} -> {self.atomSelectionSet[0] if has_assignments else None} {self.atomSelectionSet[1] if has_assignments else None} " f"{self.atomSelectionSet[2] if has_assignments else None} {self.atomSelectionSet[3] if has_assignments else None} {dstFunc}") if self.createSfDict__ and sf is not None: @@ -627,7 +638,7 @@ def exitPeak_4d(self, ctx: XeasyPKParser.Peak_4dContext): self.authToStarSeq, self.authToOrigSeq, self.offsetHolder, atom1, atom2, atom3, atom4, asis1=asis1, asis2=asis2, asis3=asis3, asis4=asis4, ambig_code1=ambig_code1, ambig_code2=ambig_code2, - ambig_code3=ambig_code3, ambig_code4=ambig_code4) + ambig_code3=ambig_code3, ambig_code4=ambig_code4, details=self.__lastComment) sf['loop'].add_data(row) finally: @@ -675,18 +686,44 @@ def exitAssign(self, ctx: XeasyPKParser.AssignContext): self.assignmentSelection.append(None) else: factor = assignment[0] - self.assignmentSelection.append(f"{factor['chain_id'] if 'chain_id' in factor else ''} " - f"{factor['seq_id'] if 'seq_id' in factor else ''} " - f"{factor['comp_id'] if 'comp_id' in factor else ''} " - f"{factor['atom_id']}") + self.assignmentSelection.append(factor) else: ai = int(str(ctx.Integer())) if ai == 0 or self.__atomNumberDict is None or ai not in self.__atomNumberDict: self.assignmentSelection.append(None) else: - factor = self.__atomNumberDict[ai] - self.assignmentSelection.append(f"{factor['chain_id']} {factor['seq_id']} " - f"{factor['comp_id']} {factor['auth_atom_id']}") + _factor = copy.copy(self.__atomNumberDict[ai]) + _factor['atom_id'] = _factor['auth_atom_id'] + del _factor['auth_atom_id'] + self.assignmentSelection.append(_factor) + + # Enter a parse tree produced by XeasyPKParser#comment. + def enterComment(self, ctx: XeasyPKParser.CommentContext): # pylint: disable=unused-argument + pass + + # Exit a parse tree produced by XeasyPKParser#comment. + def exitComment(self, ctx: XeasyPKParser.CommentContext): + comment = [] + for col in range(20): + if ctx.Any_name(col): + text = str(ctx.Any_name(col)) + if text[0] in ('#', '!'): + break + if text[0] in ('>', '<'): + continue + comment.append(str(ctx.Any_name(col))) + else: + break + self.__lastComment = None if len(comment) == 0 else ' '.join(comment) + assignments = self.extractPeakAssignment(self.num_of_dim, self.__lastComment, + self.__index - 1 if isinstance(self.__index, int) else 1) + if assignments is not None and self.__atomNumberDict is None: + if self.ass_expr_debug: + print(f'{self.__lastComment!r} -> {assignments}') + self.assignmentSelection.clear() + for factor in assignments: + self.assignmentSelection.append(factor) + self.__lastComment = None def fillSpectralDimWithLabels(self): if self.__labels is None or len(self.__labels) == 0: diff --git a/wwpdb/utils/nmr/pk/XeasyPKReader.py b/wwpdb/utils/nmr/pk/XeasyPKReader.py index 07626863..6b6620d9 100644 --- a/wwpdb/utils/nmr/pk/XeasyPKReader.py +++ b/wwpdb/utils/nmr/pk/XeasyPKReader.py @@ -97,7 +97,7 @@ def setParserMaxErrorReport(self, maxErrReport): self.__maxParserErrorReport = maxErrReport def parse(self, pkFilePath, cifFilePath=None, protFilePath=None, isFilePath=True, - createSfDict=False, originalFileName=None, listIdCounter=None, entryId=None): + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): """ Parse XEASY PK file. @return: XeasyPKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. """ @@ -188,6 +188,8 @@ def parse(self, pkFilePath, cifFilePath=None, protFilePath=None, isFilePath=True listener.setOriginaFileName(originalFileName) if listIdCounter is not None: listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) if entryId is not None: listener.setEntryId(entryId) walker.walk(listener, tree) @@ -226,6 +228,11 @@ def parse(self, pkFilePath, cifFilePath=None, protFilePath=None, isFilePath=True if __name__ == "__main__": + reader = XeasyPKReader(True) + reader.setDebugMode(True) + reader.parse('../../tests-nmr/mock-data-remediation/2kj5/2kj5-corrected-div_ext.mr', + '../../tests-nmr/mock-data-remediation/2kj5/2kj5.cif') + reader = XeasyPKReader(True) reader.setDebugMode(True) reader.parse('../../tests-nmr/mock-data-remediation/7a2d/aro.peaks', # -ignored-as-pea-any', diff --git a/wwpdb/utils/nmr/pk/XeasyPROTParser.py b/wwpdb/utils/nmr/pk/XeasyPROTParser.py index 49d2b1c7..ea253c9d 100644 --- a/wwpdb/utils/nmr/pk/XeasyPROTParser.py +++ b/wwpdb/utils/nmr/pk/XeasyPROTParser.py @@ -10,13 +10,14 @@ def serializedATN(): return [ - 4,1,11,23,2,0,7,0,2,1,7,1,2,2,7,2,1,0,4,0,8,8,0,11,0,12,0,9,1,0, - 1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,0,0,3,0,2,4,0,1,2,0, - 1,1,6,6,20,0,7,1,0,0,0,2,13,1,0,0,0,4,20,1,0,0,0,6,8,3,2,1,0,7,6, - 1,0,0,0,8,9,1,0,0,0,9,7,1,0,0,0,9,10,1,0,0,0,10,11,1,0,0,0,11,12, - 5,0,0,1,12,1,1,0,0,0,13,14,5,1,0,0,14,15,5,2,0,0,15,16,5,2,0,0,16, - 17,5,6,0,0,17,18,3,4,2,0,18,19,5,8,0,0,19,3,1,0,0,0,20,21,7,0,0, - 0,21,5,1,0,0,0,1,9 + 4,1,11,26,2,0,7,0,2,1,7,1,2,2,7,2,1,0,3,0,8,8,0,1,0,4,0,11,8,0,11, + 0,12,0,12,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,0,0,3, + 0,2,4,0,1,2,0,1,1,6,6,24,0,7,1,0,0,0,2,16,1,0,0,0,4,23,1,0,0,0,6, + 8,5,8,0,0,7,6,1,0,0,0,7,8,1,0,0,0,8,10,1,0,0,0,9,11,3,2,1,0,10,9, + 1,0,0,0,11,12,1,0,0,0,12,10,1,0,0,0,12,13,1,0,0,0,13,14,1,0,0,0, + 14,15,5,0,0,1,15,1,1,0,0,0,16,17,5,1,0,0,17,18,5,2,0,0,18,19,5,2, + 0,0,19,20,5,6,0,0,20,21,3,4,2,0,21,22,5,8,0,0,22,3,1,0,0,0,23,24, + 7,0,0,0,24,5,1,0,0,0,2,7,12 ] class XeasyPROTParser ( Parser ): @@ -73,6 +74,9 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): def EOF(self): return self.getToken(XeasyPROTParser.EOF, 0) + def RETURN(self): + return self.getToken(XeasyPROTParser.RETURN, 0) + def prot(self, i:int=None): if i is None: return self.getTypedRuleContexts(XeasyPROTParser.ProtContext) @@ -101,19 +105,27 @@ def xeasy_prot(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 7 + self.state = 7 self._errHandler.sync(self) _la = self._input.LA(1) - while True: + if _la==8: self.state = 6 + self.match(XeasyPROTParser.RETURN) + + + self.state = 10 + self._errHandler.sync(self) + _la = self._input.LA(1) + while True: + self.state = 9 self.prot() - self.state = 9 + self.state = 12 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la==1): break - self.state = 11 + self.state = 14 self.match(XeasyPROTParser.EOF) except RecognitionException as re: localctx.exception = re @@ -170,17 +182,17 @@ def prot(self): self.enterRule(localctx, 2, self.RULE_prot) try: self.enterOuterAlt(localctx, 1) - self.state = 13 + self.state = 16 self.match(XeasyPROTParser.Integer) - self.state = 14 + self.state = 17 self.match(XeasyPROTParser.Float) - self.state = 15 + self.state = 18 self.match(XeasyPROTParser.Float) - self.state = 16 + self.state = 19 self.match(XeasyPROTParser.Simple_name) - self.state = 17 + self.state = 20 self.residue() - self.state = 18 + self.state = 21 self.match(XeasyPROTParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -225,7 +237,7 @@ def residue(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 20 + self.state = 23 _la = self._input.LA(1) if not(_la==1 or _la==6): self._errHandler.recoverInline(self) diff --git a/wwpdb/utils/nmr/pk/XwinNmrPKLexer.py b/wwpdb/utils/nmr/pk/XwinNmrPKLexer.py index dc5c6747..287a4755 100644 --- a/wwpdb/utils/nmr/pk/XwinNmrPKLexer.py +++ b/wwpdb/utils/nmr/pk/XwinNmrPKLexer.py @@ -37,14 +37,14 @@ def serializedATN(): 275,8,21,11,21,12,21,276,1,21,1,21,0,0,22,3,1,5,2,7,3,9,0,11,0,13, 0,15,4,17,0,19,0,21,0,23,0,25,5,27,6,29,7,31,8,33,9,35,10,37,11, 39,12,41,13,43,14,45,15,3,0,1,2,10,2,0,43,43,45,45,1,0,48,57,3,0, - 33,33,35,35,42,42,2,0,65,90,97,122,5,0,35,35,42,43,45,46,63,63,95, - 95,2,0,34,34,39,39,2,0,9,9,32,32,2,0,10,10,13,13,2,0,59,59,92,92, - 3,0,9,10,13,13,32,32,315,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,15, - 1,0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33, - 1,0,0,0,1,35,1,0,0,0,1,37,1,0,0,0,1,39,1,0,0,0,2,41,1,0,0,0,2,43, - 1,0,0,0,2,45,1,0,0,0,3,47,1,0,0,0,5,71,1,0,0,0,7,76,1,0,0,0,9,88, - 1,0,0,0,11,90,1,0,0,0,13,93,1,0,0,0,15,98,1,0,0,0,17,104,1,0,0,0, - 19,108,1,0,0,0,21,112,1,0,0,0,23,116,1,0,0,0,25,119,1,0,0,0,27,126, + 33,33,35,35,42,42,2,0,65,90,97,122,4,0,42,43,45,46,63,63,95,95,2, + 0,34,34,39,39,2,0,9,9,32,32,2,0,10,10,13,13,2,0,59,59,92,92,3,0, + 9,10,13,13,32,32,315,0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,15,1, + 0,0,0,0,25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1, + 0,0,0,1,35,1,0,0,0,1,37,1,0,0,0,1,39,1,0,0,0,2,41,1,0,0,0,2,43,1, + 0,0,0,2,45,1,0,0,0,3,47,1,0,0,0,5,71,1,0,0,0,7,76,1,0,0,0,9,88,1, + 0,0,0,11,90,1,0,0,0,13,93,1,0,0,0,15,98,1,0,0,0,17,104,1,0,0,0,19, + 108,1,0,0,0,21,112,1,0,0,0,23,116,1,0,0,0,25,119,1,0,0,0,27,126, 1,0,0,0,29,173,1,0,0,0,31,228,1,0,0,0,33,241,1,0,0,0,35,245,1,0, 0,0,37,248,1,0,0,0,39,255,1,0,0,0,41,262,1,0,0,0,43,267,1,0,0,0, 45,274,1,0,0,0,47,48,5,35,0,0,48,49,5,32,0,0,49,50,5,80,0,0,50,51, diff --git a/wwpdb/utils/nmr/pk/XwinNmrPKParser.py b/wwpdb/utils/nmr/pk/XwinNmrPKParser.py index 251f5013..e6eeac26 100644 --- a/wwpdb/utils/nmr/pk/XwinNmrPKParser.py +++ b/wwpdb/utils/nmr/pk/XwinNmrPKParser.py @@ -10,41 +10,42 @@ def serializedATN(): return [ - 4,1,15,107,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,1,0,1, - 0,1,0,4,0,16,8,0,11,0,12,0,17,1,0,4,0,21,8,0,11,0,12,0,22,1,0,4, - 0,26,8,0,11,0,12,0,27,5,0,30,8,0,10,0,12,0,33,9,0,1,0,1,0,1,1,1, - 1,5,1,39,8,1,10,1,12,1,42,9,1,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1, - 3,1,3,1,3,1,3,1,3,3,3,57,8,3,1,3,5,3,60,8,3,10,3,12,3,63,9,3,1,3, - 1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,3,4,76,8,4,1,4,5,4,79,8, - 4,10,4,12,4,82,9,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1, - 5,1,5,3,5,97,8,5,1,5,5,5,100,8,5,10,5,12,5,103,9,5,1,5,1,5,1,5,0, - 0,6,0,2,4,6,8,10,0,1,1,1,15,15,115,0,31,1,0,0,0,2,36,1,0,0,0,4,45, - 1,0,0,0,6,49,1,0,0,0,8,66,1,0,0,0,10,85,1,0,0,0,12,30,3,2,1,0,13, - 30,3,4,2,0,14,16,3,6,3,0,15,14,1,0,0,0,16,17,1,0,0,0,17,15,1,0,0, - 0,17,18,1,0,0,0,18,30,1,0,0,0,19,21,3,8,4,0,20,19,1,0,0,0,21,22, - 1,0,0,0,22,20,1,0,0,0,22,23,1,0,0,0,23,30,1,0,0,0,24,26,3,10,5,0, - 25,24,1,0,0,0,26,27,1,0,0,0,27,25,1,0,0,0,27,28,1,0,0,0,28,30,1, - 0,0,0,29,12,1,0,0,0,29,13,1,0,0,0,29,15,1,0,0,0,29,20,1,0,0,0,29, - 25,1,0,0,0,30,33,1,0,0,0,31,29,1,0,0,0,31,32,1,0,0,0,32,34,1,0,0, - 0,33,31,1,0,0,0,34,35,5,0,0,1,35,1,1,0,0,0,36,40,5,4,0,0,37,39,5, - 13,0,0,38,37,1,0,0,0,39,42,1,0,0,0,40,38,1,0,0,0,40,41,1,0,0,0,41, - 43,1,0,0,0,42,40,1,0,0,0,43,44,7,0,0,0,44,3,1,0,0,0,45,46,5,1,0, - 0,46,47,5,10,0,0,47,48,5,12,0,0,48,5,1,0,0,0,49,50,5,2,0,0,50,51, - 5,3,0,0,51,52,5,3,0,0,52,53,5,3,0,0,53,54,5,3,0,0,54,56,5,3,0,0, - 55,57,5,3,0,0,56,55,1,0,0,0,56,57,1,0,0,0,57,61,1,0,0,0,58,60,5, - 9,0,0,59,58,1,0,0,0,60,63,1,0,0,0,61,59,1,0,0,0,61,62,1,0,0,0,62, - 64,1,0,0,0,63,61,1,0,0,0,64,65,5,6,0,0,65,7,1,0,0,0,66,67,5,2,0, - 0,67,68,5,3,0,0,68,69,5,3,0,0,69,70,5,3,0,0,70,71,5,3,0,0,71,72, - 5,3,0,0,72,73,5,3,0,0,73,75,5,3,0,0,74,76,5,3,0,0,75,74,1,0,0,0, - 75,76,1,0,0,0,76,80,1,0,0,0,77,79,5,9,0,0,78,77,1,0,0,0,79,82,1, - 0,0,0,80,78,1,0,0,0,80,81,1,0,0,0,81,83,1,0,0,0,82,80,1,0,0,0,83, - 84,5,6,0,0,84,9,1,0,0,0,85,86,5,2,0,0,86,87,5,3,0,0,87,88,5,3,0, - 0,88,89,5,3,0,0,89,90,5,3,0,0,90,91,5,3,0,0,91,92,5,3,0,0,92,93, - 5,3,0,0,93,94,5,3,0,0,94,96,5,3,0,0,95,97,5,3,0,0,96,95,1,0,0,0, - 96,97,1,0,0,0,97,101,1,0,0,0,98,100,5,9,0,0,99,98,1,0,0,0,100,103, - 1,0,0,0,101,99,1,0,0,0,101,102,1,0,0,0,102,104,1,0,0,0,103,101,1, - 0,0,0,104,105,5,6,0,0,105,11,1,0,0,0,12,17,22,27,29,31,40,56,61, - 75,80,96,101 + 4,1,15,110,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,1,0,3, + 0,14,8,0,1,0,1,0,1,0,4,0,19,8,0,11,0,12,0,20,1,0,4,0,24,8,0,11,0, + 12,0,25,1,0,4,0,29,8,0,11,0,12,0,30,5,0,33,8,0,10,0,12,0,36,9,0, + 1,0,1,0,1,1,1,1,5,1,42,8,1,10,1,12,1,45,9,1,1,1,1,1,1,2,1,2,1,2, + 1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,60,8,3,1,3,5,3,63,8,3,10,3,12, + 3,66,9,3,1,3,1,3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,3,4,79,8,4, + 1,4,5,4,82,8,4,10,4,12,4,85,9,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5, + 1,5,1,5,1,5,1,5,1,5,3,5,100,8,5,1,5,5,5,103,8,5,10,5,12,5,106,9, + 5,1,5,1,5,1,5,0,0,6,0,2,4,6,8,10,0,1,1,1,15,15,119,0,13,1,0,0,0, + 2,39,1,0,0,0,4,48,1,0,0,0,6,52,1,0,0,0,8,69,1,0,0,0,10,88,1,0,0, + 0,12,14,5,6,0,0,13,12,1,0,0,0,13,14,1,0,0,0,14,34,1,0,0,0,15,33, + 3,2,1,0,16,33,3,4,2,0,17,19,3,6,3,0,18,17,1,0,0,0,19,20,1,0,0,0, + 20,18,1,0,0,0,20,21,1,0,0,0,21,33,1,0,0,0,22,24,3,8,4,0,23,22,1, + 0,0,0,24,25,1,0,0,0,25,23,1,0,0,0,25,26,1,0,0,0,26,33,1,0,0,0,27, + 29,3,10,5,0,28,27,1,0,0,0,29,30,1,0,0,0,30,28,1,0,0,0,30,31,1,0, + 0,0,31,33,1,0,0,0,32,15,1,0,0,0,32,16,1,0,0,0,32,18,1,0,0,0,32,23, + 1,0,0,0,32,28,1,0,0,0,33,36,1,0,0,0,34,32,1,0,0,0,34,35,1,0,0,0, + 35,37,1,0,0,0,36,34,1,0,0,0,37,38,5,0,0,1,38,1,1,0,0,0,39,43,5,4, + 0,0,40,42,5,13,0,0,41,40,1,0,0,0,42,45,1,0,0,0,43,41,1,0,0,0,43, + 44,1,0,0,0,44,46,1,0,0,0,45,43,1,0,0,0,46,47,7,0,0,0,47,3,1,0,0, + 0,48,49,5,1,0,0,49,50,5,10,0,0,50,51,5,12,0,0,51,5,1,0,0,0,52,53, + 5,2,0,0,53,54,5,3,0,0,54,55,5,3,0,0,55,56,5,3,0,0,56,57,5,3,0,0, + 57,59,5,3,0,0,58,60,5,3,0,0,59,58,1,0,0,0,59,60,1,0,0,0,60,64,1, + 0,0,0,61,63,5,9,0,0,62,61,1,0,0,0,63,66,1,0,0,0,64,62,1,0,0,0,64, + 65,1,0,0,0,65,67,1,0,0,0,66,64,1,0,0,0,67,68,5,6,0,0,68,7,1,0,0, + 0,69,70,5,2,0,0,70,71,5,3,0,0,71,72,5,3,0,0,72,73,5,3,0,0,73,74, + 5,3,0,0,74,75,5,3,0,0,75,76,5,3,0,0,76,78,5,3,0,0,77,79,5,3,0,0, + 78,77,1,0,0,0,78,79,1,0,0,0,79,83,1,0,0,0,80,82,5,9,0,0,81,80,1, + 0,0,0,82,85,1,0,0,0,83,81,1,0,0,0,83,84,1,0,0,0,84,86,1,0,0,0,85, + 83,1,0,0,0,86,87,5,6,0,0,87,9,1,0,0,0,88,89,5,2,0,0,89,90,5,3,0, + 0,90,91,5,3,0,0,91,92,5,3,0,0,92,93,5,3,0,0,93,94,5,3,0,0,94,95, + 5,3,0,0,95,96,5,3,0,0,96,97,5,3,0,0,97,99,5,3,0,0,98,100,5,3,0,0, + 99,98,1,0,0,0,99,100,1,0,0,0,100,104,1,0,0,0,101,103,5,9,0,0,102, + 101,1,0,0,0,103,106,1,0,0,0,104,102,1,0,0,0,104,105,1,0,0,0,105, + 107,1,0,0,0,106,104,1,0,0,0,107,108,5,6,0,0,108,11,1,0,0,0,13,13, + 20,25,30,32,34,43,59,64,78,83,99,104 ] class XwinNmrPKParser ( Parser ): @@ -110,6 +111,9 @@ def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): def EOF(self): return self.getToken(XwinNmrPKParser.EOF, 0) + def RETURN(self): + return self.getToken(XwinNmrPKParser.RETURN, 0) + def comment(self, i:int=None): if i is None: return self.getTypedRuleContexts(XwinNmrPKParser.CommentContext) @@ -166,80 +170,88 @@ def xwinnmr_pk(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 31 + self.state = 13 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==6: + self.state = 12 + self.match(XwinNmrPKParser.RETURN) + + + self.state = 34 self._errHandler.sync(self) _la = self._input.LA(1) while (((_la) & ~0x3f) == 0 and ((1 << _la) & 22) != 0): - self.state = 29 + self.state = 32 self._errHandler.sync(self) - la_ = self._interp.adaptivePredict(self._input,3,self._ctx) + la_ = self._interp.adaptivePredict(self._input,4,self._ctx) if la_ == 1: - self.state = 12 + self.state = 15 self.comment() pass elif la_ == 2: - self.state = 13 + self.state = 16 self.dimension() pass elif la_ == 3: - self.state = 15 + self.state = 18 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 14 + self.state = 17 self.peak_2d() else: raise NoViableAltException(self) - self.state = 17 + self.state = 20 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,0,self._ctx) + _alt = self._interp.adaptivePredict(self._input,1,self._ctx) pass elif la_ == 4: - self.state = 20 + self.state = 23 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 19 + self.state = 22 self.peak_3d() else: raise NoViableAltException(self) - self.state = 22 + self.state = 25 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,1,self._ctx) + _alt = self._interp.adaptivePredict(self._input,2,self._ctx) pass elif la_ == 5: - self.state = 25 + self.state = 28 self._errHandler.sync(self) _alt = 1 while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 24 + self.state = 27 self.peak_4d() else: raise NoViableAltException(self) - self.state = 27 + self.state = 30 self._errHandler.sync(self) - _alt = self._interp.adaptivePredict(self._input,2,self._ctx) + _alt = self._interp.adaptivePredict(self._input,3,self._ctx) pass - self.state = 33 + self.state = 36 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 34 + self.state = 37 self.match(XwinNmrPKParser.EOF) except RecognitionException as re: localctx.exception = re @@ -293,19 +305,19 @@ def comment(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 36 + self.state = 39 self.match(XwinNmrPKParser.COMMENT) - self.state = 40 + self.state = 43 self._errHandler.sync(self) _la = self._input.LA(1) while _la==13: - self.state = 37 + self.state = 40 self.match(XwinNmrPKParser.Any_name) - self.state = 42 + self.state = 45 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 43 + self.state = 46 _la = self._input.LA(1) if not(_la==-1 or _la==15): self._errHandler.recoverInline(self) @@ -357,11 +369,11 @@ def dimension(self): self.enterRule(localctx, 4, self.RULE_dimension) try: self.enterOuterAlt(localctx, 1) - self.state = 45 + self.state = 48 self.match(XwinNmrPKParser.Num_of_dim) - self.state = 46 + self.state = 49 self.match(XwinNmrPKParser.Integer_ND) - self.state = 47 + self.state = 50 self.match(XwinNmrPKParser.RETURN_ND) except RecognitionException as re: localctx.exception = re @@ -418,37 +430,37 @@ def peak_2d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 49 - self.match(XwinNmrPKParser.Integer) - self.state = 50 - self.match(XwinNmrPKParser.Float) - self.state = 51 - self.match(XwinNmrPKParser.Float) self.state = 52 - self.match(XwinNmrPKParser.Float) + self.match(XwinNmrPKParser.Integer) self.state = 53 self.match(XwinNmrPKParser.Float) self.state = 54 self.match(XwinNmrPKParser.Float) + self.state = 55 + self.match(XwinNmrPKParser.Float) self.state = 56 + self.match(XwinNmrPKParser.Float) + self.state = 57 + self.match(XwinNmrPKParser.Float) + self.state = 59 self._errHandler.sync(self) _la = self._input.LA(1) if _la==3: - self.state = 55 + self.state = 58 self.match(XwinNmrPKParser.Float) - self.state = 61 + self.state = 64 self._errHandler.sync(self) _la = self._input.LA(1) while _la==9: - self.state = 58 + self.state = 61 self.match(XwinNmrPKParser.Annotation) - self.state = 63 + self.state = 66 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 64 + self.state = 67 self.match(XwinNmrPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -505,14 +517,8 @@ def peak_3d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 66 - self.match(XwinNmrPKParser.Integer) - self.state = 67 - self.match(XwinNmrPKParser.Float) - self.state = 68 - self.match(XwinNmrPKParser.Float) self.state = 69 - self.match(XwinNmrPKParser.Float) + self.match(XwinNmrPKParser.Integer) self.state = 70 self.match(XwinNmrPKParser.Float) self.state = 71 @@ -521,25 +527,31 @@ def peak_3d(self): self.match(XwinNmrPKParser.Float) self.state = 73 self.match(XwinNmrPKParser.Float) + self.state = 74 + self.match(XwinNmrPKParser.Float) self.state = 75 + self.match(XwinNmrPKParser.Float) + self.state = 76 + self.match(XwinNmrPKParser.Float) + self.state = 78 self._errHandler.sync(self) _la = self._input.LA(1) if _la==3: - self.state = 74 + self.state = 77 self.match(XwinNmrPKParser.Float) - self.state = 80 + self.state = 83 self._errHandler.sync(self) _la = self._input.LA(1) while _la==9: - self.state = 77 + self.state = 80 self.match(XwinNmrPKParser.Annotation) - self.state = 82 + self.state = 85 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 83 + self.state = 86 self.match(XwinNmrPKParser.RETURN) except RecognitionException as re: localctx.exception = re @@ -596,14 +608,8 @@ def peak_4d(self): self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 85 - self.match(XwinNmrPKParser.Integer) - self.state = 86 - self.match(XwinNmrPKParser.Float) - self.state = 87 - self.match(XwinNmrPKParser.Float) self.state = 88 - self.match(XwinNmrPKParser.Float) + self.match(XwinNmrPKParser.Integer) self.state = 89 self.match(XwinNmrPKParser.Float) self.state = 90 @@ -616,25 +622,31 @@ def peak_4d(self): self.match(XwinNmrPKParser.Float) self.state = 94 self.match(XwinNmrPKParser.Float) + self.state = 95 + self.match(XwinNmrPKParser.Float) self.state = 96 + self.match(XwinNmrPKParser.Float) + self.state = 97 + self.match(XwinNmrPKParser.Float) + self.state = 99 self._errHandler.sync(self) _la = self._input.LA(1) if _la==3: - self.state = 95 + self.state = 98 self.match(XwinNmrPKParser.Float) - self.state = 101 + self.state = 104 self._errHandler.sync(self) _la = self._input.LA(1) while _la==9: - self.state = 98 + self.state = 101 self.match(XwinNmrPKParser.Annotation) - self.state = 103 + self.state = 106 self._errHandler.sync(self) _la = self._input.LA(1) - self.state = 104 + self.state = 107 self.match(XwinNmrPKParser.RETURN) except RecognitionException as re: localctx.exception = re diff --git a/wwpdb/utils/nmr/pk/XwinNmrPKReader.py b/wwpdb/utils/nmr/pk/XwinNmrPKReader.py index 4d1c5074..454877e6 100644 --- a/wwpdb/utils/nmr/pk/XwinNmrPKReader.py +++ b/wwpdb/utils/nmr/pk/XwinNmrPKReader.py @@ -92,7 +92,7 @@ def setParserMaxErrorReport(self, maxErrReport): self.__maxParserErrorReport = maxErrReport def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, - createSfDict=False, originalFileName=None, listIdCounter=None, entryId=None): + createSfDict=False, originalFileName=None, listIdCounter=None, reservedListIds=None, entryId=None): """ Parse XWINNMR PK file. @return: XwinNmrPKParserListener for success or None otherwise, ParserErrorListener, LexerErrorListener. """ @@ -172,6 +172,8 @@ def parse(self, pkFilePath, cifFilePath=None, isFilePath=True, listener.setOriginaFileName(originalFileName) if listIdCounter is not None: listener.setListIdCounter(listIdCounter) + if reservedListIds is not None: + listener.setReservedListIds(reservedListIds) if entryId is not None: listener.setEntryId(entryId) walker.walk(listener, tree) diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKLexer.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKLexer.g4 index c24242ed..32ababeb 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKLexer.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKLexer.g4 @@ -47,7 +47,7 @@ Any_name: ~[ \t\r\n]+; fragment ALPHA: [A-Za-z]; fragment ALPHA_NUM: ALPHA | DEC_DIGIT; -fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '#' | '?'; +fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '?'; fragment NAME_CHAR: START_CHAR | '\'' | '"'; //fragment ATM_NAME_CHAR: ALPHA_NUM | '\''; fragment SIMPLE_NAME: START_CHAR NAME_CHAR*; diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKParser.g4 index 6072d9c6..7f280871 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKParser.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrPipePKParser.g4 @@ -19,6 +19,7 @@ parser grammar NmrPipePKParser; options { tokenVocab=NmrPipePKLexer; } nmrpipe_pk: + RETURN? ( data_label | peak_list_2d | diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKLexer.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKLexer.g4 index 82c4e3a8..ca77c003 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKLexer.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKLexer.g4 @@ -36,7 +36,7 @@ Simple_name: SIMPLE_NAME; fragment ALPHA: [A-Za-z]; fragment ALPHA_NUM: ALPHA | DEC_DIGIT; -fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '#' | '?'; +fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '?'; fragment NAME_CHAR: START_CHAR | '\'' | '"'; //fragment ATM_NAME_CHAR: ALPHA_NUM | '\''; fragment SIMPLE_NAME: START_CHAR NAME_CHAR*; diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKParser.g4 index 701b3984..b2e2d62e 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKParser.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/NmrViewPKParser.g4 @@ -19,6 +19,7 @@ parser grammar NmrViewPKParser; options { tokenVocab=NmrViewPKLexer; } nmrview_pk: + RETURN? ( data_label | peak_list_2d | @@ -52,8 +53,8 @@ peak_list_2d: peak_2d: Integer - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA Float Float Integer ENCLOSE_DATA? Integer RETURN; peak_list_3d: @@ -65,9 +66,9 @@ peak_list_3d: peak_3d: Integer - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA Float Float Integer ENCLOSE_DATA? Integer RETURN; peak_list_4d: @@ -80,10 +81,10 @@ peak_list_4d: peak_4d: Integer - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA - ENCLOSE_DATA Float Float Float Simple_name ENCLOSE_DATA ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA + ENCLOSE_DATA Float Float Float Simple_name jcoupling ENCLOSE_DATA Float Float Integer ENCLOSE_DATA? Integer RETURN; peak_list_wo_eju_2d: @@ -131,3 +132,6 @@ peak_wo_eju_4d: label: Float_LA | Simple_name_LA | ENCLOSE_DATA_LA; +jcoupling: + Float | Simple_name | ENCLOSE_DATA; + diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKLexer.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKLexer.g4 index 135cd773..b8602923 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKLexer.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKLexer.g4 @@ -30,7 +30,7 @@ SHARP_COMMENT: '#'+ ~[\r\n]* '#'* ~[\r\n]* -> channel(HIDDEN); EXCLM_COMMENT: '!'+ ~[\r\n]* '!'* ~[\r\n]* -> channel(HIDDEN); SMCLN_COMMENT: ';'+ ~[\r\n]* ';'* ~[\r\n]* -> channel(HIDDEN); -fragment ASS_EACH_AXIS: SIMPLE_NAME ([;&/,.] SIMPLE_NAME)*; +fragment ASS_EACH_AXIS: SIMPLE_NAME ([:;&/,.] SIMPLE_NAME)*; Assignment_2d_ex: ASS_EACH_AXIS '-' ASS_EACH_AXIS; Assignment_3d_ex: ASS_EACH_AXIS '-' ASS_EACH_AXIS '-' ASS_EACH_AXIS; @@ -43,7 +43,7 @@ Assignment_4d_ex: ASS_EACH_AXIS '-' ASS_EACH_AXIS '-' ASS_EACH_AXIS '-' ASS_EACH fragment ALPHA: [A-Za-z]; fragment ALPHA_NUM: ALPHA | DEC_DIGIT; -fragment START_CHAR: ALPHA_NUM | '_' | '+' | '*' | '#' | '?'; +fragment START_CHAR: ALPHA_NUM | '_' | '+' | '*' | '?'; fragment NAME_CHAR: START_CHAR | '\'' | '"'; //fragment ATM_NAME_CHAR: ALPHA_NUM | '\''; fragment SIMPLE_NAME: START_CHAR NAME_CHAR*; diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKParser.g4 index 13db87ed..2e9868b4 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKParser.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/SparkyPKParser.g4 @@ -19,15 +19,19 @@ parser grammar SparkyPKParser; options { tokenVocab=SparkyPKLexer; } sparky_pk: + RETURN? ( data_label | - data_label_wo_assign + data_label_wo_assign | + peak_2d+ | + peak_3d+ | + peak_4d+ )* EOF; data_label: - Assignment W1_LA W2_LA W3_LA? W4_LA? Height_LA Volume_LA? S_N_LA? RETURN_LA - (peak_2d+ | peak_3d+ | peak_4d+); + Assignment W1_LA W2_LA W3_LA? W4_LA? Height_LA Volume_LA? S_N_LA? RETURN_LA; +// (peak_2d+ | peak_3d+ | peak_4d+); data_label_wo_assign: W1 W2_LA W3_LA? W4_LA? Height_LA Volume_LA? S_N_LA? RETURN_LA @@ -45,6 +49,6 @@ peak_4d: peak_wo_assign: number+ RETURN; -/* number expression in assign */ +/* number expression in peak list */ number: Real | Float | Integer; diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/VnmrPKLexer.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/VnmrPKLexer.g4 new file mode 100644 index 00000000..1382cc15 --- /dev/null +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/VnmrPKLexer.g4 @@ -0,0 +1,76 @@ +/* + Vnmr PK (Spectral peak list) lexer grammar for ANTLR v4. + Copyright 2024 Masashi Yokochi + +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +lexer grammar VnmrPKLexer; + +Peak_id: 'peak id.' -> pushMode(LABEL_MODE); + +Integer: ('+' | '-')? DECIMAL; +Float: ('+' | '-')? (DECIMAL | DEC_DOT_DEC); +Real: ('+' | '-')? (DECIMAL | DEC_DOT_DEC) ([Ee] ('+' | '-')? DECIMAL)?; +fragment DEC_DOT_DEC: (DECIMAL '.' DECIMAL) | ('.' DECIMAL); +fragment DEC_DIGIT: [0-9]; +fragment DECIMAL: DEC_DIGIT+; + +SHARP_COMMENT: '#'+ ~[\r\n]* '#'* ~[\r\n]* -> channel(HIDDEN); +EXCLM_COMMENT: '!'+ ~[\r\n]* '!'* ~[\r\n]* -> channel(HIDDEN); +SMCLN_COMMENT: ';'+ ~[\r\n]* ';'* ~[\r\n]* -> channel(HIDDEN); + +fragment ASS_EACH_AXIS: SIMPLE_NAME ([:;&/,.] SIMPLE_NAME)*; + +Assignment_2d_ex: ASS_EACH_AXIS '-' ASS_EACH_AXIS; +Assignment_3d_ex: ASS_EACH_AXIS '-' ASS_EACH_AXIS '-' ASS_EACH_AXIS; +Assignment_4d_ex: ASS_EACH_AXIS '-' ASS_EACH_AXIS '-' ASS_EACH_AXIS '-' ASS_EACH_AXIS; + +//Simple_name: SIMPLE_NAME; +//Residue_number: Integer; +//Residue_name: SIMPLE_NAME; +//Atom_name: ALPHA_NUM ATM_NAME_CHAR*; + +fragment ALPHA: [A-Za-z]; +fragment ALPHA_NUM: ALPHA | DEC_DIGIT; +fragment START_CHAR: ALPHA_NUM | '_' | '+' | '*' | '?'; +fragment NAME_CHAR: START_CHAR | '\'' | '"'; +//fragment ATM_NAME_CHAR: ALPHA_NUM | '\''; +fragment SIMPLE_NAME: START_CHAR NAME_CHAR*; + +SPACE: [ \t]+ -> skip; +RETURN: [\r\n]+; + +ENCLOSE_COMMENT: '{' (ENCLOSE_COMMENT | .)*? '}' -> channel(HIDDEN); +SECTION_COMMENT: ('#' | '!' | ';' | '\\' | '&' | '/' '/'+ | '*' '*'+ | '=' '='+ | 'REMARK') ' '* RETURN -> channel(HIDDEN); +LINE_COMMENT: ('#' | '!' | ';' | '\\' | '&' | '/' '/'+ | '*' '*'+ | '=' '='+ | 'REMARK') ~[\r\n]* RETURN -> channel(HIDDEN); + +/* Vnmr: Peak list format + See also https://sites.google.com/site/ccpnwiki/home/documentation/contributed-software/bruce-d-ray-utility-programs/readme +*/ + +mode LABEL_MODE; + +Dim_0_ppm: 'Dim 0 (ppm)'; +Dim_1_ppm: 'Dim 1 (ppm)'; +Dim_2_ppm: 'Dim 2 (ppm)'; +Dim_3_ppm: 'Dim 3 (ppm)'; +Dev_0: 'Dev. 0'; +Dev_1: 'Dev. 1'; +Dev_2: 'Dev. 2'; +Dev_3: 'Dev. 3'; +Amplitude: 'Amplitude'; +Assignment: 'Assignment'; + +SPACE_LA: [ \t]+ -> skip; +RETURN_LA: [\r\n]+ -> popMode; + diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/VnmrPKParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/VnmrPKParser.g4 new file mode 100644 index 00000000..ab7d15dd --- /dev/null +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/VnmrPKParser.g4 @@ -0,0 +1,49 @@ +/* + Vnmr PK (Spectral peak list) parser grammar for ANTLR v4. + Copyright 2024 Masashi Yokochi + +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +parser grammar VnmrPKParser; + +options { tokenVocab=VnmrPKLexer; } + +vnmr_pk: + RETURN? + ( + data_label | + peak_2d+ | + peak_3d+ | + peak_4d+ + )* + EOF; + +/* Vnmr: Peak list format + See also https://sites.google.com/site/ccpnwiki/home/documentation/contributed-software/bruce-d-ray-utility-programs/readme +*/ + +data_label: + Peak_id Dim_0_ppm Dev_0 Dim_1_ppm Dev_1 (Dim_2_ppm Dev_2 (Dim_3_ppm Dev_3)?)? Amplitude Assignment? RETURN_LA; + +peak_2d: + Integer Float Float Float Float number Assignment_2d_ex? RETURN; + +peak_3d: + Integer Float Float Float Float Float Float number Assignment_3d_ex? RETURN; + +peak_4d: + Integer Float Float Float Float Float Float Float Float number Assignment_4d_ex? RETURN; + +/* number expression in peak list */ +number: Real | Float | Integer; + diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKLexer.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKLexer.g4 index 85250547..2991e6e6 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKLexer.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKLexer.g4 @@ -35,6 +35,8 @@ fragment DEC_DOT_DEC: (DECIMAL '.' DECIMAL) | ('.' DECIMAL); fragment DEC_DIGIT: [0-9]; fragment DECIMAL: DEC_DIGIT+; +COMMENT: ('#' | '!')+ -> mode(COMMENT_MODE); + EXCLM_COMMENT: '!'+ ~[\r\n]* '!'* ~[\r\n]* -> channel(HIDDEN); SMCLN_COMMENT: ';'+ ~[\r\n]* ';'* ~[\r\n]* -> channel(HIDDEN); @@ -45,7 +47,7 @@ Simple_name: SIMPLE_NAME; fragment ALPHA: [A-Za-z]; fragment ALPHA_NUM: ALPHA | DEC_DIGIT; -fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '#' | '?'; +fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '?'; fragment NAME_CHAR: START_CHAR | '\'' | '"'; //fragment ATM_NAME_CHAR: ALPHA_NUM | '\''; fragment SIMPLE_NAME: START_CHAR NAME_CHAR*; @@ -54,8 +56,8 @@ SPACE: [ \t]+ -> skip; RETURN: [\r\n]+; ENCLOSE_COMMENT: '{' (ENCLOSE_COMMENT | .)*? '}' -> channel(HIDDEN); -SECTION_COMMENT: ('!' | ';' | '\\' | '&' | '/' '/'+ | '*' '*'+ | '=' '='+ | 'REMARK') ' '* RETURN -> channel(HIDDEN); -LINE_COMMENT: ('!' | ';' | '\\' | '&' | '/' '/'+ | '*' '*'+ | '=' '='+ | 'REMARK') ~[\r\n]* RETURN -> channel(HIDDEN); +SECTION_COMMENT: (';' | '\\' | '&' | '/' '/'+ | '*' '*'+ | '=' '='+ | 'REMARK') ' '* RETURN -> channel(HIDDEN); +LINE_COMMENT: (';' | '\\' | '&' | '/' '/'+ | '*' '*'+ | '=' '='+ | 'REMARK') ~[\r\n]* RETURN -> channel(HIDDEN); mode NUM_OF_DIM_MODE; @@ -100,3 +102,10 @@ Float_TO: Float; TOACE_TO: [ \t]+ -> skip; RETURN_TO: [\r\n]+ -> popMode; +mode COMMENT_MODE; + +Any_name: ~[ \t\r\n]+; + +SPACE_CM: [ \t]+ -> skip; +RETURN_CM: [\r\n]+ -> mode(DEFAULT_MODE); + diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKParser.g4 index 5e3600f4..73e7dce7 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKParser.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPKParser.g4 @@ -19,6 +19,7 @@ parser grammar XeasyPKParser; options { tokenVocab=XeasyPKLexer; } xeasy_pk: + RETURN? ( dimension | format | @@ -59,8 +60,8 @@ peak_2d: Integer Simple_name number number Simple_name Integer - assign assign RETURN - (assign assign RETURN)*; + assign assign Integer? (RETURN | comment) + (assign assign Integer? (RETURN | comment))*; peak_list_3d: peak_3d+; @@ -71,8 +72,8 @@ peak_3d: Integer Simple_name number number Simple_name Integer - assign assign assign RETURN - (assign assign assign RETURN)*; + assign assign assign Integer? (RETURN | comment) + (assign assign assign Integer? (RETURN | comment))*; peak_list_4d: peak_4d+; @@ -83,8 +84,8 @@ peak_4d: Integer Simple_name number number Simple_name Integer - assign assign assign assign RETURN - (assign assign assign assign RETURN)*; + assign assign assign assign Integer? (RETURN | comment) + (assign assign assign assign Integer? (RETURN | comment))*; /* number expression in peak list */ number: Float | Real | Integer | Simple_name; @@ -92,3 +93,6 @@ number: Float | Real | Integer | Simple_name; /* assignment expression in peak list */ assign: Integer | (Simple_name Integer?); +comment: + COMMENT Any_name* (RETURN_CM | EOF); + diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPROTParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPROTParser.g4 index b4e830af..5e5a02fa 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPROTParser.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XeasyPROTParser.g4 @@ -19,6 +19,7 @@ parser grammar XeasyPROTParser; options { tokenVocab=XeasyPROTLexer; } xeasy_prot: + RETURN? prot+ EOF; diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKLexer.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKLexer.g4 index 5da86edc..c83d34f8 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKLexer.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKLexer.g4 @@ -34,7 +34,7 @@ COMMENT: ('*' | '#' | '!')+ -> mode(COMMENT_MODE); fragment ALPHA: [A-Za-z]; fragment ALPHA_NUM: ALPHA | DEC_DIGIT; -fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '#' | '?'; +fragment START_CHAR: ALPHA_NUM | '_' | '-' | '+' | '.' | '*' | '?'; fragment NAME_CHAR: START_CHAR | '\'' | '"'; //fragment ATM_NAME_CHAR: ALPHA_NUM | '\''; //fragment SIMPLE_NAME: START_CHAR NAME_CHAR*; diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKParser.g4 index 987696d7..84b36369 100644 --- a/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKParser.g4 +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.10/XwinNmrPKParser.g4 @@ -19,6 +19,7 @@ parser grammar XwinNmrPKParser; options { tokenVocab=XwinNmrPKLexer; } xwinnmr_pk: + RETURN? ( comment | dimension | diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.9/VnmrPKLexer.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.9/VnmrPKLexer.g4 new file mode 120000 index 00000000..4e32a793 --- /dev/null +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.9/VnmrPKLexer.g4 @@ -0,0 +1 @@ +../antlr-grammars-v4.10/VnmrPKLexer.g4 \ No newline at end of file diff --git a/wwpdb/utils/tests-nmr/antlr-grammars-v4.9/VnmrPKParser.g4 b/wwpdb/utils/tests-nmr/antlr-grammars-v4.9/VnmrPKParser.g4 new file mode 120000 index 00000000..d21eb00c --- /dev/null +++ b/wwpdb/utils/tests-nmr/antlr-grammars-v4.9/VnmrPKParser.g4 @@ -0,0 +1 @@ +../antlr-grammars-v4.10/VnmrPKParser.g4 \ No newline at end of file diff --git a/wwpdb/utils/tests-nmr/json-schema/nmr-data-procesing-report-schema-v4.json b/wwpdb/utils/tests-nmr/json-schema/nmr-data-procesing-report-schema-v4.json index 45cad1bf..67aa6885 100644 --- a/wwpdb/utils/tests-nmr/json-schema/nmr-data-procesing-report-schema-v4.json +++ b/wwpdb/utils/tests-nmr/json-schema/nmr-data-procesing-report-schema-v4.json @@ -45,6 +45,7 @@ "nm-pea-spa", "nm-pea-top", "nm-pea-vie", + "nm-pea-vnm", "nm-pea-xea", "nm-pea-xwi" ] @@ -4605,7 +4606,7 @@ } }, "model_poly_seq_vs_mr_topology": { - "description": "The object provides sequence alignment between sequence of the coordinates and sequence of parameter/topology file.", + "description": "The object provides sequence alignment between sequence of the coordinates and sequence of topology.", "type": [ "array", "null" @@ -4622,7 +4623,24 @@ } }, "model_poly_seq_vs_mr_restraint": { - "description": "The object provides sequence alignment between sequence of the coordinates and sequence of overall restraint files.", + "description": "The object provides sequence alignment between sequence of the coordinates and sequence of restraints.", + "type": [ + "array", + "null" + ], + "items": { + "allOf": [ + { + "$ref": "#/definitions/sequence_alignment_in_coord" + }, + { + "$ref": "#/definitions/common_sequence_alignment" + } + ] + } + }, + "model_poly_seq_vs_spectral_peak": { + "description": "The object provides sequence alignment between sequence of the coordinates and sequence of spectral peak lists.", "type": [ "array", "null"