You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, we chatted briefly in Heidelberg last week. Based on that I started to do deeper analysis to our Cut & Tag peaks. I used this EChO analysis code from this repo. After creation of all required bed files I started to run these through the code but both foci and matrix version of the code generate thousands on warnings from R side.
For example foci mode gives warnings like this:
Warning messages:
1: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
pseudoinverse used at -60.63
2: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
neighborhood radius 327.63
3: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
reciprocal condition number 2.8048e-17
4: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
There are other near singularities as well. 1.0734e+05
Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, :
NA/NaN/Inf in foreign function call (arg 7)
Calls: loess -> simpleLoess
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Execution halted
There were 50 or more warnings (use warnings() to see the first 50)
Warning messages:
1: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
pseudoinverse used at -135.13
2: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
neighborhood radius 5.13
3: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
reciprocal condition number 0
4: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
There are other near singularities as well. 969.08
etc... these go for thousands of lines. Though code still produces output file but I am not certain can it be trusted given this huge amount of warnings. Matrix mode has its own warnings and fatal errors.
I am proficient in Bash/Perl/R coding so I traced this very deep into the code. In the foci mode this part of R code:
lo<-loess(frame$V2 ~ frame$V1, span=i)
generates like bulk of the warnings. Though these seems to be warnings from loess fit.
Minor ones came from is.na(as.numeric(argsL$span))==FALSE which I changed to is.numeric(argsL$span) and that I hope is fine now.
Then in matrix mode:
It gets into serious issues with this part of the code:
values<-seq(1,0.05,-0.01)
span<-c()
wss<-data.frame(matrix(ncol=3,nrow=0))
for(i in values){
if(i*nrow(frame) > 1){
lo<-loess(frame$V2 ~ frame$V1, span=i)
if(is.na(lo$s)==FALSE){
out2<-predict(lo,index)
if(sum(out2<0)==0){
rough<-sd(diff(out2))
new3<-data.frame(i,lo$s,rough)
wss<-rbind(wss,new3)
}
}
}
}
wss<-wss[!is.infinite(rowSums(wss)),]
wss$loscale<-scale(wss$lo.s)
As if i*nrow(frame) > 1 is not TRUE for any i of values it will end up giving zero rows matrix to scale function. And that is error.
Another source of errors was this line:
spanout<-data.frame(argsL$line,span,lo$s,out3$fit[index==0],out3$se[index==0])
As index in my data does not contain 0 in any case so that data.frame cannot be formed with varying length elements.
I am wondering am I doing something wrong here, or is this runnable with some specific older R version. I already tested between 4.3.0 to 3.6.3 and nothing changes, which is not too surprising. Can you please advice a bit, I can fix code yes, but I would rather not rethink this whole calculation as you have made great tool with much of thought. And I just suspect I do something wrong.
I wonder if I give you these few ready bed files, do you have environment where you could test foci and matrix runs with those?
The text was updated successfully, but these errors were encountered:
Hi, we chatted briefly in Heidelberg last week. Based on that I started to do deeper analysis to our Cut & Tag peaks. I used this EChO analysis code from this repo. After creation of all required bed files I started to run these through the code but both foci and matrix version of the code generate thousands on warnings from R side.
For example foci mode gives warnings like this:
Warning messages:
1: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
pseudoinverse used at -60.63
2: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
neighborhood radius 327.63
3: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
reciprocal condition number 2.8048e-17
4: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
There are other near singularities as well. 1.0734e+05
Error in simpleLoess(y, x, w, span, degree = degree, parametric = parametric, :
NA/NaN/Inf in foreign function call (arg 7)
Calls: loess -> simpleLoess
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Execution halted
There were 50 or more warnings (use warnings() to see the first 50)
Warning messages:
1: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
pseudoinverse used at -135.13
2: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
neighborhood radius 5.13
3: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
reciprocal condition number 0
4: In predLoess(object$y, object$x, newx = if (is.null(newdata)) object$x else if (is.data.frame(newdata)) as.matrix(model.frame(delete.response(terms(object)), :
There are other near singularities as well. 969.08
etc... these go for thousands of lines. Though code still produces output file but I am not certain can it be trusted given this huge amount of warnings. Matrix mode has its own warnings and fatal errors.
I am proficient in Bash/Perl/R coding so I traced this very deep into the code. In the foci mode this part of R code:
lo<-loess(frame$V2 ~ frame$V1, span=i)
generates like bulk of the warnings. Though these seems to be warnings from loess fit.
Minor ones came from is.na(as.numeric(argsL$span))==FALSE which I changed to is.numeric(argsL$span) and that I hope is fine now.
Then in matrix mode:
It gets into serious issues with this part of the code:
values<-seq(1,0.05,-0.01)
span<-c()
wss<-data.frame(matrix(ncol=3,nrow=0))
for(i in values){
if(i*nrow(frame) > 1){
lo<-loess(frame$V2 ~ frame$V1, span=i)
if(is.na(lo$s)==FALSE){
out2<-predict(lo,index)
if(sum(out2<0)==0){
rough<-sd(diff(out2))
new3<-data.frame(i,lo$s,rough)
wss<-rbind(wss,new3)
}
}
}
}
wss<-wss[!is.infinite(rowSums(wss)),]
wss$loscale<-scale(wss$lo.s)
As if i*nrow(frame) > 1 is not TRUE for any i of values it will end up giving zero rows matrix to scale function. And that is error.
Another source of errors was this line:
spanout<-data.frame(argsL$line,span,lo$s,out3$fit[index==0],out3$se[index==0])
As index in my data does not contain 0 in any case so that data.frame cannot be formed with varying length elements.
I am wondering am I doing something wrong here, or is this runnable with some specific older R version. I already tested between 4.3.0 to 3.6.3 and nothing changes, which is not too surprising. Can you please advice a bit, I can fix code yes, but I would rather not rethink this whole calculation as you have made great tool with much of thought. And I just suspect I do something wrong.
I wonder if I give you these few ready bed files, do you have environment where you could test foci and matrix runs with those?
The text was updated successfully, but these errors were encountered: