If you want to do things locally, you can make a searchable resource you can query as you like.
1) Get SNPs and write them into a text file sorted by SNP ID.
For hg38
, for instance:
$ LC_ALL=C
$ wget -qO- http://hgdownload.cse.ucsc.edu/goldenpath/hg38/database/snp147.txt.gz \
| gunzip -c \
| awk -v OFS="\t" '{ print $5,$2,$3,($3+1) }' \
| sort -k1,1 \
> hg38.snp147.sortedByName.txt
2) Install pts-line-bisect:
$ git clone https://github.com/pts/pts-line-bisect.git
$ cd pts-line-bisect && make && cd ..
3) Run a query:
$ rs_of_interest=rs2814778
$ ./pts-line-bisect/pts_lbsearch -p hg38.snp147.sortedByName.txt ${rs_of_interest} \
| head -1 \
| cut -f2-
Step 3 can be put into a script so that you can re-run it with your SNP of interest on demand.
For instance:
#!/bin/bash
pts_lbsearch_bin=./pts-line-bisect/pts_lbsearch
sorted_snp_txt=hg38.snp147.sortedByName.txt
${pts_lbsearch_bin} -p ${sorted_snp_txt} $1 | head -1 | cut -f2-
Then:
$ ./search_snps.sh rs2814778
...
Thank you so much. Your advice is very useful.