Module documentation

Spectra

This module is used to visualize the one dimensional chemical shift list from BMRB entry or NMR-STAR file as a two dimensional NMR spectrum. It simulates peak positions of ¹⁵N-HSQC, ¹³C-HSQC and ¹H-¹H-TOCSY. It can also simulate a generic 2D spectrum between any two given pair of atoms. This module is useful to compare user data with any BMRB entry/list of entries as a overlaid NMR spectra.

pybmrb.Spectra.c13hsqc(bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, auth_tag: Optional[bool] = False, legend: Optional[str] = None, draw_trace: Optional[bool] = False, peak_list: Optional[str] = None, output_format: Optional[str] = 'html', output_file: Optional[str] = None, output_image_width: Optional[int] = 800, output_image_height: Optional[int] = 600, show_visualization: Optional[bool] = True)tuple

Plots ¹³C-HSQC spectrum for a given BMRB entry/NMR-STAR file/PyNMRSTAR entry object; This function can be used to compare different data sets as overlaid NMR Spectra. It overlays ¹³C-HSQC for a given list of BMRB entries/NMR-STAR files/PyNMRSTAR entry objects and draw lines connecting peaks from residues at the same sequence location in different data sets

Parameters
  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • legend (str, optional) – legends are disabled by default. Residue types are indicated by color and data sets are indicated by symbol, displaying the combination of both will create a very long list of legend. Optionally either ‘residue’ or ‘dataset’ can be used to color code the scatter plot by residue type or data set and display the legend, defaults to None

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

  • peak_list (str, optional) – comma-separated two column file can be given as optional unassigned peak list, which can be overlaid on the spectrum as another data set, defaults to None

  • output_format (str, optional) – visualizations can be exported as interactive ‘html’ file or as static images in ‘jpg’,’jpeg’,’png’,’pdf’,’webp’,’svg’, defaults to ‘html’

  • output_file (str, optional) – file name to export visualization

  • output_image_width (int, optional) – The width of the exported image in layout pixels, defaults to 800

  • output_image_height (int, optional) – The height of the exported image in layout pixels, defaults to 600

  • show_visualization (bool, optional) – Visualization automatically opens in a web browser or as embedded visualization in Jupyter Notebook. This feature can be disabled by setting this flag as False, defaults to True

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

pybmrb.Spectra.create_2d_peaklist(atom_x: str, atom_y: str, bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, auth_tag: Optional[bool] = False, draw_trace: Optional[bool] = False, include_preceding: Optional[bool] = False, include_next: Optional[bool] = False, legend: Optional[str] = None)tuple

Converts one dimensional chemical shifts from BMRB entries/NMR-STAR files/PyNMRSTAR entry objects into into generic 2D peak list

Parameters
  • atom_x (str) – atom name for X coordinate in IUPAC format

  • atom_y (str) – atom name for Y coordinate in IUPAC format

  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

  • include_preceding (bool, optional) – include peaks from i-1 residue on the Y axis, defaults to False

  • include_next (bool, optional) – include peaks from i+i residue on the Y axis, defaults to False

  • legend (str, optional) – legends are disabled by default. Residue types are indicated by color and data sets are indicated by symbol, displaying the combination of both will create a very long list of legend. Optionally either ‘residue’ or ‘dataset’ can be used to color code the scatter plot by residue type or data set and display the legend, defaults to None

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track,psn,seq_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

pybmrb.Spectra.create_c13hsqc_peaklist(bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, auth_tag: Optional[bool] = False, draw_trace: Optional[bool] = False)tuple

Converts one dimensional chemical shifts from BMRB entries/NMR-STAR files/PyNMRSTAR entry objects into ¹³C-HSQC peak list

Parameters
  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

pybmrb.Spectra.create_n15hsqc_peaklist(bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, auth_tag: Optional[bool] = False, draw_trace: Optional[bool] = False, include_sidechain: Optional[bool] = True)tuple

Converts one dimensional chemical shifts from BMRB entries/NMR-STAR files/PyNMRSTAR entry objects into ¹⁵N-HSQC peak list

Parameters
  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

  • include_sidechain (bool, optional) – include peaks from side chains, defaults to True

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

pybmrb.Spectra.create_tocsy_peaklist(bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, auth_tag: Optional[bool] = False, draw_trace: Optional[bool] = False)tuple

Converts one dimensional chemical shifts from BMRB entries/NMR-STAR files/PyNMRSTAR entry objects into into ¹H-¹H-TOCSY peak list

Parameters
  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

pybmrb.Spectra.export_peak_list(peak_list: tuple, output_file_name: Optional[str] = None, output_format: str = 'csv', include_side_chain: bool = True)dict

Exports the peak list return from other functions in this module in csv or sparky format

Parameters
  • peak_list (tuple) – Output tuple from any peak list/spectrum simulation function from the module Spectra

  • output_file_name (str, optional) – output file name

  • output_format (str, optional) – output format ‘csv’ or ‘sparky’, defaults to ‘csv’

  • include_side_chain (bool, optional) – whether or not include side chain resonances in the output, defaults to True

Returns

data dictionary {‘column header1’:[values],’column header1’:[values]..}

Return type

dict

pybmrb.Spectra.generic_2d(atom_x: str, atom_y: str, bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, auth_tag: Optional[bool] = False, legend: Optional[str] = None, draw_trace: Optional[bool] = False, peak_list: Optional[str] = None, include_preceding: Optional[bool] = False, include_next: Optional[bool] = False, full_walk: Optional[bool] = False, seq_walk: Optional[bool] = False, output_format: Optional[str] = 'html', output_file: Optional[str] = None, output_image_width: Optional[int] = 800, output_image_height: Optional[int] = 600, show_visualization: Optional[bool] = True)tuple

Plots generic 2D spectrum for a given BMRB entry/NMR-STAR file/PyNMRSTAR entry object; This function can be used to compare different data sets as overlaid NMR Spectra. It overlays the 2D spectra for a given list of BMRB entries/NMR-STAR files/PyNMRSTAR entry objects and draw lines connecting peaks from residues at the same sequence location in different data sets

Parameters
  • atom_x (str) – atom name for X coordinate in IUPAC format

  • atom_y (str) – atom name for Y coordinate in IUPAC format

  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • legend (str, optional) – legends are disabled by default. Residue types are indicated by color and data sets are indicated by symbol, displaying the combination of both will create a very long list of legend. Optionally either ‘residue’ or ‘dataset’ can be used to color code the scatter plot by residue type or data set and display the legend, defaults to None

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

  • include_preceding (bool, optional) – include peaks from i-1 residue on the Y axis, defaults to False

  • include_next (bool, optional) – include peaks from i+i residue on the Y axis, defaults to False

  • seq_walk (bool, optional) – draw line connecting i->i-1/i+1 to next i->i-1/i+1 for only continuous sequence segments, defaults to False

  • full_walk (bool, optional) – draw line connecting i->i-1/i+1 to next i->i-1/i+1 for the full sequence ignoring any missing residues, defaults to False

  • peak_list (str, optional) – comma-separated two column file can be given as optional unassigned peak list, which can be overlaid on the spectrum as another data set, defaults to None

  • output_format (str, optional) – visualizations can be exported as interactive ‘html’ file or as static images in ‘jpg’,’jpeg’,’png’,’pdf’,’webp’,’svg’, defaults to ‘html’

  • output_file (str, optional) – file name to export visualization

  • output_image_width (int, optional) – The width of the exported image in layout pixels, defaults to 800

  • output_image_height (int, optional) – The height of the exported image in layout pixels, defaults to 600

  • show_visualization (bool, optional) – Visualization automatically opens in a web browser or as embedded visualization in Jupyter Notebook. This feature can be disabled by setting this flag as False, defaults to True

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

pybmrb.Spectra.n15hsqc(bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, auth_tag: Optional[bool] = False, legend: Optional[str] = None, draw_trace: Optional[bool] = False, include_sidechain: Optional[bool] = True, peak_list: Optional[str] = None, output_format: Optional[str] = 'html', output_file: Optional[str] = None, output_image_width: Optional[int] = 800, output_image_height: Optional[int] = 600, show_visualization: Optional[bool] = True)tuple

Plots ¹⁵N-HSQC spectrum for a given BMRB entry/NMR-STAR file/PyNMRSTAR entry object; This function can be used to compare different data sets as overlaid NMR Spectra. It overlays ¹⁵N-HSQC for a given list of BMRB entries/NMR-STAR files/PyNMRSTAR entry objects and draw lines connecting peaks from residues at the same sequence location in different data sets

Parameters
  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • legend (str, optional) – legends are disabled by default. Residue types are indicated by color and data sets are indicated by symbol, displaying the combination of both will create a very long list of legend. Optionally either ‘residue’ or ‘dataset’ can be used to color code the scatter plot by residue type or data set and display the legend, defaults to None

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

  • include_sidechain (bool, optional) – include peaks from side chains, defaults to True

  • peak_list (str, optional) – comma-separated two column file can be given as optional unassigned peak list, which can be overlaid on the spectrum as another data set, defaults to None

  • output_format (str, optional) – visualizations can be exported as interactive ‘html’ file or as static images in ‘jpg’,’jpeg’,’png’,’pdf’,’webp’,’svg’, defaults to ‘html’

  • output_file (str, optional) – file name to export visualization

  • output_image_width (int, optional) – The width of the exported image in layout pixels, defaults to 800

  • output_image_height (int, optional) – The height of the exported image in layout pixels, defaults to 600

  • show_visualization (bool, optional) – Visualization automatically opens in a web browser or as embedded visualization in Jupyter Notebook. This feature can be disabled by setting this flag as False, defaults to True

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

pybmrb.Spectra.tocsy(bmrb_ids: Optional[Union[str, List[str], int, List[int]]] = None, input_file_names: Optional[Union[str, List[str]]] = None, entry_objects: Optional[Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]]] = None, auth_tag: Optional[bool] = False, legend: Optional[str] = None, draw_trace: Optional[bool] = False, peak_list: Optional[str] = None, output_format: Optional[str] = 'html', output_file: Optional[str] = None, output_image_width: Optional[int] = 800, output_image_height: Optional[int] = 600, show_visualization: Optional[bool] = True)tuple

Plots ¹H-¹H-TOCSY spectrum for a given BMRB entry/NMR-STAR file/PyNMRSTAR entry object; This function can be used to compare different data sets as overlaid NMR Spectra. It overlays ¹H-¹H-TOCSY for a given list of BMRB entries/NMR-STAR files/PyNMRSTAR entry objects and draw lines connecting peaks from residues at the same sequence location in different data sets

Parameters
  • bmrb_ids (str/int/list, optional) – single BMRB entry ID or multiple BMRB entry IDs as list, defaults to None

  • input_file_names (str, optional) – single input file name or multiple input file names as list, defaults to None

  • entry_objects (PyNMRSTAR object/list, optional) – single PyNMRSTAR entry object or multiple PyNMRSTAR entry objects as list, defaults to None

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • legend (str, optional) – legends are disabled by default. Residue types are indicated by color and data sets are indicated by symbol, displaying the combination of both will create a very long list of legend. Optionally either ‘residue’ or ‘dataset’ can be used to color code the scatter plot by residue type or data set and display the legend, defaults to None

  • draw_trace (bool optional) – draw line connecting peaks from residues at the same sequence location in different data sets, defaults to False

  • peak_list (str, optional) – comma-separated two column file can be given as optional unassigned peak list, which can be overlaid on the spectrum as another data set, defaults to None

  • output_format (str, optional) – visualizations can be exported as interactive ‘html’ file or as static images in ‘jpg’,’jpeg’,’png’,’pdf’,’webp’,’svg’, defaults to ‘html’

  • output_file (str, optional) – file name to export visualization

  • output_image_width (int, optional) – The width of the exported image in layout pixels, defaults to 800

  • output_image_height (int, optional) – The height of the exported image in layout pixels, defaults to 600

  • show_visualization (bool, optional) – Visualization automatically opens in a web browser or as embedded visualization in Jupyter Notebook. This feature can be disabled by setting this flag as False, defaults to True

Returns

tuple of lists and dictionary (x,y,data_set,info,res,cs_track) if draw_trace is True cs_track={ matching atoms:[cs_values]} else cs_track={}

Return type

tuple

Histogram

This module generates visualizations for chemical shift distribution of a given list of atoms and residues. It can also generate chemical shift correlation plots between two atoms in the same residue and filtered chemical shift distribution based on user defined rules

pybmrb.Histogram.conditional_hist(residue: str, atom: str, filtering_rules: Optional[list], ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None, h_tolerance: Optional[float] = 0.1, c_tolerance: Optional[float] = 2.0, n_tolerance: Optional[float] = 2.0, standard_amino_acids: Optional[bool] = True, histnorm: Optional[str] = None, plot_type: Optional[str] = 'histogram', output_format: Optional[str] = 'html', output_file: Optional[str] = None, output_image_width: Optional[int] = 800, output_image_height: Optional[int] = 600, show_visualization: Optional[bool] = True)tuple

Plots the distribution of the given atom in the residue along with the filtered distribution based on the chemical shift values of the other atoms in the residue

Parameters
  • residue (str) – residue name in IUPAC format

  • atom (str) – atom name in IUPAC format

  • filtering_rules (list) – list of atoms and chemical shift values as tuples to use as a filter; example[(‘CA’,64.5),(‘H’,7.8)]

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

  • h_tolerance (float, optional) – tolerance value in ppm to filter H chemical shifts. It will allow the chemical shift value given in the filtering_rules +/- tolerance, defaults to 0.1

  • c_tolerance (float, optional) – tolerance value in ppm to filter C chemical shifts, It will allow the chemical shift value given in the filtering_rules +/- tolerance, defaults to 2.0

  • n_tolerance (float, optional) – tolerance value in ppm to filter N chemical shifts, It will allow the chemical shift value given in the filtering_rules +/- tolerance, defaults to 2.0

  • standard_amino_acids (bool, optional) – get data only form standard amino acids and nucleic acids when ‘*’ is used for residue, defaults to True

  • histnorm (str, optional) – Specifies the type of normalization used for this histogram trace. If None, the span of each bar corresponds to the number of occurrences (i.e. the number of data points lying inside the bins). If ‘percent’ / ‘probability’, the span of each bar corresponds to the percentage / fraction of occurrences with respect to the total number of sample points (here, the sum of all bin HEIGHTS equals 100% / 1). If ‘density’, the span of each bar corresponds to the number of occurrences in a bin divided by the size of the bin interval (here, the sum of all bin AREAS equals the total number of sample points). If ‘probability density’, the area of each bar corresponds to the probability that an event will fall into the corresponding bin (here, the sum of all bin AREAS equals 1) defaults to None

  • plot_type (str, optional) – visualization type ‘histogram’, ‘box’ or ‘violin’, defaults to ‘histogram’

  • output_format (str, optional) – visualizations can be exported as interactive ‘html’ file or as static images in ‘jpg’,’jpeg’,’png’,’pdf’,’webp’,’svg’, defaults to ‘html’

  • output_file (str, optional) – file name to export visualization

  • output_image_width (int, optional) – The width of the exported image in layout pixels, defaults to 800

  • output_image_height (int, optional) – The height of the exported image in layout pixels, defaults to 600

  • show_visualization (bool, optional) – Visualization automatically opens in a web browser or as embedded visualization in Jupyter Notebook. This feature can be disabled by setting this flag as False, defaults to True

Returns

chemical shift data and tags as tuple (chemical shifts, tags)

Return type

tuple

pybmrb.Histogram.hist(residue: Optional[str] = None, atom: Optional[str] = None, list_of_atoms: Optional[Union[str, List[str]]] = None, filtered: Optional[bool] = True, sd_limit: Optional[float] = 10.0, ambiguity: Optional[Union[str, int]] = '*', ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None, standard_amino_acids: Optional[bool] = True, histnorm: Optional[str] = None, plot_type: Optional[str] = 'histogram', output_format: Optional[str] = 'html', output_file: Optional[str] = None, output_image_width: Optional[int] = 800, output_image_height: Optional[int] = 600, show_visualization: Optional[bool] = True)tuple

plots histogram for a given list of atoms and residues with some filters. One of either residue or atom or list of atoms is required

Parameters
  • residue (str) – Residue name in IUPAC format; use ‘*’ for any residue

  • atom (str) – Atom name in IUPAC format; Wild card supported; example HB*; use ‘*’ for any atom

  • list_of_atoms (list, optional) – list of atoms; example [‘ALA-CB’,’CYS-N’,’TYR-CB’], defaults to None

  • filtered (bool, optional) – Filters values beyond (sd_limit)*(standard deviation) on both sides of the mean, defaults to True

  • sd_limit (float, optional) – scaling factor used to filter data based on standard deviation, defaults to 10.0

  • ambiguity (str, optional) – filter based on chemical shift ambiguity code, defaults to ‘*’ means no filter

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

  • standard_amino_acids (bool, optional) – get data only form standard amino acids and nucleic acids when ‘*’ is used for residue, defaults to True

  • histnorm (str, optional) – Specifies the type of normalization used for this histogram trace. If None, the span of each bar corresponds to the number of occurrences (i.e. the number of data points lying inside the bins). If ‘percent’ / ‘probability’, the span of each bar corresponds to the percentage / fraction of occurrences with respect to the total number of sample points (here, the sum of all bin HEIGHTS equals 100% / 1). If ‘density’, the span of each bar corresponds to the number of occurrences in a bin divided by the size of the bin interval (here, the sum of all bin AREAS equals the total number of sample points). If ‘probability density’, the area of each bar corresponds to the probability that an event will fall into the corresponding bin (here, the sum of all bin AREAS equals 1) defaults to None

  • plot_type (str, optional) – visualization type ‘histogram’, ‘box’ or ‘violin’, defaults to ‘histogram’

  • output_format (str, optional) – visualizations can be exported as interactive ‘html’ file or as static images in ‘jpg’,’jpeg’,’png’,’pdf’,’webp’,’svg’, defaults to ‘html’

  • output_file (str, optional) – file name to export visualization

  • output_image_width (int, optional) – The width of the exported image in layout pixels, defaults to 800

  • output_image_height (int, optional) – The height of the exported image in layout pixels, defaults to 600

  • show_visualization (bool, optional) – Visualization automatically opens in a web browser or as embedded visualization in Jupyter Notebook. This feature can be disabled by setting this flag as False, defaults to True

Returns

chemical shift data and tags as tuple (chemical shifts, tags)

Return type

tuple

pybmrb.Histogram.hist2d(residue: str, atom1: str, atom2: str, filtered: Optional[bool] = True, sd_limit: Optional[float] = 10.0, ambiguity1: Optional[Union[str, int]] = '*', ambiguity2: Optional[Union[str, int]] = '*', ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None, histnorm: Optional[str] = None, plot_type: Optional[str] = 'heatmap', output_format: Optional[str] = 'html', output_file: Optional[str] = None, output_image_width: Optional[int] = 800, output_image_height: Optional[int] = 600, show_visualization: Optional[bool] = True)tuple

Generates chemical shift correlation plot for any two atoms from a given residue.

Parameters
  • residue (str) – residue name in IUPAC format

  • atom1 (str) – atom name in IUPAC format

  • atom2 (str) – atom name in IUPAC format

  • filtered (bool, optional) – Filters values beyond (sd_limit)*(standard deviation) on both sides of the mean, defaults to True

  • sd_limit (float, optional) – scaling factor used to filter data based on standard deviation, defaults to 10.0

  • ambiguity1 (str, optional) – filter based on chemical shift ambiguity code for atom1, defaults to ‘*’ means no filter

  • ambiguity2 (str, optional) – filter based on chemical shift ambiguity code for atom2, defaults to ‘*’ means no filter

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

  • histnorm (str, optional) – Specifies the type of normalization used for this histogram trace. If None, the span of each bar corresponds to the number of occurrences (i.e. the number of data points lying inside the bins). If ‘percent’ / ‘probability’, the span of each bar corresponds to the percentage / fraction of occurrences with respect to the total number of sample points (here, the sum of all bin HEIGHTS equals 100% / 1). If ‘density’, the span of each bar corresponds to the number of occurrences in a bin divided by the size of the bin interval (here, the sum of all bin AREAS equals the total number of sample points). If ‘probability density’, the area of each bar corresponds to the probability that an event will fall into the corresponding bin (here, the sum of all bin AREAS equals 1) defaults to None

  • plot_type (str, optional) – visualization type ‘contour’ or ‘heatmap’, defaults to ‘heatmap’

  • output_format (str, optional) – visualizations can be exported as interactive ‘html’ file or as static images in ‘jpg’,’jpeg’,’png’,’pdf’,’webp’,’svg’, defaults to ‘html’

  • output_file (str, optional) – file name to export visualization

  • output_image_width (int, optional) – The width of the exported image in layout pixels, defaults to 800

  • output_image_height (int, optional) – The height of the exported image in layout pixels, defaults to 600

  • show_visualization (bool, optional) – Visualization automatically opens in a web browser or as embedded visualization in Jupyter Notebook. This feature can be disabled by setting this flag as False, defaults to True

Returns

tuple (chemical shift list of atom1, chemical shift list of atom2)

Return type

tuple

ChemicalShift

This module extracts chemical shift information from BMRB entries, NMR-STAR files and PyNMRSTAR entry objects

pybmrb.ChemicalShift.from_bmrb(bmrb_ids: Union[str, List[str], int, List[int]], auth_tag: Optional[bool] = False)dict

Extracts chemical shift information directly from BMRB database for a given BMRB entry or list of entries

Parameters
  • bmrb_ids (str/int/list) – List of BMRB entries ids or single BMRB ID

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

Returns

Chemical shift dictionary {data_set_id:{chain_id:{seq_id:{atom_id:cs_value}},’seq_ids’:[1,2,3,4..]}}

Return type

dict

pybmrb.ChemicalShift.from_entry_object(entry_objects: Union[pynmrstar.entry.Entry, List[pynmrstar.entry.Entry]], auth_tag: Optional[bool] = False, data_set_id: Optional[Union[str, List[str]]] = None)dict

Extracts chemical shift information from one or more PyNMRSTAR entry object

Parameters
  • entry_objects (pynmrstar.Entry/list) – list of pynmrstar entry object or single entry object

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • data_set_id (str, optional) – User defined data set id defaults to None

Returns

Chemical shift dictionary {data_set_id:{chain_id:{seq_id:{atom_id:cs_value}},’seq_ids’:[1,2,3,4..]}}

Return type

dict

pybmrb.ChemicalShift.from_file(input_file_names: Union[str, List[str]], auth_tag: bool = False, data_set_id: Optional[Union[str, List[str]]] = None)dict

Extracts chemical shift information one or more NMR-STAR files

Parameters
  • input_file_names (str/list) – list of NMR-STAR file names with full path or single file name with full path

  • auth_tag (bool, optional) – Use sequence numbers from _Atom_chem_shift.Auth_seq_ID instead of _Atom_chem_shift.Comp_index_ID in the NMR-STAR file/BMRB entry, defaults to False

  • data_set_id (str, optional) – User defined data set id defaults to None

Returns

Chemical shift dictionary {data_set_id:{chain_id:{seq_id:{atom_id:cs_value}},’seq_ids’:[1,2,3,4..]}}

Return type

dict

ChemicalShiftStatistics

This module fetches chunks of chemical shift data from BMRB database for given list of atoms or residues. It exports the chemical shift data for Histogram module. This module is not intended to call directly, but can be used for data mining.

pybmrb.ChemicalShiftStatistics.get_2d_chemical_shifts(residue: str, atom1: str, atom2: str, filtered: Optional[bool] = True, sd_limit: Optional[float] = 10, ambiguity1: Optional[Union[str, int]] = '*', ambiguity2: Optional[Union[str, int]] = '*', ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None)tuple

Fetches chemical shift data for a given residue and combines the desired two atoms chemical shift value from the same residue as two dimensional list

Parameters
  • residue (str) – residue name in IUPAC format

  • atom1 (str) – atom name in IUPAC format

  • atom2 (str) – atom name in IUPAC format

  • filtered (bool, optional) – Filters values beyond (sd_limit)*(standard deviation) on both sides of the mean, defaults to True

  • sd_limit (float, optional) – scaling factor used to filter data based on standard deviation, defaults to 10.0

  • ambiguity1 (str, optional) – filter based on chemical shift ambiguity code for atom1, defaults to ‘*’ means no filter

  • ambiguity2 (str, optional) – filter based on chemical shift ambiguity code for atom2, defaults to ‘*’ means no filter

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

Returns

tuple of lists (atom1_cs,atom2_cs as list)

Return type

tuple

pybmrb.ChemicalShiftStatistics.get_data(residue: str, atom: str, filtered: Optional[bool] = True, sd_limit: Optional[float] = 10.0, ambiguity: Optional[Union[str, int]] = '*', ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None, standard_amino_acids: Optional[bool] = True)tuple

Fetches the data from BMRB-API for given residue and atom and filters based of the values provided in the parameters

Parameters
  • residue (str) – Residue name in IUPAC format; use ‘*’ for any residue

  • atom (str) – Atom name in IUPAC format; Wild card supported; example HB*; use ‘*’ for any atom

  • filtered (bool, optional) – Filters values beyond (sd_limit)*(standard deviation) on both sides of the mean, defaults to True

  • sd_limit (float, optional) – scaling factor used to filter data based on standard deviation, defaults to 10.0

  • ambiguity (str, optional) – filter based on chemical shift ambiguity code, defaults to * means no filter

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

  • standard_amino_acids (bool, optional) – get data only form standard amino acids and nucleic acids when * is used for residue, defaults to True

Returns

column names and chemical shift data as tuple (columns,data)

Return type

tuple

pybmrb.ChemicalShiftStatistics.get_data_from_bmrb(residue: Optional[str] = None, atom: Optional[str] = None, list_of_atoms: Optional[Union[str, List[str]]] = None, filtered: Optional[bool] = True, sd_limit: Optional[float] = 10.0, ambiguity: Optional[Union[str, int]] = '*', ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None, standard_amino_acids: Optional[bool] = True)tuple
Fetches the data from BMRB-API for given residue/list of residues (and/or) atom/list of atoms and

filters based of the values provided in the parameters

Parameters
  • residue (str) – Residue name in IUPAC format; use ‘*’ for any residue

  • atom (str) – Atom name in IUPAC format; Wild card supported; example HB*; use ‘*’ for any atom

  • list_of_atoms (list, optional) – list of atoms; example [‘ALA-CB’,’CYS-N’,’TYR-CB’], defaults to None

  • filtered (bool, optional) – Filters values beyond (sd_limit)*(standard deviation) on both sides of the mean, defaults to True

  • sd_limit (float, optional) – scaling factor used to filter data based on standard deviation, defaults to 10.0

  • ambiguity (str, optional) – filter based on chemical shift ambiguity code, defaults to ‘*’ means no filter

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

  • standard_amino_acids (bool, optional) – get data only form standard amino acids and nucleic acids when ‘*’ is used for residue, defaults to True

Returns

column names and chemical shift data as tuple (columns,data)

Return type

tuple

pybmrb.ChemicalShiftStatistics.get_filtered_data_from_bmrb(residue: str, atom: str, filtering_rules: Optional[list], ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None, h_tolerance: Optional[float] = 0.1, c_tolerance: Optional[float] = 2.0, n_tolerance: Optional[float] = 2.0, standard_amino_acids: Optional[bool] = True)list

Fetches the chemical shift data for a given residue and filters them using chemical shift values of other atoms in the same residue as a filter

Parameters
  • residue (str) – residue name in IUPAC format

  • atom (str) – atom name in IUPAC format

  • filtering_rules (list) – list of atoms and chemical shift values as tuples to use as a filter; example[(‘CA’,64.5),(‘H’,7.8)]

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

  • h_tolerance (float, optional) – tolerance value in ppm to filter H chemical shifts. It will allow the chemical shift value given in the filtering_rules +/- tolerance, defaults to 0.1

  • c_tolerance (float, optional) – tolerance value in ppm to filter C chemical shifts, It will allow the chemical shift value given in the filtering_rules +/- tolerance, defaults to 2.0

  • n_tolerance (float, optional) – tolerance value in ppm to filter N chemical shifts, It will allow the chemical shift value given in the filtering_rules +/- tolerance, defaults to 2.0

  • standard_amino_acids (bool, optional) – get data only form standard amino acids and nucleic acids when ‘*’ is used for residue, defaults to True

Returns

chemical shift values as list

Return type

list

pybmrb.ChemicalShiftStatistics.get_statistics(residue: str, atom: str, list_of_atoms: Optional[Union[str, List[str]]] = None, filtered: Optional[bool] = True, sd_limit: Optional[float] = 10.0, ambiguity: Optional[Union[str, int]] = '*', ph_min: Optional[float] = None, ph_max: Optional[float] = None, t_min: Optional[float] = None, t_max: Optional[float] = None, standard_amino_acids: Optional[bool] = True, verbose: bool = False)dict

Provides chemical shift statistics like Mean, Median, Standard deviation for a given residue/atom/list of atoms

Parameters
  • residue (str) – Residue name in IUPAC format; use ‘*’ for any residue

  • atom (str) – Atom name in IUPAC format; Wild card supported; example HB*; use ‘*’ for any atom

  • list_of_atoms (list, optional) – list of atoms; example [‘ALA-CB’,’CYS-N’,’TYR-CB’], defaults to None

  • filtered (bool, optional) – Filters values beyond (sd_limit)*(standard deviation) on both sides of the mean, defaults to True

  • sd_limit (float, optional) – scaling factor used to filter data based on standard deviation, defaults to 10.0

  • ambiguity (str, optional) – filter based on chemical shift ambiguity code, defaults to ‘*’ means no filter

  • ph_min (float, optional) – minimum value for the filter based on PH value, defaults to None

  • ph_max (float, optional) – maximum value for the filter based on PH value, defaults to None

  • t_min (float, optional) – minimum value for the filter based on temperature value, defaults to None

  • t_max (float, optional) – maximum value for the filter based on temperature value, defaults to None

  • standard_amino_acids (bool, optional) – get data only form standard amino acids and nucleic acids when ‘*’ is used for residue, defaults to True

  • verbose (bool, optional) – display the statistics on screen; defaults to False

Returns

chemical shift statistics as a dictionary

Return type

dict