3 from htsworkflow.pipelines.retrieve_config import *
4 from htsworkflow.pipelines import retrieve_config
5 from htsworkflow.pipelines.genome_mapper import getAvailableGenomes
6 from htsworkflow.pipelines.genome_mapper import constructMapperDict
8 #Turn on built-in command-line parsing.
9 retrieve_config.DISABLE_CMDLINE = False
12 #Display help if no args are presented
13 if len(sys.argv) == 1:
16 options = getCombinedOptions()
17 msg_list = ['ERROR MESSAGES:']
18 if options.output_filepath is None:
19 msg_list.append(" Output filepath argument required. -o <filepath> or --output=<filepath>")
21 if options.flowcell is None:
22 msg_list.append(" Flow cell argument required. -f <flowcell> or --flowcell=<flowcell>")
24 if options.url is None:
25 msg_list.append(" URL argument required (-u <url> or --url=<url>), or entry\n" \
26 " in /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf")
27 if options.genome_dir is None:
28 msg_list.append(" genome_dir argument required (-g <genome_dir> or \n" \
29 " --genome_dir=<genome_dir>, or entry in \n" \
30 " /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf")
33 print '\n'.join(msg_list)
36 saveConfigFile(options.flowcell, options.url, options.output_filepath)
38 f = open(options.output_filepath, 'r')
42 genome_dict = getAvailableGenomes(options.genome_dir)
43 mapper_dict = constructMapperDict(genome_dict)
45 f = open(options.output_filepath, 'w')
46 f.write(data % (mapper_dict))
51 if __name__ == "__main__":
52 sys.exit(main(sys.argv[1:]))