Hi.
I am looking for a clever solution to read in a sparky peak list.
The problem is, that the header of the file can change.
Exist, not exist, and have an empty line space-between header and peak list.
Also the column order of HN, and N, can be different.
Analysis export: Resn - HN - N - no line skip between header and files. Have Height/Volumne column.
SPARKY export: Resn - N - HN - one line skip between header and files
Personal peak: Probably don't have header line.
------------------------------
Ex 1: Analysis export.
------------------------------
Assignment w1 w2 Height Volume
?-? 9.061 132.333 1.14E+05 7.66E+05 bx
V2HN-V2N 8.856 131.178 2.33E+03 9.26E+03 bx
F3HN-F3N 8.856 131.178 2.33E+03 9.26E+03 bx
------------------------------
Ex 2: Sparky export
------------------------------
Assignment w1 w2
G4N-HN 108.175 8.386
E7N-HN 129.130 8.131
------------------------------
So, I am looking for a clever solution to solve this, since it would be nice to read in peak list, and auto-detect
which order the data is sorted.
The reason is that I am looking into to try to use the auto-integrate function of nmrglue.
I have a folder with qMDD processed files, and make a settings file list.
- path to ft.2 peak-list timeT2 NCYC freq(NU)
../0plane.proc/test.ft2 peaks.list 0.06 28 466.667
../1plane.proc/test.ft2 peaks.list 0.06 0 0.000
../2plane.proc/test.ft2 peaks.list 0.06 4 66.667
../3plane.proc/test.ft2 peaks.list 0.06 32 533.333
--------
----------------------------
import nmrglue as ng
import matplotlib.pyplot as plt
import numpy as np
# Open settings
fl = np.recfromtxt("sparkylists.csv", names="ftfile, peakfile, timeT2, NI, nu")
## read in the data from a NMRPipe file
dics = []
datas = []
for line in fl[:1]:
ftfile=line['ftfile']; peakfile=line['peakfile']; timeT2=line['timeT2']
NI=line['NI']; ni=line['nu']
dic, data = ng.pipe.read(ftfile)
dics.append(dic); datas.append(data)
frqX=dic['FDF2OBS']; frqY=dic['FDF1OBS']
sizeX=dic['FDSIZE']; sizeY=dic['FDSPECNUM']
origX=dic['FDF2ORIG']; origY=dic['FDF1ORIG']
swX=dic['FDF2SW']; swY=dic['FDF1SW']
#
stepX=swX/frqX/sizeX;
highX=(origX+swX)/frqX;
stepY=swY/frqY/sizeY;
highY=(origY+swY)/frqY;
#
pf = np.recfromtxt(peakfile, names="resn, N, HN")
for pfl in pf:
print pfl
#ptsX=(highX-$HN-proton)/stepX
#ptsY=(highY-$N-nitrogen)/stepY
-----------------------------------------------
With the ptsX, and ptsY, I will subtract 1 in each direction (or similar)
and follow:
Like using SeriesTab:
- seriesTab -in test.tab -out 12Out.out -list 12List -dx 6 -dy 6
- This will tabulate the same peaks from both spectra side by side. -dx and -dy specify a box of 6 x 6 points that will be centered on each peak to tabulate the volume of the peak.
Best