Bio.NMR.xpktools module
Tools to manipulate data from nmrview .xpk peaklist files.
- class Bio.NMR.xpktools.XpkEntry(entry, headline)
- Bases: - object- Provide dictionary access to single entry from nmrview .xpk file. - This class is suited for handling single lines of non-header data from an nmrview .xpk file. This class provides methods for extracting data by the field name which is listed in the last line of the peaklist header. - Parameters
- xpkentrystr
- The line from an nmrview .xpk file. 
- xpkheadlinestr
- The line from the header file that gives the names of the entries. This is typically the sixth line of the header, 1-origin. 
 
- Attributes
- fieldsdict
- Dictionary of fields where key is in header line, value is an entry. Variables are accessed by either their name in the header line as in self.field[“H1.P”] will return the H1.P entry for example. self.field[“entrynum”] returns the line number (1st field of line) 
 
 - __init__(entry, headline)
- Initialize the class. 
 
- class Bio.NMR.xpktools.Peaklist(infn)
- Bases: - object- Provide access to header lines and data from a nmrview xpk file. - Header file lines and file data are available as attributes. - Parameters
- infnstr
- The input nmrview filename. 
 
 - Examples - >>> from Bio.NMR.xpktools import Peaklist >>> peaklist = Peaklist('../Doc/examples/nmr/noed.xpk') >>> peaklist.firstline 'label dataset sw sf ' >>> peaklist.dataset 'test.nv' >>> peaklist.sf '{599.8230 } { 60.7860 } { 60.7860 }' >>> peaklist.datalabels ' H1.L H1.P H1.W H1.B H1.E H1.J 15N2.L 15N2.P 15N2.W 15N2.B 15N2.E 15N2.J N15.L N15.P N15.W N15.B N15.E N15.J vol int stat ' - Attributes
- firstlinestr
- The first line in the header. 
- axislabelsstr
- The axis labels. 
- datasetstr
- The label of the dataset. 
- swstr
- The sw coordinates. 
- sfstr
- The sf coordinates. 
- datalabelsstr
- The labels of the entries. 
- datalist
- File data after header lines. 
 
 - __init__(infn)
- Initialize the class. 
 - residue_dict(index)
- Return a dict of lines in ‘data’ indexed by residue number or a nucleus. - The nucleus should be given as the input argument in the same form as it appears in the xpk label line (H1, 15N for example) - Parameters
- indexstr
- The nucleus to index data by. 
 
- Returns
- resdictdict
- Mappings of index nucleus to data line. 
 
 - Examples - >>> from Bio.NMR.xpktools import Peaklist >>> peaklist = Peaklist('../Doc/examples/nmr/noed.xpk') >>> residue_d = peaklist.residue_dict('H1') >>> sorted(residue_d.keys()) ['10', '3', '4', '5', '6', '7', '8', '9', 'maxres', 'minres'] >>> residue_d['10'] ['8 10.hn 7.663 0.021 0.010 ++ 0.000 10.n 118.341 0.324 0.010 +E 0.000 10.n 118.476 0.324 0.010 +E 0.000 0.49840 0.49840 0'] 
 - write_header(outfn)
- Write header lines from input file to handle - outfn.
 
- Bio.NMR.xpktools.replace_entry(line, fieldn, newentry)
- Replace an entry in a string by the field number. - No padding is implemented currently. Spacing will change if the original field entry and the new field entry are of different lengths. 
- Bio.NMR.xpktools.data_table(fn_list, datalabel, keyatom)
- Generate a data table from a list of input xpk files. - Parameters
- fn_listlist
- List of .xpk file names. 
- datalabelstr
- The data element reported. 
- keyatomstr
- The name of the nucleus used as an index for the data table. 
 
- Returns
- outlistlist
- List of table rows indexed by - keyatom.