Package generic_fns :: Module spectrum
[hide private]
[frames] | no frames]

Module spectrum

source code

Module containing functions for the handling of peak intensities.

Classes [hide private]
  Bruker_import
Functions [hide private]
 
__errors_height_no_repl()
Calculate the errors for peak heights when no spectra are replicated.
source code
 
__errors_repl(verbosity=0)
Calculate the errors for peak intensities from replicated spectra.
source code
 
__errors_volume_no_repl()
Calculate the errors for peak volumes when no spectra are replicated.
source code
 
autodetect_format(file_data)
Automatically detect the format of the peak list.
source code
 
baseplane_rmsd(error=0.0, spectrum_id=None, spin_id=None)
Set the peak intensity errors, as defined as the baseplane RMSD.
source code
 
delete(spectrum_id=None)
Delete spectral data corresponding to the spectrum ID.
source code
 
error_analysis()
Determine the peak intensity standard deviation.
source code
list of str
get_ids()
Return a list of all spectrum IDs.
source code
 
integration_points(N=0, spectrum_id=None, spin_id=None)
Set the number of integration points for the given spectrum.
source code
list of lists of str, str, str, float
intensity_generic(file_data=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, sep=None, spin_id=None)
Return the process data from the generic peak intensity file.
source code
list of lists of str, str, str, float, str
intensity_nmrview(file_data=None, int_col=None)
Return the process data from the NMRView peak intensity file.
source code
list of lists of str, str, str, float, str
intensity_sparky(file_data=None, int_col=None)
Return the process data from the Sparky peak intensity file.
source code
list of lists of str, str, str, float, str
intensity_xeasy(file_data=None, heteronuc=None, proton=None, int_col=None)
Return the process data from the XEasy peak intensity file.
source code
 
read(file=None, dir=None, spectrum_id=None, heteronuc=None, proton=None, int_col=None, int_method=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, sep=None, spin_id=None, ncproc=None)
Read the peak intensity data.
source code
 
replicated(spectrum_ids=None)
Set which spectra are replicates.
source code
dict of bool
replicated_flags()
Create and return a dictionary of flags of whether the spectrum is replicated or not.
source code
list of str
replicated_ids(spectrum_id)
Create and return a list of spectra ID which are replicates of the given ID.
source code
Variables [hide private]
  __package__ = 'generic_fns'

Imports: sqrt, split, string, warn, exists_mol_res_spin_data, generate_spin_id, generate_spin_id_data_array, return_spin, spin_loop, pipes, RelaxArgNotNoneError, RelaxError, RelaxImplementError, RelaxNoSequenceError, RelaxNoSpectraError, extract_data, read_spin_data, strip, RelaxWarning, RelaxNoSpinWarning


Function Details [hide private]

__errors_repl(verbosity=0)

source code 

Calculate the errors for peak intensities from replicated spectra.

Parameters:
  • verbosity (int) - The amount of information to print. The higher the value, the greater the verbosity.

autodetect_format(file_data)

source code 

Automatically detect the format of the peak list.

Parameters:
  • file_data (list of lists of str) - The processed results file data.

baseplane_rmsd(error=0.0, spectrum_id=None, spin_id=None)

source code 

Set the peak intensity errors, as defined as the baseplane RMSD.

Parameters:
  • error (float) - The peak intensity error value defined as the RMSD of the base plane noise.
  • spectrum_id (str) - The spectrum id.
  • spin_id (str) - The spin identification string.

delete(spectrum_id=None)

source code 

Delete spectral data corresponding to the spectrum ID.

Parameters:
  • spectrum_id (str) - The spectrum ID string.

get_ids()

source code 

Return a list of all spectrum IDs.

Returns: list of str
The list of spectrum IDs.

integration_points(N=0, spectrum_id=None, spin_id=None)

source code 

Set the number of integration points for the given spectrum.

Parameters:
  • N (int) - The number of integration points.
  • spectrum_id (str) - The spectrum ID string.
  • spin_id (None or str) - The spin ID string used to restrict the value to.

intensity_generic(file_data=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, data_col=None, sep=None, spin_id=None)

source code 

Return the process data from the generic peak intensity file.

The residue number, heteronucleus and proton names, and peak intensity will be returned.

Parameters:
  • file_data (list of lists of str) - The data extracted from the file converted into a list of lists.
  • spin_id_col (int or None) - The column containing the spin ID strings (used by the generic intensity file format). If supplied, the mol_name_col, res_name_col, res_num_col, spin_name_col, and spin_num_col arguments must be none.
  • mol_name_col (int or None) - The column containing the molecule name information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • res_name_col (int or None) - The column containing the residue name information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • res_num_col (int or None) - The column containing the residue number information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • spin_name_col (int or None) - The column containing the spin name information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • spin_num_col (int or None) - The column containing the spin number information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • data_col (int) - The column containing the peak intensities.
  • sep (str or None) - The column separator which, if None, defaults to whitespace.
  • spin_id (None or str) - The spin ID string used to restrict data loading to a subset of all spins.
Returns: list of lists of str, str, str, float
The extracted data as a list of lists. The first dimension corresponds to the spin. The second dimension consists of the proton name, heteronucleus name, spin ID string, and the intensity value.
Raises:
  • RelaxError - When the expected peak intensity is not a float.

intensity_nmrview(file_data=None, int_col=None)

source code 

Return the process data from the NMRView peak intensity file.

The residue number, heteronucleus and proton names, and peak intensity will be returned.

Parameters:
  • file_data (list of lists of str) - The data extracted from the file converted into a list of lists.
  • int_col (int) - The column containing the peak intensity data. The default is 16 for intensities. Setting the int_col argument to 15 will use the volumes (or evolumes). For a non-standard formatted file, use a different value.
Returns: list of lists of str, str, str, float, str
The extracted data as a list of lists. The first dimension corresponds to the spin. The second dimension consists of the proton name, heteronucleus name, spin ID string, the intensity value, and the original line of text
Raises:
  • RelaxError - When the expected peak intensity is not a float.

intensity_sparky(file_data=None, int_col=None)

source code 

Return the process data from the Sparky peak intensity file.

The residue number, heteronucleus and proton names, and peak intensity will be returned.

Parameters:
  • file_data (list of lists of str) - The data extracted from the file converted into a list of lists.
  • int_col (int) - The column containing the peak intensity data (for a non-standard formatted file).
Returns: list of lists of str, str, str, float, str
The extracted data as a list of lists. The first dimension corresponds to the spin. The second dimension consists of the proton name, heteronucleus name, spin ID string, the intensity value, and the original line of text.
Raises:
  • RelaxError - When the expected peak intensity is not a float.

intensity_xeasy(file_data=None, heteronuc=None, proton=None, int_col=None)

source code 

Return the process data from the XEasy peak intensity file.

The residue number, heteronucleus and proton names, and peak intensity will be returned.

Parameters:
  • file_data (list of lists of str) - The data extracted from the file converted into a list of lists.
  • heteronuc (str) - The name of the heteronucleus as specified in the peak intensity file.
  • proton (str) - The name of the proton as specified in the peak intensity file.
  • int_col (int) - The column containing the peak intensity data (for a non-standard formatted file).
Returns: list of lists of str, str, str, float, str
The extracted data as a list of lists. The first dimension corresponds to the spin. The second dimension consists of the proton name, heteronucleus name, spin ID string, the intensity value, and the original line of text.
Raises:
  • RelaxError - When the expected peak intensity is not a float.

read(file=None, dir=None, spectrum_id=None, heteronuc=None, proton=None, int_col=None, int_method=None, spin_id_col=None, mol_name_col=None, res_num_col=None, res_name_col=None, spin_num_col=None, spin_name_col=None, sep=None, spin_id=None, ncproc=None)

source code 

Read the peak intensity data.

Parameters:
  • file (str) - The name of the file containing the peak intensities.
  • dir (str) - The directory where the file is located.
  • spectrum_id (str) - The spectrum identification string.
  • heteronuc (str) - The name of the heteronucleus as specified in the peak intensity file.
  • proton (str) - The name of the proton as specified in the peak intensity file.
  • int_col (int) - The column containing the peak intensity data (used by the generic intensity file format).
  • int_method (str) - The integration method, one of 'height', 'point sum' or 'other'.
  • spin_id_col (int or None) - The column containing the spin ID strings (used by the generic intensity file format). If supplied, the mol_name_col, res_name_col, res_num_col, spin_name_col, and spin_num_col arguments must be none.
  • mol_name_col (int or None) - The column containing the molecule name information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • res_name_col (int or None) - The column containing the residue name information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • res_num_col (int or None) - The column containing the residue number information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • spin_name_col (int or None) - The column containing the spin name information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • spin_num_col (int or None) - The column containing the spin number information (used by the generic intensity file format). If supplied, spin_id_col must be None.
  • sep (str or None) - The column separator which, if None, defaults to whitespace.
  • spin_id (None or str) - The spin ID string used to restrict data loading to a subset of all spins.
  • ncproc (int or None) - The Bruker ncproc binary intensity scaling factor.

replicated(spectrum_ids=None)

source code 

Set which spectra are replicates.

Parameters:
  • spectrum_ids (list of str) - A list of spectrum ids corresponding to replicated spectra.

replicated_flags()

source code 

Create and return a dictionary of flags of whether the spectrum is replicated or not.

Returns: dict of bool
The dictionary of flags of whether the spectrum is replicated or not.

replicated_ids(spectrum_id)

source code 

Create and return a list of spectra ID which are replicates of the given ID.

Parameters:
  • spectrum_id (str) - The spectrum ID to find all the replicates of.
Returns: list of str
The list of spectrum IDs which are replicates of spectrum_id.