<p>You can use the following query to first search GEO to get a list of GEO Series of interest, then find all linked SRA runs and perform a second filter step to keep only the SRA runs that satisfy another set of criteria as shown below.</p>
<pre><code>esearch \
  -db gds \
  -query &quot;daf-2[all fields] \
    AND expression profiling by high throughput sequencing [DataSet Type] \
    AND Caenorhabditis elegans [organism]&quot; \
  | elink \
  -db gds -target sra \
  | esearch \
  -query &quot;(#3) \
    AND Caenorhabditis elegans [organism]&quot; \
  | efetch -format runinfo
</code></pre>
<p>Here, I am combining two independent queries using the <code>(#3)</code> term in the second query. More information about this is in the &quot;Combining Independent Queries&quot; subsection of <a href="https://www.ncbi.nlm.nih.gov/books/NBK179288/#_chapter6_Searching_and_Filtering_" rel="nofollow noreferrer">&quot;Searching and Filtering&quot;</a> section of the <a href="https://www.ncbi.nlm.nih.gov/books/NBK179288" rel="nofollow noreferrer">Entrez Direct documentation</a>.</p>

CC BY-SA 4.0
2020-07-20T00:32:58.617Z
could you explain why you have a -db gds with elink?
An Ignorant Wanderer
CC BY-SA 4.0
2020-07-20T11:10:32.357Z
It’s just a habit. If you are piping results from another edirect tool, you don’t need to specify the db. But if you are running elink as a stand-alone command then you need the db.
vkkodali
CC BY-SA 4.0
2020-07-19T23:02:45.117Z
2020-07-19T23:02:45.117Z
vkkodali
<p>I am using the following command to retrieve GEO Datasets entries for daf-2 c. elegans that have as their experiment type High Throughpout sequencing:</p>
<pre><code>esearch -db gds -query &quot;daf-2&quot; | efilter -query &quot;expression profiling by high throughput sequencing [DataSet Type] AND Caenorhabditis elegans [organism]&quot;
</code></pre>
<p>However, among the results that I got, I noticed that I got this:</p>
<pre><code>23. Impaired Insulin-/IGF1-Signaling Extends Life Span by Promoting Mitochondrial L-Proline Catabolism to Induce a Transient ROS-Signal
(Submitter supplied) Transcriptome profiling of three models with impaired insulin/IGF1 signaling. 1. Deep sequencing of endogenous mRNA from Caenorhabditis elegans N2 var. Bristol (wildtype) and daf-2(e1370) mutant; 2. Deep sequencing  of endogenous mRNA from murine embryonic fibroblasts (MEF)  wildtype and irs1-/- knockout; 3. Deep sequencing of endogenous mRNA from murine embryoinic fibroblast (MEF) insr+/- -lox and insr+/- knockout  Jena Centre for Systems Biology of Ageing - JenAge (www.jenage.de)
Organism:   Mus musculus; Caenorhabditis elegans
Type:       Expression profiling by high throughput sequencing
Platforms: GPL11002 GPL13776 14 Samples
FTP download: GEO (CSV) ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE36nnn/GSE36041/
SRA Run Selector: https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA151765
Series      Accession: GSE36041 ID: 200036041
</code></pre>
<p>As you can see, in the <code>Organism</code> field, there are both <code>Mus musculus</code> and <code>Caenorhabditis elegans</code>. How can I restrict my search so that I only get entries that exclusively work on <code>Caenorhabditis elegans</code>? One naive way to do this would be to include <code>NOT Mus Musculus</code> in the query, but of course that would mean that I could get something else too.</p>
<p>Another way I can think of solving this is just to write a script that would do the extra filtering using regexes, but I was wondering if there's a simpler solution using the e-utilities functionalities</p>

CC BY-SA 4.0
2020-07-19T11:36:43.377Z
That particular study was done using both worm and mouse samples. If you are ultimately interested in SRA data, you should just pipe the output of this step to elink and get SRA run table. You can either add an organism filter after that or just subset the run table.
vkkodali
CC BY-SA 4.0
2020-07-19T16:27:59.493Z
@vkkodali but why would filtering from SRA's side be different from filtering from GEO's side?
An Ignorant Wanderer
CC BY-SA 4.0
2020-07-19T16:45:36.863Z
@vkkodali I noticed that it does filter out other organisms, but I just don't understand why filtering from SRA is different from GEO. Also, I'm filtering again by "Expression profiling by high throughput sequencing [DataSet Type]" because of the same issue as with organisms, but when I do this, I get 0 results. Any clue as to why this might be happening?
An Ignorant Wanderer
CC BY-SA 4.0
2020-07-19T17:11:37.100Z
Filtering from SRA would filter it at the run level where as filtering in GEO at the series level will find any series that contain at least one sample that is from worm.
vkkodali
CC BY-SA 4.0
2020-07-19T17:20:49.003Z
@vkkodali I see that makes sense. What about the other filter?
An Ignorant Wanderer
<geoquery>
How can I restrict the search space when querying GEO?
# How can I restrict the search space when querying GEO?

(Asked by: username_0 on 2020-07-18)

I am using the following command to retrieve GEO Datasets entries for daf-2 c. elegans that have as their experiment type High Throughpout sequencing:
esearch -db gds -query "daf-2" | efilter -query "expression profiling by high throughput sequencing [DataSet Type] AND Caenorhabditis elegans [organism]"

However, among the results that I got, I noticed that I got this:
23. Impaired Insulin-/IGF1-Signaling Extends Life Span by Promoting Mitochondrial L-Proline Catabolism to Induce a Transient ROS-Signal
(Submitter supplied) Transcriptome profiling of three models with impaired insulin/IGF1 signaling. 1. Deep sequencing of endogenous mRNA from Caenorhabditis elegans N2 var. Bristol (wildtype) and daf-2(e1370) mutant; 2. Deep sequencing  of endogenous mRNA from murine embryonic fibroblasts (MEF)  wildtype and irs1-/- knockout; 3. Deep sequencing of endogenous mRNA from murine embryoinic fibroblast (MEF) insr+/- -lox and insr+/- knockout  Jena Centre for Systems Biology of Ageing - JenAge (www.jenage.de)
Organism:   Mus musculus; Caenorhabditis elegans
Type:       Expression profiling by high throughput sequencing
Platforms: GPL11002 GPL13776 14 Samples
FTP download: GEO (CSV) ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE36nnn/GSE36041/
SRA Run Selector: https://www.ncbi.nlm.nih.gov/Traces/study/?acc=PRJNA151765
Series      Accession: GSE36041 ID: 200036041

As you can see, in the Organism field, there are both Mus musculus and Caenorhabditis elegans. How can I restrict my search so that I only get entries that exclusively work on Caenorhabditis elegans? One naive way to do this would be to include NOT Mus Musculus in the query, but of course that would mean that I could get something else too.
Another way I can think of solving this is just to write a script that would do the extra filtering using regexes, but I was wondering if there's a simpler solution using the e-utilities functionalities

**Tags:** geoquery
> **Comments:**
> **username_1**: That particular study was done using both worm and mouse samples. If you are ultimately interested in SRA data, you should just pipe the output of this step to elink and get SRA run table. You can either add an organism filter after that or just subset the run table.  
> **username_0**: @vkkodali but why would filtering from SRA's side be different from filtering from GEO's side?  
> **username_0**: @vkkodali I noticed that it does filter out other organisms, but I just don't understand why filtering from SRA is different from GEO. Also, I'm filtering again by "Expression profiling by high throughput sequencing [DataSet Type]" because of the same issue as with organisms, but when I do this, I get 0 results. Any clue as to why this might be happening?  
> **username_1**: Filtering from SRA would filter it at the run level where as filtering in GEO at the series level will find any series that contain at least one sample that is from worm.  
> **username_0**: @vkkodali I see that makes sense. What about the other filter?  

---

## 1 answers

### Answer by username_1 on 2020-07-19. Score: 0 | Accepted answer

You can use the following query to first search GEO to get a list of GEO Series of interest, then find all linked SRA runs and perform a second filter step to keep only the SRA runs that satisfy another set of criteria as shown below.
esearch \
  -db gds \
  -query "daf-2[all fields] \
    AND expression profiling by high throughput sequencing [DataSet Type] \
    AND Caenorhabditis elegans [organism]" \
  | elink \
  -db gds -target sra \
  | esearch \
  -query "(#3) \
    AND Caenorhabditis elegans [organism]" \
  | efetch -format runinfo

Here, I am combining two independent queries using the (#3) term in the second query. More information about this is in the "Combining Independent Queries" subsection of "Searching and Filtering" section of the Entrez Direct documentation.

> **Comments:**
> **username_0**: could you explain why you have a -db gds with elink?  
> **username_1**: It’s just a habit. If you are piping results from another edirect tool, you don’t need to specify the db. But if you are running elink as a stand-alone command then you need the db.  

---

