iam not able to do retrive data using GEOquery R package
1
0
Entering edit mode
@5d72c723
Last seen 7 hours ago
India
# Install GEOquery if you haven't already
> if (!requireNamespace("GEOquery", quietly = TRUE)) {
+     if (!requireNamespace("BiocManager", quietly = TRUE)) {
+         install.packages("BiocManager")
+     }
+     BiocManager::install("GEOquery")
+ }
> 
> library(GEOquery)
> 
> search_GEO_series <- function(keywords, organism, source, sample_type, molecule, library_strategy) {
+     query <- paste(keywords, collapse = " OR ")
+     term <- paste0("(", query, ") AND ", organism, " AND ", source, " AND ", sample_type, " AND ", molecule, " AND ", library_strategy, " AND GSE[ETYP]")
+     
+     # Use the getGEO function to fetch the search results
+     search_results <- getGEO(term, GSEMatrix = FALSE)
+     
+     # Extract GSE IDs from the search results
+     gse_ids <- sapply(search_results, function(result) {
+         header <- Meta(result)
+         return(header$geo_accession)
+     })
+     
+     return(unique(gse_ids))
+ }
> 
> keywords <- c("RNA-Seq", "transcriptome sequencing")
> organism <- "Homo sapiens"
> source <- "T cells AND CD4 AND CD8"
> sample_type <- "SRA"
> molecule <- "RNA"
> library_strategy <- "RNA-seq"
> 
> gse_ids <- search_GEO_series(keywords, organism, source, sample_type, molecule, library_strategy)
Error in getGEOfile(GEO, destdir = destdir, AnnotGPL = AnnotGPL) : 
  object 'destfile' not found
>

how many times ever i run this code iam not able to get a result. iam completely new to coding and R. SO i would be glad if someone could help.

HELP • 61 views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 3 hours ago
United States

Before you try to use a function, you should read the help page to ensure that you are using the correct argument type. As an example, here is the help page for getGEO

getGEO                package:GEOquery                 R Documentation

Get a GEO object from NCBI or file

Description:

     This function is the main user-level function in the GEOquery
     package.  It directs the download (if no filename is specified)
     and parsing of a GEO SOFT format file into an R data structure
     specifically designed to make access to each of the important
     parts of the GEO SOFT format easily accessible.

Usage:

     getGEO(
       GEO = NULL,
       filename = NULL,
       destdir = tempdir(),
       GSElimits = NULL,
       GSEMatrix = TRUE,
       AnnotGPL = FALSE,
       getGPL = TRUE,
       parseCharacteristics = TRUE
     )

Arguments:

     GEO: A character string representing a GEO object for download and
          parsing.  (eg., 'GDS505','GSE2','GSM2','GPL96')

Please note that there is nothing in the help page for the 'GEO' argument that includes any type of free-form search query - it expects an actual GEO ID of some sort. You should not expect that what you are doing should work. It almost appears that you have been reading the help for NCBI's eutils function and are hoping you can just do the same using GEOquery. If so, you should stick with eutils.

0
Entering edit mode

Another alternative is to use the GEOmetadb package (vignette here), which will allow you to make queries to identify GEO datasets that fulfill a set of criteria.

ADD REPLY

Login before adding your answer.

Traffic: 605 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6