if aspera or aspera_settings is not None: aspera = utils.set_aspera(aspera_settings) try: if utils.is_wgs_set(accession): if output_format is not None: sequenceGet.check_format(output_format) sequenceGet.download_wgs(dest_dir, accession, output_format) elif not utils.is_available(accession): sys.stderr.write('ERROR: Record does not exist or is not available for accession provided\n') sys.exit(1) elif utils.is_sequence(accession): if output_format is not None: sequenceGet.check_format(output_format) sequenceGet.download_sequence(dest_dir, accession, output_format, expanded) elif utils.is_analysis(accession): if output_format is not None: readGet.check_read_format(output_format) readGet.download_files(accession, output_format, dest_dir, fetch_index, fetch_meta, aspera) elif utils.is_run(accession) or utils.is_experiment(accession): if output_format is not None: readGet.check_read_format(output_format) readGet.download_files(accession, output_format, dest_dir, fetch_index, fetch_meta, aspera) elif utils.is_assembly(accession): if output_format is not None: assemblyGet.check_format(output_format) assemblyGet.download_assembly(dest_dir, accession, output_format, fetch_wgs, extract_wgs, expanded) else: sys.stderr.write('ERROR: Invalid accession provided\n') sys.exit(1) print 'Completed'
'--version', action='version', version='%(prog)s 1.2') return parser if __name__ == '__main__': parser = set_parser() args = parser.parse_args() accession = args.accession dest_dir = args.dest fetch_meta = args.meta aspera = args.aspera if not utils.is_analysis(accession): print( 'Error: Invalid accession. An analysis accession must be provided') sys.exit(1) if not utils.is_available(accession): print( 'Record does not exist or is not available for accession provided') sys.exit(1) try: readGet.download_files(accession, utils.SUBMITTED_FORMAT, dest_dir, False, fetch_meta, aspera) print('Completed') except Exception: utils.print_error()