[英]How to suppress RED progress messages that are not warning messages? SOLUTIONS NOT WORKING
I have a script and in that script I am running a command form a package: proteinToGenome() from the ensembldb package.我有一个脚本,在该脚本中,我正在运行来自 ensembldb package 的 package: proteinToGenome() 的命令。
I run the command iteratively using a for () {}
structure, and upon each iteration it will return RED output that is more of "progress" messages that output regardless of the success/failure of the command, not warning messages:我使用for () {}
结构迭代地运行该命令,并且在每次迭代时,它将返回 RED output 更多的是 output 的“进度”消息,而不考虑命令的成功/失败,而不是警告消息:
Checking CDS and protein sequence lengths ... 1/1 OK
Fetching CDS for 1 proteins ... 1 found
or:或者:
Fetching CDS for 1 proteins ... 1 found
Checking CDS and protein sequence lengths ... 0/0 OK
How do I suppress these messages?如何抑制这些消息? Other questions I found do not seem to apply to these and their solutions do not seem to stop these.我发现的其他问题似乎不适用于这些问题,他们的解决方案似乎也无法阻止这些问题。 I have tried all the solutions presented in:我已经尝试了以下所有解决方案:
Suppress output of a function 抑制 function 的 output
I have tired:我累了:
capture.output(for (x in length(DF)) {
OutputDF <- function(DF[x])
})
and:和:
sink(for (x in length(DF)) {
OutputDF <- function(DF[x])
})
also tried:也试过:
hush=function(code){
sink("NUL") # use /dev/null in UNIX
tmp = code
sink()
return(tmp)
}
hush(for (x in length(DF)) {
OutputDF <- function(DF[x])
})
also, the reason I use for and not lapply()
is because I check whether or not the OutputDF
is empty, and take action accordingly using an if(){}else{}
command within the for(){}
loop另外,我使用 for 而不是lapply()
的原因是因为我检查OutputDF
是否为空,并在for(){}
循环中使用if(){}else{}
命令相应地采取措施
How about:怎么样:
suppressMessages(proteinToGenome(...))
Where the arguments you are using in the model replace ...
您在 model 中使用的 arguments 替换...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.