Mercurial > repos > sanbi-uwc > data_manager_shapeit_reference
comparison data_manager/shapeit_ref.py @ 5:f0c7cab2f547 draft
planemo upload for repository https://github.com/pvanheus/data_manager_shapeit_reference commit 1e78071ffc35990e3ea5846a6cc07e194f886cf0
author | sanbi-uwc |
---|---|
date | Sat, 15 Sep 2018 03:20:01 -0400 |
parents | 094bd0114876 |
children |
comparison
equal
deleted
inserted
replaced
4:094bd0114876 | 5:f0c7cab2f547 |
---|---|
35 parser.add_argument('key', help='Short key to identify this reference set (no spaces)') | 35 parser.add_argument('key', help='Short key to identify this reference set (no spaces)') |
36 parser.add_argument('name', help='Description of reference set') | 36 parser.add_argument('name', help='Description of reference set') |
37 parser.add_argument('path', help='Filesystem path to directory containing this reference set') | 37 parser.add_argument('path', help='Filesystem path to directory containing this reference set') |
38 parser.add_argument('reference_prefix', help='Filename prefix for the reference (.hap / .legend / .sample) files') | 38 parser.add_argument('reference_prefix', help='Filename prefix for the reference (.hap / .legend / .sample) files') |
39 parser.add_argument('map_prefix', help='Filename prefix for map files in this reference set') | 39 parser.add_argument('map_prefix', help='Filename prefix for map files in this reference set') |
40 parser.add_argument('sample_prefix', help='Filename prefix for sample file in this reference set') | |
40 parser.add_argument('output_file', type=argparse.FileType('w'), help='JSON file used to write data manager values to') | 41 parser.add_argument('output_file', type=argparse.FileType('w'), help='JSON file used to write data manager values to') |
41 args = parser.parse_args() | 42 args = parser.parse_args() |
42 | 43 |
43 if not os.path.exists(args.path): | 44 if not os.path.exists(args.path): |
44 exit("Unable to find specified path {}".format(args.path)) | 45 exit("Unable to find specified path {}".format(args.path)) |
45 | 46 |
46 assert_prefix_exists(args.reference_prefix, args.path, 'reference') | 47 assert_prefix_exists(args.reference_prefix, args.path, 'reference') |
47 assert_prefix_exists(args.map_prefix, args.path, 'map') | 48 assert_prefix_exists(args.map_prefix, args.path, 'map') |
49 assert_prefix_exists(args.sample_prefix, args.path, 'sample') | |
48 | 50 |
49 for column in ('key', 'name', 'path', 'reference_prefix', 'map_prefix'): | 51 for column in ('key', 'name', 'path', 'reference_prefix', 'map_prefix', 'sample_prefix'): |
50 value = getattr(args, column) | 52 value = getattr(args, column) |
51 if '\t' in value: | 53 if '\t' in value: |
52 exit("TAB character found in {} argument".format(column)) | 54 exit("TAB character found in {} argument".format(column)) |
53 | 55 |
54 data_manager_dict = {} | 56 data_manager_dict = {} |
55 data_table_entry = dict(value=args.key, name=args.name, path=args.path, | 57 data_table_entry = dict(value=args.key, name=args.name, path=args.path, |
56 reference_prefix=args.reference_prefix, map_prefix=args.map_prefix) | 58 reference_prefix=args.reference_prefix, map_prefix=args.map_prefix, |
59 sample_prefix=args.sample_prefix) | |
57 _add_data_table_entry(data_manager_dict, 'shapeit_ref', data_table_entry) | 60 _add_data_table_entry(data_manager_dict, 'shapeit_ref', data_table_entry) |
58 | 61 |
59 args.output_file.write(json.dumps(data_manager_dict, sort_keys=True) + '\n') | 62 args.output_file.write(json.dumps(data_manager_dict, sort_keys=True) + '\n') |