Query Commands

  -url         Sends query with HTTP POST
  -get         Uses HTTP GET instead of POST

  -len         Content length of HTTP file

FTP Commands

  -lst         Lists contents of FTP site
  -dir         FTP listing with file sizes

  -ftp         Retrieves data from FTP site

File Downloads

  -dwn         Downloads FTP data to file
  -asp         Uses Aspera download, if configured

-url Shortcuts

  -ncbi        https://www.ncbi.nlm.nih.gov
  -eutils      https://eutils.ncbi.nlm.nih.gov/entrez/eutils
  -pubchem     https://pubchem.ncbi.nlm.nih.gov
  -pugrest     https://pubchem.ncbi.nlm.nih.gov/rest/pug
  -pugview     https://pubchem.ncbi.nlm.nih.gov/rest/pug_view
  -datasets    https://api.ncbi.nlm.nih.gov/datasets/v2alpha

Examples

  nquire -url https://eutils.ncbi.nlm.nih.gov/entrez/eutils/einfo.fcgi |
  xtract -pattern DbList -sep "\n" -element DbName | sort -f

  nquire -url https://eutils.ncbi.nlm.nih.gov entrez/eutils elink.fcgi \
    -dbfrom pubmed -db pubmed -cmd neighbor -linkname pubmed_pubmed -id 2539356 |
  transmute -format

  nquire -eutils esearch.fcgi -db pubmed -term "tn3 transposition immunity" |
  xtract -pattern eSearchResult -element QueryTranslation

  nquire -get https://icite.od.nih.gov/api/pubs -pmids 1937004 10838572 |
  transmute -j2x |
  xtract -pattern opt -element cited_by references |
  accn-at-a-time

  nquire -get "http://collections.mnh.si.edu/services/resolver/resolver.php" \
    -voucher "Birds:625456" |
  xtract -pattern Result -element ScientificName Country

  nquire -get http://w1.weather.gov/xml/current_obs/KSFO.xml |
  xtract -pattern current_observation -tab "\n" \
    -element weather temp_f wind_dir wind_mph

  nquire -get https://api.bigdatacloud.net/data/reverse-geocode-client \
    -latitude 41.7909 -longitude "\-87.5994" |
  transmute -j2x |
  xtract -pattern opt -element countryCode \
    -block administrative -if description -starts-with "state " -element name \
    -block administrative -if description -starts-with "city " -element name |
  tr '\t' '\n'

  nquire -get https://rest.ensembl.org/sequence/id/ENSAPLG00000012763 \
    -content-type application/json

  nquire -get http://mygene.info/v3 query -q 'symbol:OPN1MW AND taxid:9606' \
    -fetch_all TRUE |
  xtract -pattern hits -element _id

  nquire -url http://mygene.info/v3 gene -ids 2652 -fields pathway.wikipathways \
    -always_list pathway.wikipathways |
  xtract -pattern anon -path pathway.wikipathways.id -tab "\n" -element "id"

  nquire -ftp ftp.ncbi.nlm.nih.gov pub/gdp ideogram_9606_GCF_000001305.14_850_V1 |
  grep acen | cut -f 1,2,6,7 | awk '/^X\t/'

  nquire -lst ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools/converters/by_program/

  nquire -lst ftp://nlmpubs.nlm.nih.gov online/mesh/MESH_FILES/xmlmesh

  nquire -dwn ftp.nlm.nih.gov online/mesh/MESH_FILES/xmlmesh desc2021.zip

  nquire -dwn ftp.ncbi.nlm.nih.gov asn1-converters by_program asn2flat mac.asn2flat.gz

  for sect in baseline updatefiles
  do
    nquire -lst ftp.ncbi.nlm.nih.gov pubmed "$sect" |
    grep -v ".md5" | grep "xml.gz" |
    skip-if-file-exists | tee /dev/tty |
    nquire -asp ftp.ncbi.nlm.nih.gov pubmed "$sect"
  done

  nquire -raw -get http://golr-aux.geneontology.io/solr/select \
    -fq document_category:\"ontology_class\" -q *:* -fq id:\"GO:0030182\" \
    -wt json |
  transmute -j2x |
  xtract -pattern opt -element neighborhood_limited_graph_json topology_graph_json |
  transmute -j2x |
  xtract -pattern opt -num nodes edges

  nquire -pugrest compound name catechol cids TXT

  nquire -pugrest compound smiles description XML \
    -smiles "C1=CC=C(C(=C1)O)O" |
  xtract -pattern Information -element Title

  nquire -pugrest compound inchi synonyms TXT \
    -inchi "1S/C6H6O2/c7-5-3-1-2-4-6(5)8/h1-4,7-8H"

  nquire -pugrest compound inchikey cids JSON \
    -inchikey "YCIMNLLNPGFGHC-UHFFFAOYSA-N"

  nquire -pugrest compound/fastsubstructure/smarts/cids/XML \
    -smarts "[#7]-[#6]-1=[#6]-[#6](C#C)=[#6](-[#6]-[#8])-[#6]=[#6]-1" \
    -list_return listkey |
  nquire -puglist |
  efetch -format docsum

  nquire -pugrest compound superstructure cid 2244 XML |
  nquire -pugwait

  nquire -pugview data compound 289 XML -heading "Substances by Category"

  nquire -get https://pubmed.ncbi.nlm.nih.gov/api/citmatch -method heuristic \
    -raw-text "nucleotide+sequences+required+for+tn3+transposition+immunity"

Integrated Shortcuts

  nquire -litvar rs11549407

  nquire -pathway Reactome:R-HSA-70171

  nquire -gene-to-pathway 1956

  nquire -citmatch "nucleotide sequences required for tn3 transposition immunity"

NCBI Datasets Shortcuts

 Gene

  nquire -datasets gene accession NM_020107.5,NP_001334352.2 |
  xtract -pattern reports -element gene_id query symbol description

  nquire -datasets gene id 2652,3043 | json2xml

  nquire -datasets gene id 2652 orthologs

  nquire -datasets gene id 2652,3043 links

  nquire -datasets gene id 2562,3043 download > pair.zip

  nquire -datasets gene id 2562,3043 download - | jsonl2xml

  nquire -datasets gene id 2562,3043 download_summary

  nquire -datasets gene symbol CFTR,HBB,HFE,IL9R,MT-ATP6,PRNP taxon human |
  xtract -pattern reports -sort symbol |
  xtract -pattern reports -if gene/type -is-not PSEUDO -def "-" \
    -element symbol -sep "," -element chromosomes \
    -rst -first genomic_range/orientation |
  align-columns -g 4

  nquire -datasets gene taxon 9606

  nquire -datasets gene taxon human counts

 Genome

  nquire -datasets genome accession GCF_000001405 dataset_report

  nquire -datasets genome accession GCF_000001405 links

  nquire -datasets genome bioproject PRJEB33226 dataset_report

 Virus

  nquire -datasets virus accession NC_063383.1 check

  nquire -datasets virus accession NC_063383.1 annotation_report

  nquire -datasets virus accession NC_063383.1 dataset_report

  nquire -datasets virus accession NC_063383.1,NC_045512.2 genome download > pair.zip

 Taxonomy

  nquire -datasets taxonomy taxon 9606,10090 

NCBI Datasets POST Queries

 echo 2652,3043 |

  nquire -datasets gene

  nquire -datasets gene links

  nquire -datasets gene download > pair.zip

 echo 2652 |

  nquire -datasets gene download_summary

 echo NC_063383.1,NC_045512.2 |

  nquire -datasets virus genome download > pair.zip
