scripts/export/genomes/genome_fetch.py
def sequence_report_to_json(seq_report_file, dest_dir=None):
    """
    Convert a GCA sequence report file (ENA) from .txt to .json format

    seq_report_file: The path to a valid GCA related sequence report file
    dest_dir: The path to destination directory. If None use the directory
    of the input file

    return: Accession dictionary
    """

    acc_dict = {}
    seq_rep_fp = open(seq_report_file, 'r')

    # discard header line
    seq_rep_fp.readline()

    for line in seq_rep_fp:
        line = line.strip().split('\t')

        acc_dict[line[0]] = {"sequence_name": line[1], "sequence-length": line[2],
                             "sequence-role": line[3], "replicon-name": line[4],
                             "replicon-type": line[5], "assembly-unit": line[6]}
    seq_rep_fp.close()

    if dest_dir is None:
        dest_dir = os.path.split(seq_report_file)[0]

    filename = os.path.basename(seq_report_file).partition(".")[0]
    fp_out = open(os.path.join(dest_dir, filename + ".json"), 'w')
    json.dump(acc_dict, fp_out)
    fp_out.close()

    return acc_dict

    Convert a GCA sequence report file (ENA) from .txt to .json format

    seq_report_file: The path to a valid GCA related sequence report file
    dest_dir: The path to destination directory. If None use the directory
    of the input file

    return: Accession dictionary
    
Convert a GCA sequence report file (ENA) from .txt to .json format
seq_report_file: The path to a valid GCA related sequence report file
dest_dir: The path to destination directory. If None use the directory
of the input file

Accession dictionary
Convert a GCA sequence report file ( ENA ) from . txt to . json format seq_report_file : The path to a valid GCA related sequence report file dest_dir : The path to destination directory . If None use the directory of the input file Accession dictionary
def sequence_report_to_json(seq_report_file, dest_dir=None):
    acc_dict = {}
    seq_rep_fp = open(seq_report_file, 'r')
    seq_rep_fp.readline()
    for line in seq_rep_fp:
        line = line.strip().split('\t')
        acc_dict[line[0]] = {"sequence_name": line[1], "sequence-length": line[2],
                             "sequence-role": line[3], "replicon-name": line[4],
                             "replicon-type": line[5], "assembly-unit": line[6]}
    seq_rep_fp.close()
    if dest_dir is None:
        dest_dir = os.path.split(seq_report_file)[0]
    filename = os.path.basename(seq_report_file).partition(".")[0]
    fp_out = open(os.path.join(dest_dir, filename + ".json"), 'w')
    json.dump(acc_dict, fp_out)
    fp_out.close()
    return acc_dict
def sequence_report_to_json ( seq_report_file , dest_dir = None ) : acc_dict = { } seq_rep_fp = open ( seq_report_file , 'r' ) seq_rep_fp . readline ( ) for line in seq_rep_fp : line = line . strip ( ) . split ( '\t' ) acc_dict [ line [ 0 ] ] = { "sequence_name" : line [ 1 ] , "sequence-length" : line [ 2 ] , "sequence-role" : line [ 3 ] , "replicon-name" : line [ 4 ] , "replicon-type" : line [ 5 ] , "assembly-unit" : line [ 6 ] } seq_rep_fp . close ( ) if dest_dir is None : dest_dir = os . path . split ( seq_report_file ) [ 0 ] filename = os . path . basename ( seq_report_file ) . partition ( "." ) [ 0 ] fp_out = open ( os . path . join ( dest_dir , filename + ".json" ) , 'w' ) json . dump ( acc_dict , fp_out ) fp_out . close ( ) return acc_dict
Convert a GCA sequence report file (ENA) from .txt to .json format
seq_report_file: The path to a valid GCA related sequence report file
dest_dir: The path to destination directory.
Convert a GCA sequence report file ( ENA ) from . txt to . json format seq_report_file : The path to a valid GCA related sequence report file dest_dir : The path to destination directory .
"""
    Convert a GCA sequence report file (ENA) from .txt to .json format

    seq_report_file: The path to a valid GCA related sequence report file
    dest_dir: The path to destination directory. If None use the directory
    of the input file

    return: Accession dictionary
    """ # discard header line
seq_report_file
dest_dir