def download_data(group, data_accession, output_format, group_dir, fetch_wgs, extract_wgs, expanded, fetch_meta, fetch_index, aspera): if group == utils.WGS: print 'Fetching ' + data_accession[:6] sequenceGet.download_wgs(group_dir, data_accession[:6], output_format) else: print 'Fetching ' + data_accession if group == utils.ASSEMBLY: assemblyGet.download_assembly(group_dir, data_accession, output_format, fetch_wgs, extract_wgs, expanded, True) elif group in [utils.READ, utils.ANALYSIS]: readGet.download_files(data_accession, output_format, group_dir, fetch_index, fetch_meta, aspera)
def download_data(group, data_accession, format, group_dir, fetch_wgs, fetch_meta, fetch_index, aspera): if group == utils.WGS: print ('Fetching ' + data_accession[:6]) if aspera: print ('Aspera not supported for WGS data. Using FTP...') sequenceGet.download_wgs(group_dir, data_accession[:6], format) else: print ('Fetching ' + data_accession) if group == utils.ASSEMBLY: if aspera: print ('Aspera not supported for assembly data. Using FTP...') assemblyGet.download_assembly(group_dir, data_accession, format, fetch_wgs, True) elif group in [utils.READ, utils.ANALYSIS]: readGet.download_files(data_accession, format, group_dir, fetch_index, fetch_meta, aspera)
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' except Exception: traceback.print_exc() utils.print_error() sys.exit(1)
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) 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) else: sys.stderr.write('ERROR: Invalid accession provided\n') sys.exit(1) print('Completed') except Exception: utils.print_error() sys.exit(1)