예제 #1
0
def write_product(directory, information):

    # Specify directories and files
    path_compartments = directory + 'compartments.pickle'
    path_processes = directory + 'processes.pickle'
    path_reactions = directory + 'reactions.pickle'
    path_metabolites = directory + 'metabolites.pickle'
    path_metabolites_report = directory + 'metabolites.tsv'
    path_reactions_report = directory + 'reactions.tsv'

    # Write information to file.
    with open(path_compartments, 'wb') as file_product:
        pickle.dump(information['compartments'], file_product)
    with open(path_processes, 'wb') as file_product:
        pickle.dump(information['processes'], file_product)
    with open(path_reactions, 'wb') as file_product:
        pickle.dump(information['reactions'], file_product)
    with open(path_metabolites, 'wb') as file_product:
        pickle.dump(information['metabolites'], file_product)

    write_file_table(information=information['metabolites_report'],
                     path_file=path_metabolites_report,
                     names=information['metabolites_report'][0].keys(),
                     delimiter='\t')
    write_file_table(information=information['reactions_report'],
                     path_file=path_reactions_report,
                     names=information['reactions_report'][0].keys(),
                     delimiter='\t')
예제 #2
0
def write_product(directory, information):

    # Specify directories and files
    path_pickle = directory + 'hmdb_summary.pickle'
    path_text = directory + 'hmdb_summary.tsv'

    # Write information to file
    with open(path_pickle, 'wb') as file_product:
        pickle.dump(information['summary_object'], file_product)

    write_file_table(information=information['summary_list'],
                     path_file=path_text,
                     names=information['summary_list'][0].keys(),
                     delimiter='\t')
예제 #3
0
def write_product(directory, information):

    # Specify directories and files
    path_compartments = directory + "compartments.pickle"
    path_processes = directory + "processes.pickle"
    path_reactions = directory + "reactions.pickle"
    path_reactions_summary = directory + "reactions_summary.tsv"
    path_metabolites = directory + "metabolites.pickle"
    path_metabolites_report = directory + "metabolites.tsv"
    path_reactions_report = directory + "reactions.tsv"

    # Write information to file
    with open(path_compartments, "wb") as file_product:
        pickle.dump(information["compartments"], file_product)
    with open(path_processes, "wb") as file_product:
        pickle.dump(information["processes"], file_product)
    with open(path_reactions, "wb") as file_product:
        pickle.dump(information["reactions"], file_product)
    with open(path_metabolites, "wb") as file_product:
        pickle.dump(information["metabolites"], file_product)

    try:
        write_file_table(information=information["metabolites_report"],
                         path_file=path_metabolites_report,
                         names=information["metabolites_report"][0].keys(),
                         delimiter="\t")
        write_file_table(information=information["reactions_report"],
                         path_file=path_reactions_report,
                         names=information["reactions_report"][0].keys(),
                         delimiter="\t")
    except:
        write_file_table(information=information["reactions_summary"],
                         path_file=path_reactions_summary,
                         names=information["reactions_summary"][0].keys(),
                         delimiter="\t")
예제 #4
0
def write_product(directory, information, final_directory):

    # Specify directories and files
    path_dymetabonet = directory + dymetabonet
    final_dymetabonet = final_directory + dymetabonet

    path_compartments = directory + compartment_pickle
    path_processes = directory + process_pickle
    path_reactions = directory + reaction_pickle
    path_metabolites = directory + metabolite_pickle

    path_compartments_text = directory + compartment_file
    path_processes_text = directory + process_file
    path_reactions_text = directory + reaction_file
    path_metabolites_text = directory + metabolite_file

    # Write information to file
    with open(path_dymetabonet, 'w') as file_product:
        json.dump(information['dymetabonet'], file_product)
    with open(final_dymetabonet, 'w') as file_product:
        json.dump(information['dymetabonet'], file_product)

    with open(path_compartments, 'wb') as file_product:
        pickle.dump(information['compartments'], file_product)
    with open(path_processes, 'wb') as file_product:
        pickle.dump(information['processes'], file_product)
    with open(path_reactions, 'wb') as file_product:
        pickle.dump(information['reactions'], file_product)
    with open(path_metabolites, 'wb') as file_product:
        pickle.dump(information['metabolites'], file_product)

    write_file_table(information=information['compartments_text'],
                     path_file=path_compartments_text,
                     names=information['compartments_text'][0].keys(),
                     delimiter='\t')
    write_file_table(information=information['processes_text'],
                     path_file=path_processes_text,
                     names=information['processes_text'][0].keys(),
                     delimiter='\t')
    write_file_table(information=information['reactions_text'],
                     path_file=path_reactions_text,
                     names=information['reactions_text'][0].keys(),
                     delimiter='\t')
    write_file_table(information=information['metabolites_text'],
                     path_file=path_metabolites_text,
                     names=information['metabolites_text'][0].keys(),
                     delimiter='\t')
예제 #5
0
def write_product(
        output,
        information):

    # Specify directories and files
    path_compartments = output + compartment_pickle
    path_processes = output + process_pickle
    path_reactions = output + reaction_pickle
    path_metabolites = output + metabolite_pickle
    path_metabolites_report = output + metabolites_file
    path_reactions_report = output + reactions_file
    path_reactions_filter = output + filtered_reactions_file

    # Write information to file
    with open(path_compartments, 'wb') as file_product:
        pickle.dump(information['compartments'], file_product)
    with open(path_processes, 'wb') as file_product:
        pickle.dump(information['processes'], file_product)
    with open(path_reactions, 'wb') as file_product:
        pickle.dump(information['reactions'], file_product)
    with open(path_metabolites, 'wb') as file_product:
        pickle.dump(information['metabolites'], file_product)

    write_file_table(
        information=information['metabolites_report'],
        path_file=path_metabolites_report,
        names=information['metabolites_report'][0].keys(),
        delimiter='\t')
    write_file_table(
        information=information['reactions_report'],
        path_file=path_reactions_report,
        names=information['reactions_report'][0].keys(),
        delimiter='\t')
    write_file_table(
        information=information['reactions_filter'],
        path_file=path_reactions_filter,
        names=information['reactions_filter'][0].keys(),
        delimiter='\t')