Ricca,
For the mz sort violation you can try running the code below. Change type to what you need i.e. .mzData .mzMl , .mzXML .
For the seconded problem not sure. It sounds as if your mzXML/mzData files are corrupt. you could try code :
rampid<-xcms:::rampOpen("MyFile.mzXML")
rampid
rampHead<-xcms:::rampScanHeaders(rampid)
head(rampHead)
raw<-xcms:::rampRawData(rampid)
Let us know how this goes.
## code for mz sort violation
AllCDFs<-list.files(recursive=TRUE, pattern="cdf", ignore.case=TRUE, full.names=TRUE)
apply(AllCDFs, 1, CheckCDFfile, type=".cdf")
checkCDFfile<-function(file, type=".cdf"){
cat("n")
cat(paste("Loading File:", file, sep=""))
xr<-xcmsRaw(file, profstep=0)
for(i in 1:length(xr@scanindex)){
scan<-getScan(xr, scan=i)
if(is.unsorted(scan[,"mz"]) == TRUE){
cat(" x ")
newfile<-sub(type, "-Fixed.mzdata", file, ignore.case=TRUE, fixed=TRUE)
write.mzdata(xr, newfile)
file.copy(file, sub(type, ".OLD", file, ignore.case=TRUE))
unlink(file)
return(1)
}
if(i == length(xr@scanindex)){
cat(" O ")
return(0)
}
}
}