#!/bin/bash

TOGOID_DIR=/mnt/share/togovar/togovar-data/public/togoid

wget -N  ftp://ftp.ncbi.nlm.nih.gov/pub/lu/PubTatorCentral/mutation2pubtatorcentral.gz 
zcat mutation2pubtatorcentral.gz | cut -f1,3 | sort -k2 > mutation2pubtatorcentral_sorted.txt

grep tgv $TOGOID_DIR/tgvid2dbsnp.tsv | grep rs | sort -k2 > tgvid2dbSNP_sorted.tsv

join -1 2 -2 2 tgvid2dbSNP_sorted.tsv mutation2pubtatorcentral_sorted.txt | cut -d " " -f2,3 | awk '{print $1"\t"$2}'> $TOGOID_DIR/tgvid2pubmed.tsv   
