argparse is a much friendlier argument parser than getopt; see the various khmer scripts for examples.
'lines = open(r1, "r" ).readlines()' reads entire file into memory, and then iterates over it. You can replace that and the following for loop with
for line in open(r1):
...
You can also use 'if line.startswith('#'): continue' to skip commented out lines.
Can you refactor and then I'll go through it again? Also, could you check in some example vcf files together with expected output, so I can try running it? thanks!
A few comments on your script --
argparse is a much friendlier argument parser than getopt; see the various khmer scripts for examples.
'lines = open(r1, "r" ).readlines()' reads entire file into memory, and then iterates over it. You can replace that and the following for loop with
for line in open(r1): ...
You can also use 'if line.startswith('#'): continue' to skip commented out lines.
Can you refactor and then I'll go through it again? Also, could you check in some example vcf files together with expected output, so I can try running it? thanks!