# Build a Pubmed query given long gene list

I would like to search the literature using the Pubmed search engine for a set of genes that are associated with a brain region of interest. Unfortunately, there are a lot of them. It's possible there is no solution if there is a character limit on the query. I think it would be easiest to do this with 'nix tools but I'm open to R libraries or Python implementations too.

The list is 908 genes long. It's from the Gensat annotation search engine, with the filters Structure IS olfactory bulb & Expression level IS moderate to strong signal & Expression pattern IS region-specific.

The list looks like, scraped from the dropdown list in the HTML source with a regular expression:

Aatf
Abcb1b
Abhd3
Abhd4
Abhd5
...

The Pubmed query should look like:

(((((((Aatf) OR Abcb1b) OR Abhd3) OR Abhd4) OR Abhd5) OR Abl2) AND olfactory bulb

but with 908 genes separated by OR and parentheses.

Bonus points if you find/write a utility which adds gene synonyms to the query!

• Perhaps you could get help on academia.stackexchange.com better than here. But what do you expect from such a long query? Could it work for you to search this geneset/pathway on a pathway database and find the associated literature? – llrs Nov 5 '18 at 16:47
• Mainly to subset the papers which may be relevant to these genes in the context of this tissue, then to manually comb through them to identify cell types they might be associated with. – Kohl Kinning Nov 5 '18 at 16:50
• Then your f"final" objective is to find which cell lines are associated with this genes? Edit the question to add this it might be someone knows a database of cell lines or something alike – llrs Nov 5 '18 at 16:56
• That is out of the scope of my question. The goal is manual verification of cell types from sources in the literature. I do appreciate that there may be alternative solutions with databases already annotated. – Kohl Kinning Nov 5 '18 at 17:17

After getting it out on paper (so to speak) I was able to accomplish what I wished with bash:

#!/bin/bash

gene_list=($$(cat ./markers_clean.txt)) query=$${gene_list[@]:0:1}
parens="("
for gene in $${gene_list[@]:1} do query="$${query} OR $${gene})" parens="$${parens}("
done
echo "$${parens}$${query} AND olfactory bulb)"

With the output being: