import csv, os
curdat = CURDATA()
Peaklist = GETPEAKSARRAY()
SMART_PATH = os.path.abspath("C:\Bruker\SMART Peak Lists") #This is what you change if you are on MAC or wish to give the directory a different name.
Dest_Path = os.path.join(SMART_PATH,str(curdat[0])+'_Peaks.csv')
with open(Dest_Path, 'w') as csvfile:
fieldnames = ['1H', '13C']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames,lineterminator = '\n')
writer.writeheader()
for peak in Peaklist:
proton = round(peak.getPositions()[0],2)
carbon = round(peak.getPositions()[1],1)
writer.writerow({'1H':proton,'13C':carbon})--
You received this message because you are subscribed to the Google Groups "SMARTNMR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smartnmr+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smartnmr/21351c68-6393-4140-8831-db4a4092f1cb%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to smar...@googlegroups.com.
import pandas as pd
import os,csv
###for use after using the topspin command 'convertpeaklist txt' - places a file called peaks.txt in the proc folder of the exeriment.
#All peak outputs are called peak.txt by default from topspin
File = "peak.txt" # Change this to the file destination (or simply click and drag the peak.txt into the directory with the script)
print('Please enter the name of the sample')
ID= input() #This will rename the final file so the user can keep track of what sample they have converted around.
def row_dict(filename):
###row_dict was written by Jeff van Santen ###
Rows = dict()
with open(filename) as p:
reader = csv.reader(p, delimiter=" ")
for row in reader:
row = [x for x in row if x]
if "#" in row or not row:
continue
else:
try:
Rows[row[0]] = [row[3],row[4]]
except:
pass
return Rows
Rows = row_dict(os.path.join(File))
HSQC_Data = pd.DataFrame.from_dict(Rows, orient='index',columns = ['1H','13C']).astype('float')
HSQC_Data = HSQC_Data.sort_values(by=['1H'],ascending = True).round({'1H':2,'13C':1})
HSQC_Data.to_csv(ID+'_SMART_Peak_List.csv',index=False)Hey Ming,
Looks great! I tried the auto peak picked text files and manually annotated text files and all the cases passed. The thing to keep in mind is that the manual peak picking in topspin outputs each separate peak picking event as a different section with different headers – which is why it isn’t as simple as cut and paste. This way, users can use the ‘notes/annotations’ areas of the peak picking options in topspin and it looks like it’s completely unaffected.
I ran Erythromycin, Betulinic Acid, and Staurosporine through and in each case, it got pretty close! (All my spectra are in DMSO, so I don’t expect there to be a perfect match)
Cheers,
Joe
--
You received this message because you are subscribed to the Google Groups "SMARTNMR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smartnmr+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smartnmr/9f501faa-e1ab-4a75-983a-e365bb24a789%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to smar...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to smartnmr+unsubscribe@googlegroups.com.