I am trying to read probes from a dat file, put them in a vector then put the vector into a subset to be able to concatenate more data to it and write it in a CSV file. Here my piece of code:
library(Biobase)
library(affy)
affys <- read.csv("address of my dat file")
affys_vec <- as.vector(affys)[,1]
exprs(eset)[affys_vec,] -> sub.set
write.csv(sub.set,file="subset.csv")
However when I reach to the : exprs(eset)[affys_vec,] -> sub.set
I get the following error message:
** Error in exprs(eset) :
error in evaluating the argument object' in selecting a method for function 'exprs':
Error: object 'eset' not found **
Are there any suggestions please?
Thanks,
pqtm
See the vignette An introduction to Biobase and ExpressionSets available on your computer, once Biobase is installed, as
vignette(package="Biobase", "ExpressionSetIntroduction")
But the idea is that you have created eset by pre-processing some CEL or other vendor-specific files. How you pre-process those depends on what your files are, maybe with affy or oligo or lumi, or from a public repository using a package like ArrayExpress or GEOquery Or perhaps you're using limma and have no need for an expression set.
The Bioconductor web site and mailing list provides a lot more information.
Related
Goal: mas5 normalize data.
Problem: when I try the following R code, I get this
error: unable to find an inherited method for function bg.correct for signature ExpressionFeatureSet, character
I have looked on SO, and found the following: What does this mean: unable to find an inherited method for function ‘A’ for signature ‘"B"’, but I am not exactly sure how to fix my specific problem and use the mas5 function properly. I have also looked at this affy manual but still stuck...
installpkg("affy")
library('affy')
setwd("/Users/er/Desktop/DesktopFolders/DataSets/CD8Helios/Microarray/CELfiles/CEL")
cel_Files <- list.celfiles()
affyRaw <- read.celfiles(cel_Files)
eset <- mas5(affyRaw)
If you are sure that the .cel files were created based on experiments performed on the type of array that works with affy package than you should try this workflow using ReadAffy from affy package.
cel_Files <- list.celfiles()
affyRaw <- affy::ReadAffy(filenames=cel_Files)
eset <- mas5(affyRaw)
However, it might be the case that the affy package is not designed for your array type. Then, you should switch to the oligo and oligoClasses packages and normalize with analogous function rma
cel_Files <- oligoClasses::list.celfiles()
affyRaw <- oligo::read.celfiles(cel_Files)
eset <- oligo::rma(affyRaw)
I tried to run the code in Chapter 7 Data mining with R learning with case study book but I got an error in following line:
rankWorkflows(svm, maxs = TRUE)
The error was:
Error in as.character.default(X[[i]], ...) : no method for coercing
this S4 class to a vector
Then I searched on the internet and found following solution:
importMethodsFrom(GenomicRanges, as.data.frame)
and again again I got a new error:
Error: could not find function "importMethodFrom"
I searched a lot but I got nothing :(
You can try using library(sos) to find the packages where your function is located.
library(sos)
findFn("replaceherewithyourfunction")
Based on the answer of #Bea, there does not seem to be a importMethodsFrom anywhere in R. My guess is you found the call in a NAMESPACE file. Those files have different syntax than normal R scripts.
If you want to load a specific function from an R package (rather than all functions from a package), you can use libraryname::functionname instad of functionname in your code. In your case, replace as.data.frame with GenomicRanges::as.data.frame
If this does not work (for example because you don't have as.data.frame anywhere in your code), you can also load the whole GenomicRanges library with library(GenomicRanges)
I have a lot of .net files, and the package tutorial says it is possible to use this format with sna.
My error message is:
> Error in FUN(X[[1L]], ...) : as.edgelist.sna input must be an
> adjacency matrix/array, edgelist matrix, network, or sparse matrix, or
> list thereof.
How can I open .net files with sna package in R? I browsed the net but I couldn't find any helpful information to my problem.
I have no problem with using package igraph, but there are some pros to use package sna, too.
Thank you in advance.
P.S. I tried to read pajek with library(network):
b1<- read.paj("15.net")
Warning message:
In readLines(file, 1, ok = TRUE) : incomplete final line found on '15.net'
If it works with 'igraph', do it with 'igraph'. Then convert the data to a form acceptable by functions in the 'sna' package. For example with asNetwork function from package 'intergraph' you can convert igraph object to a network object (package 'network'), which you can use with 'sna'.
I try to load a .mat file using the R.matlab library. When I run:
x <- readMat("MPL.mat")
I get this error however.
Error in mat5ReadTag(this) :
Unknown data type. Not in range [1,19]: 18569
In addition: Warning message:
In readMat5Header(this, firstFourBytes = firstFourBytes) :
Unknown MAT version tag: 512. Will assume version 5.
Anybody who experienced this and has a way to deal with this?
Im familiar with this post: R.matlab/readMat : Error in readTag(this) but alternatives ways didnt work for me...
The problem is related to how is saved your "MPL.mat". If you save by default in MATLAB, it probably won't work using R.matlab in R.
When I saved my .mat object in '-v7' or '-v6' i did not have problems, but the R.matlab documentation suggest to save in '-v6' (Pag.25 in R.matlab package). For example, I saved 2 matrices (A and B) in 'MPL.mat'.
save('MPL.mat','A', 'B', '-v7')
I could read in R:
require(R.matlab)
data <- readMat("MPL.mat")
View(data$A)
View(data$B)
I'm having trouble locating the packages for corhelp in R. This is what I get.
AdjMatHARD=abs(corhelp[restConnectivity,restConnectivity])>0.65+0.0
# Error: object 'corhelp' not found
Assuming you're following the code from YEAST
Gene Co-expression Network Analysis R Tutorial, corhelp is a variable defined in the code
corhelp=cor(datExpr,use="pairwise.complete.obs")
just search that page for corhelp to find it.