error unused argument for gene_ontology function - r

I am trying to perform a gene ontology analysis in R and I got this error;
Error in get_ontology(x, name = paste("Cluster", names(df.list[i]), "Pathways_for_kmeans_cluster", :
unused argument (name = paste("Cluster", names(df.list[i]), "Pathways_for_kmeans_cluster", j, sep = "_"))
after I run this script:
numclus <- sort(unique(df.list[[i]]$kmeans.cluster))
subdirname <- paste("D:/Master jaar 1/RP1/RP1 projects/Aged macrophage characterisation/Single cell sequencing/nieuwe stuff", "/top100_genes_from_", names(df.list[i]), "_pathways_from_kmeans_clusters", sep = " ")
dir.create(subdirname, showWarnings = FALSE)
install.packages("ontologyPlot")
for (j in numclus){
x <- data.frame(gene = rownames(df.list[[i]][which(df.list[[i]]$kmeans.cluster == j),]), avg_logFC = 0)}
if(nrow(x)>10){
get_ontology(x, name = paste("Cluster", names(df.list[i]), "Pathways_for_kmeans_cluster", j, sep = "_"), return.data = F, outdir = subdirname, full_GSEA = F)
}
}
I get the error after the line with get_ontology

It's telling you that get_ontology doesn't have an argument called name. You haven't told us which packages you're using, so I can't help you further, but you might get somewhere by loooking at the online help.

Related

Error in svd(X, nu = 0L) : infinite or missing values in 'x'

I am currentry working with some kind of data analysis by R studio.
My project code is something like this:
library(Momocs)
library(geomorph)
CharredCoords <- list.files("C:\\Users\\grain_coords_mod", full.names = TRUE)
CharredFrame <- read.csv("C:\\Users\\data_matrix_new_mod.csv", header = TRUE)
CharredTxt <- import_txt(CharredCoords, fileEncoding="UTF-8-BOM")
CharredOut <- Out(CharredTxt, fac=CharredFrame)
CharredOut1 <-coo_scale (CharredOut)
CharredOut.l <- filter(CharredOut1, View == "l")
CharredOut.d <- filter(CharredOut1, View == "d")
CharredOut.l.efour <- efourier(CharredOut.l, nb.h=8, norm = FALSE, start = TRUE)
CharredOut.d.efour <- efourier(CharredOut.d, nb.h=8, norm = FALSE, start = TRUE)
Till its okay... Then after when I execute the following line, error occurs
CharredOut.l %>% chop(~View) %>% lapply(efourier,nb.h=8, norm = FALSE, start = FALSE) %>% combine %>% LDA ('G_Variety', scale=FALSE, center= TRUE)
Output: Error in svd(X, nu = 0L) : infinite or missing values in 'x'
In addition: Warning message:
In lda.default(x, grouping, ...) : variables are collinear
Looking for some suggestion like what I suppose to do or check to solve that isuue.
Thanks in advance.`enter image description here
Code should be render for further ploting procedure.

When using the gdcRNAtools package in R, how can I fix the error "line 2 did not have 9 element"?

This error occurred repeatedly while attempting to use the function "gdcRNAmerge" from the package "gdcRNAtools." Several solutions have been proposed, but the problem persists. I would appreciate it if anyone could assist me in resolving this matter. The error message is: Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 2 did not have 9 element)
Below are the codes I used:
BiocManager::install("GDCRNATools")
library(GDCRNATools)
project <- 'TCGA-STAD'
rnadir <- paste(project, 'RNAseq', sep='/')
gdcRNADownload(project.id = 'TCGA-STAD',
data.type = 'RNAseq',
write.manifest = FALSE,
method = 'gdc-client',
directory = rnadir)
metaMatrix.RNA <- gdcParseMetadata(project.id = 'TCGA-STAD',
data.type = 'RNAseq',
write.meta = FALSE)
table(metaMatrix.RNA$sample_type)
table(metaMatrix.RNA$gender)
metaMatrix.RNA <- gdcFilterDuplicate(metaMatrix.RNA)
metaMatrix.RNA <- gdcFilterSampleType(metaMatrix.RNA)
table(metaMatrix.RNA$sample_type)
rnaCounts <- gdcRNAMerge(metadata = metaMatrix.RNA,
path = rnadir,
organized = FALSE,
data.type = 'RNAseq')

problems with UDpipe models

I'm trying to implement a sentiment analysis study on data extracted from Twitter, with R.
I am using the udpipe library
when I write
udpipe_dowload_model("model")
model< <- udpipe_load_model("directory)
out <- as.data.frame(udpipe_annotate(object, x, doc_id,...)
and I run, an exception is raised:
Error in udp_tokenise_tag_parse(object$model, x, doc_id, tokenizer, tagger, :
external pointer is not valid
the relative traceback is:
4.
stop(structure(list(message = "external pointer is not valid",
call = udp_tokenise_tag_parse(object$model, x, doc_id, tokenizer,
tagger, parser, log_every, log_now), cppstack = structure(list(
file = "", line = -1L, stack = c("1 udpipe.so 0x0000000117ba907e _ZN4Rcpp9exceptionC2EPKcb + 222", ...
3.
udp_tokenise_tag_parse(object$model, x, doc_id, tokenizer, tagger,
parser, log_every, log_now)
2.
udpipe_annotate(model, x = x, doc_id = doc_id, trace = F) at textAnalysisFunct.R#221
1.
lemmaUDP(x = twt$text_clean, model = modelI, doc_id = twt$doc_id,
stopw = tm::stopwords("italian"), userstopw = mystop)
then I started to debug and on the console appeared:
Error during wrapup: external pointer is not valid
the function lemmaUDP was created by my teacher, if useful I paste here its definition as well, but is the same as if done manually
lemmaUDP <- function(x = NULL,
model = NULL,
doc_id = NULL,
stopw = tm::stopwords("italian"),
userstopw=NULL){
require(udpipe)
if(is.null(x)){message("manca vettore testi");return()}
if(is.null(model)){message("manca modello");return()}
if(class(x) != "character"){message("il vettore x non รจ di tipo testo");return()}
if(class(model) != "udpipe_model"){message("modello non valido");return()}
if(is.null(doc_id)){doc_id <- 1:length(x)}
if(!is.null(userstopw)){
stopw <- c(stopw,userstopw)
}
xx <- udpipe_annotate(model, x = x, doc_id = doc_id,trace = F)
xx <- as.data.frame(xx)
xx$STOP <- ifelse(xx$lemma %in% stopw | xx$token %in% stopw,TRUE,FALSE)
return(xx)
}

Error when doing power spectrum analysis in R

I am trying to do a spectral density analysis with ozone data but have run into the error:
Error in ts(tser, frequency = x.fsamp, start = x.start) : 'ts'
object must have one or more observations
I am not sure what the problem is because it sounds like it is having a problem with the number of entries in the file but the file is certainly not empty. What could be causing this problem? The code is as follows:
library(openair)
library(psd)
filedir <-"C:/Users/dfmcg/Documents/Thesis files/ALL_GPMP_O3_Met"
myfiles <-c(list.files(path = filedir))
paste(filedir,myfiles,sep = '/')
npsfiles<-c(paste(filedir,myfiles,sep = '/'))
for (i in npsfiles[1:3]){
x <- substr(i,55,61)
y<-paste(paste('C:/Users/dfmcg/Documents/Thesis files/nps images',x,sep='/'), '.png', sep='')
png(filename = y)
timeozone<-import(i,date="DATE",date.format = "%m/%d/%Y %H",header=TRUE,na.strings="-999")
psdcore(timeozone, ntaper = ,
na.action = "-999", plot = TRUE,
refresh = TRUE)
dev()
}

Unused arguments in R error

I am new to R , I am trying to run example which is given in "rebmix-help pdf". It use galaxy dataset and here is the code
library(rebmix)
devAskNewPage(ask = TRUE)
data("galaxy")
write.table(galaxy, file = "galaxy.txt", sep = "\t",eol = "\n", row.names = FALSE, col.names = FALSE)
REBMIX <- array(list(NULL), c(3, 3, 3))
Table <- NULL
Preprocessing <- c("histogram", "Parzen window", "k-nearest neighbour")
InformationCriterion <- c("AIC", "BIC", "CLC")
pdf <- c("normal", "lognormal", "Weibull")
K <- list(7:20, 7:20, 2:10)
for (i in 1:3) {
for (j in 1:3) {
for (k in 1:3) {
REBMIX[[i, j, k]] <- REBMIX(Dataset = "galaxy.txt",
Preprocessing = Preprocessing[k], D = 0.0025,
cmax = 12, InformationCriterion = InformationCriterion[j],
pdf = pdf[i], K = K[[k]])
if (is.null(Table))
Table <- REBMIX[[i, j, k]]$summary
else Table <- merge(Table, REBMIX[[i, j,k]]$summary, all = TRUE, sort = FALSE)
}
}
}
It is giving me error ERROR:
unused argument (InformationCriterion = InformationCriterion[j])
Plz help
I'm running R 3.0.2 (Windows) and the library rebmix defines a function REBMIX where InformationCriterion is not listed as a named argument, but Criterion.
Brief invoke REBMIX as :
REBMIX[[i, j, k]] <- REBMIX(Dataset = "galaxy.txt",
Preprocessing = Preprocessing[k], D = 0.0025,
cmax = 12, Criterion = InformationCriterion[j],
pdf = pdf[i], K = K[[k]])
It looks as though there have been substantial changes to the rebmix package since the example mentioned in the OP was created. Among the most noticable changes is the use of S4 classes.
There's also an updated demo in the rebmix package using the galaxy data (see demo("rebmix.galaxy"))
To get the above example to produce results (Note: I am not familiar with this package or the rebmix algorithm!!!):
Change the argument to Criterion as mentioned by #Giupo
Use the S4 slot access operator # instead of $
Don't name the results object REDMIX because that's already the function name
library(rebmix)
data("galaxy")
## Don't re-name the REBMIX object!
myREBMIX <- array(list(NULL), c(3, 3, 3))
Table <- NULL
Preprocessing <- c("histogram", "Parzen window", "k-nearest neighbour")
InformationCriterion <- c("AIC", "BIC", "CLC")
pdf <- c("normal", "lognormal", "Weibull")
K <- list(7:20, 7:20, 2:10)
for (i in 1:3) {
for (j in 1:3) {
for (k in 1:3) {
myREBMIX[[i, j, k]] <- REBMIX(Dataset = list(galaxy),
Preprocessing = Preprocessing[k], D = 0.0025,
cmax = 12, Criterion = InformationCriterion[j],
pdf = pdf[i], K = K[[k]])
if (is.null(Table)) {
Table <- myREBMIX[[i, j, k]]#summary
} else {
Table <- merge(Table, myREBMIX[[i, j,k]]#summary, all = TRUE, sort = FALSE)
}
}
}
}
I guess this is late. But I encountered a similar problem just a few minutes ago. And I realized the real scenario that you may face when you got this kind of error msg... It's just the version conflict.
You may use a different version of the R package from the tutorial, thus the argument names could be different between what you are running and what the real code use.
So please check the version first before you try to manually edit the file. Also, it happens that your old version package is still in the path and it overrides the new one. This was exactly what I had... since I manually installed the old and new version separately...

Resources