''' Copyright (C) 2021 Sagar Acharya This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . ''' # python vcf_to_tsv.py foo.vcf import os, sys names = sys.argv[1:] if len(names)!=1: print("Please input only 1 argument, vcf filename") sys.exit() os.chdir(os.getcwd()) a = os.popen("cat " + names[0] + " | grep -A1 'FN:'").read() a = a.split('--') a = [x.strip('\n').replace('\nTEL;CELL:', '\t').strip('FN:') for x in a] a = [x.replace('-', '') for x in a] with open("contacts.tsv", 'w') as f: for i in a: f.write(i+'\n')