4 from htsworkflow.pipelines.retrieve_config import *
5 from htsworkflow.pipelines import retrieve_config
6 from htsworkflow.pipelines.genome_mapper import getAvailableGenomes
7 from htsworkflow.pipelines.genome_mapper import constructMapperDict
9 #Turn on built-in command-line parsing.
10 retrieve_config.DISABLE_CMDLINE = False
13 #Display help if no args are presented
14 if len(sys.argv) == 1:
17 options = getCombinedOptions()
18 msg_list = ['ERROR MESSAGES:']
19 if options.output_filepath is None:
20 msg_list.append(" Output filepath argument required. -o <filepath> or --output=<filepath>")
22 if options.flowcell is None:
23 msg_list.append(" Flow cell argument required. -f <flowcell> or --flowcell=<flowcell>")
25 if options.url is None:
26 msg_list.append(" URL argument required (-u <url> or --url=<url>), or entry\n" \
27 " in /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf")
28 if options.genome_dir is None:
29 msg_list.append(" genome_dir argument required (-g <genome_dir> or \n" \
30 " --genome_dir=<genome_dir>, or entry in \n" \
31 " /etc/ga_frontend/ga_frontend.conf or ~/.ga_frontend.conf")
34 print '\n'.join(msg_list)
37 saveConfigFile(options.flowcell, options.url, options.output_filepath)
39 f = open(options.output_filepath, 'r')
43 genome_dict = getAvailableGenomes(options.genome_dir)
44 mapper_dict = constructMapperDict(genome_dict)
46 f = open(options.output_filepath, 'w')
47 f.write(data % (mapper_dict))
52 if __name__ == "__main__":
53 logging.basicConfig(level=logging.INFO)
54 sys.exit(main(sys.argv[1:]))