Skip to content

Instantly share code, notes, and snippets.

@sephraim
Created April 28, 2016 00:02
Show Gist options
  • Save sephraim/62a94a5d698e9dea38b9095f450febaf to your computer and use it in GitHub Desktop.
Save sephraim/62a94a5d698e9dea38b9095f450febaf to your computer and use it in GitHub Desktop.
The following script will capitalize all INFO tags and add the prefix "HGMD_" to each tag.
#!/bin/bash
##
# Rename HGMD INFO tags
#
# Example usage:
# ./rename_HGMD_INFO_tags.sh hgmd-hg19.vcf > hg19_HGMD_2015r4.MORL.vcf
##
tags=(
'accession'
'brief'
'hyperlink'
'codon_number'
'comments'
'codon_change'
'genomic_sequence'
'aminoacid_change'
'pmid'
'pmid_notes'
'citation_type'
'hgmd_acc'
'omim'
'rsid'
'hgvs'
'nucleotide_change'
'disease'
'confidence'
'lsdb_source'
'ref'
'alt'
'omim_ref'
'mesh'
'snomedct'
'icd10'
'ensembl_id'
'entrez_gene_id'
'hgnc'
'uniprot_acc'
'mutationType'
'variantType'
'ref'
)
cmd="sed"
for tag in "${tags[@]}"
do
cmd="$cmd -e 's/\([;=[:space:]]\)$tag\([,;=[:space:]]\)/\1HGMD_\U$tag\2/'"
done
eval $cmd $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment