scripts/export/genomes/genome_fetch.py
def split_and_download(wgs_range, dest_dir):
    """
    Function to split and download smaller segments of large genome assemblies

    wgs_range: A WGS assembly sequence accession range from ENA
    (e.g. CBTL0100000001-CBTL0111673940)
    dest_dir: The path to the destination directory

    returns:  void
    """

    # split the range into separate accessions
    accessions = fetch_wgs_range_accs(wgs_range)

    file_no = len(accessions) / MAX_SEQS
    remainder = len(accessions) % MAX_SEQS

    count = 0
    # indexes
    idx1 = 0
    idx2 = MAX_SEQS
    while count < file_no:
        accession = accessions[idx1] + '-' + accessions[idx2]
        urllib.urlretrieve(ENA_DATA_URL % accession,
                           os.path.join(dest_dir, accession + '.fa'))
        idx1 = idx2 + 1
        idx2 = idx2 + MAX_SEQS

        count += 1

    # check if sequences are not split evenly, and do and extra step for the
    # remaining seqs

    if remainder != 0:
        idx1 = idx1 = idx2 + 1
        # get the last accession
        idx2 = accessions[-1]
        accession = accessions[idx1] + '-' + accessions[idx2]
        urllib.urlretrieve(ENA_DATA_URL % accession,
                           os.path.join(dest_dir, accession + '.fa'))

    Function to split and download smaller segments of large genome assemblies

    wgs_range: A WGS assembly sequence accession range from ENA
    (e.g. CBTL0100000001-CBTL0111673940)
    dest_dir: The path to the destination directory

    returns:  void
    
Function to split and download smaller segments of large genome assemblies
wgs_range: A WGS assembly sequence accession range from ENA

dest_dir: The path to the destination directory

void
Function to split and download smaller segments of large genome assemblies wgs_range : A WGS assembly sequence accession range from ENA dest_dir : The path to the destination directory void
def split_and_download(wgs_range, dest_dir):
    accessions = fetch_wgs_range_accs(wgs_range)
    file_no = len(accessions) / MAX_SEQS
    remainder = len(accessions) % MAX_SEQS
    count = 0
    idx1 = 0
    idx2 = MAX_SEQS
    while count < file_no:
        accession = accessions[idx1] + '-' + accessions[idx2]
        urllib.urlretrieve(ENA_DATA_URL % accession,
                           os.path.join(dest_dir, accession + '.fa'))
        idx1 = idx2 + 1
        idx2 = idx2 + MAX_SEQS
        count += 1
    if remainder != 0:
        idx1 = idx1 = idx2 + 1
        idx2 = accessions[-1]
        accession = accessions[idx1] + '-' + accessions[idx2]
        urllib.urlretrieve(ENA_DATA_URL % accession,
                           os.path.join(dest_dir, accession + '.fa'))
def split_and_download ( wgs_range , dest_dir ) : accessions = fetch_wgs_range_accs ( wgs_range ) file_no = len ( accessions ) / MAX_SEQS remainder = len ( accessions ) % MAX_SEQS count = 0 idx1 = 0 idx2 = MAX_SEQS while count < file_no : accession = accessions [ idx1 ] + '-' + accessions [ idx2 ] urllib . urlretrieve ( ENA_DATA_URL % accession , os . path . join ( dest_dir , accession + '.fa' ) ) idx1 = idx2 + 1 idx2 = idx2 + MAX_SEQS count += 1 if remainder != 0 : idx1 = idx1 = idx2 + 1 idx2 = accessions [ - 1 ] accession = accessions [ idx1 ] + '-' + accessions [ idx2 ] urllib . urlretrieve ( ENA_DATA_URL % accession , os . path . join ( dest_dir , accession + '.fa' ) )
Function to split and download smaller segments of large genome assemblies
wgs_range: A WGS assembly sequence accession range from ENA
(e.g.
Function to split and download smaller segments of large genome assemblies wgs_range : A WGS assembly sequence accession range from ENA ( e . g .
"""
    Function to split and download smaller segments of large genome assemblies

    wgs_range: A WGS assembly sequence accession range from ENA
    (e.g. CBTL0100000001-CBTL0111673940)
    dest_dir: The path to the destination directory

    returns:  void
    """ # split the range into separate accessions # indexes # check if sequences are not split evenly, and do and extra step for the # remaining seqs # get the last accession
wgs_range
dest_dir