comparison tools/vcf_tools/vcfPytools.py @ 0:9071e359b9a3

Uploaded
author xuebing
date Fri, 09 Mar 2012 19:37:19 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:9071e359b9a3
1 #!/usr/bin/python
2
3 import os.path
4 import sys
5
6 __author__ = "alistair ward"
7 __version__ = "version 0.26"
8 __date__ = "february 2011"
9
10 def main():
11 usage = "Usage: vcfPytools.py [tool] [options]\n\n" + \
12 "Available tools:\n" + \
13 " annotate:\n\tAnnotate the vcf file with membership in other vcf files.\n" + \
14 " extract:\n\tExtract vcf records from a region.\n" + \
15 " filter:\n\tFilter the vcf file.\n" + \
16 " intersect:\n\tGenerate the intersection of two vcf files.\n" + \
17 " merge:\n\tMerge a list of vcf files.\n" + \
18 " multi:\n\tFind the intersections and unique fractions of multiple vcf files.\n" + \
19 " sort:\n\tSort a vcf file.\n" + \
20 " stats:\n\tGenerate statistics from a vcf file.\n" + \
21 " union:\n\tGenerate the union of two vcf files.\n" + \
22 " unique:\n\tGenerate the unique fraction from two vcf files.\n" + \
23 " validate:\n\tValidate the input vcf file.\n\n" + \
24 "vcfPytools.py [tool] --help for information on a specific tool."
25
26 # Determine the requested tool.
27
28 if len(sys.argv) > 1:
29 tool = sys.argv[1]
30 else:
31 print >> sys.stderr, usage
32 exit(1)
33
34 if tool == "annotate":
35 import annotate
36 success = annotate.main()
37 elif tool == "extract":
38 import extract
39 success = extract.main()
40 elif tool == "filter":
41 import filter
42 success = filter.main()
43 elif tool == "intersect":
44 import intersect
45 success = intersect.main()
46 elif tool == "multi":
47 import multi
48 success = multi.main()
49 elif tool == "merge":
50 import merge
51 success = merge.main()
52 elif tool == "sort":
53 import sort
54 success = sort.main()
55 elif tool == "stats":
56 import stats
57 success = stats.main()
58 elif tool == "union":
59 import union
60 success = union.main()
61 elif tool == "unique":
62 import unique
63 success = unique.main()
64 elif tool == "test":
65 import test
66 success = test.main()
67 elif tool == "validate":
68 import validate
69 success = validate.main()
70 elif tool == "--help" or tool == "-h" or tool == "?":
71 print >> sys.stderr, usage
72 else:
73 print >> sys.stderr, "Unknown tool: ",tool
74 print >> sys.stderr, "\n", usage
75 exit(1)
76
77 # If program completed properly, terminate.
78
79 if success == 0: exit(0)
80
81 if __name__ == "__main__":
82 main()