Using [EntrezDirect][1] directly instead of via Python:

$ esearch -db gene -query "human [orgn]" | efetch -format tabular | awk -F "t" '{OFS="t"}{print $6,$3}'
Symbol GeneID
LOC120893160 120893160
LOC120893158 120893158
LOC120893156 120893156
LOC120893154 120893154
LOC120893152 120893152
LOC120893150 120893150
LOC120893148 120893148
LOC120893146 120893146
LOC120893144 120893144

To get only `live` entries that don't have `LOC` in the name. (Remove part from `grep` on to get them all).

$ esearch -db gene -query "human [orgn]" | efetch -format tabular | awk -F "t" '{OFS="t"}{if ($5 == "live") print $6,$3}' | grep -v "LOC" | head -10
SLC17A6-DT 120883619
TTC12-DT 120883617
TPBGL-AS1 120883615
PATL1-DT 120883613
TP53 7157
IGSF22-AS1 120883618
EMSY-DT 120883616
CCDC90B-AS1 120883614
EGFR 1956
TNF 7124

[1]: bit.ly/entrez-direct



Source link