-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnmrML2txt.R
29 lines (25 loc) · 958 Bytes
/
nmrML2txt.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## main funtion of nmrML-to-txt converter
nmrML2txt<-function(nmrMLDir, nmrMLzip, nmrMLfile, outputDir = getwd())
{
## written by Dr. Jianliang Gao, Imperial College London
warnDef<-options("warn")$warn
warnRead<-options(warn = -1)
## main function
## output data file directory is the current run dir
dir2<-paste(outputDir[1],"/NMRdata.txt",sep="")
cat("\n Start converting nmrML files...\n")
## get spectra data
if (!missing(nmrMLDir))
{
sa<-readnmrMLDir(nmrMLDir)
write.table(sa,file=dir2,row.names=FALSE,col.names=TRUE,quote=FALSE,sep = "\t")
} else if (!(missing(nmrMLzip))) {
sa<-readnmrMLzip(nmrMLzip)
write.table(sa,file=dir2,row.names=FALSE,col.names=TRUE,quote=FALSE,sep = "\t")
} else if (!missing(nmrMLfile)) {
sa<-readnmrML(nmrMLfile)
write.table(sa,file=dir2,row.names=FALSE,col.names=TRUE,quote=FALSE,sep = "\t")
}
cat("\n Completed \n")
warnRead<-options(warn = warnDef)
}