def write_product(directory=None, information=None): """ Writes product information to file arguments: directory (str): directory for product files information (object): information to write to file raises: returns: """ # Specify directories and files. path = os.path.join(directory, "network") utility.confirm_path_directory(path) path_nodes_reactions = os.path.join(path, "nodes_reactions.pickle") path_nodes_metabolites = os.path.join(path, "nodes_metabolites.pickle") path_links = os.path.join(path, "links.pickle") # Write information to file. with open(path_nodes_reactions, "wb") as file_product: pickle.dump(information["nodes_reactions"], file_product) with open(path_nodes_metabolites, "wb") as file_product: pickle.dump(information["nodes_metabolites"], file_product) with open(path_links, "wb") as file_product: pickle.dump(information["links"], file_product)
def write_product(directory=None, information=None): """ Writes product information to file arguments: directory (str): directory for product files information (object): information to write to file raises: returns: """ # Specify directories and files. path = os.path.join(directory, "extraction") utility.confirm_path_directory(path) path_pickle = os.path.join(path, "hmdb_summary.pickle") path_text = os.path.join(path, "hmdb_summary.tsv") # Write information to file. with open(path_pickle, "wb") as file_product: pickle.dump(information["summary_object"], file_product) utility.write_file_table( information=information["summary_list"], path_file=path_text, names=information["summary_list"][0].keys(), delimiter="\t" )
def write_product(directory=None, information=None): """ Writes product information to file arguments: directory (str): directory for product files information (object): information to write to file raises: returns: """ # Specify directories and files. path = os.path.join(directory, "model") utility.confirm_path_directory(path) path_dymetabonet = os.path.join(path, "dymetabonet.json") path_compartments = os.path.join(path, "compartments.pickle") path_processes = os.path.join(path, "processes.pickle") path_reactions = os.path.join(path, "reactions.pickle") path_metabolites = os.path.join(path, "metabolites.pickle") path_compartments_text = os.path.join(path, "compartments.tsv") path_processes_text = os.path.join(path, "processes.tsv") path_reactions_text = os.path.join(path, "reactions.tsv") path_metabolites_text = os.path.join(path, "metabolites.tsv") # Write information to file. with open(path_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) utility.write_file_table(information=information["compartments_text"], path_file=path_compartments_text, names=information["compartments_text"][0].keys(), delimiter="\t") utility.write_file_table(information=information["processes_text"], path_file=path_processes_text, names=information["processes_text"][0].keys(), delimiter="\t") utility.write_file_table(information=information["reactions_text"], path_file=path_reactions_text, names=information["reactions_text"][0].keys(), delimiter="\t") utility.write_file_table(information=information["metabolites_text"], path_file=path_metabolites_text, names=information["metabolites_text"][0].keys(), delimiter="\t")
def write_product(directory=None, information=None): """ Writes product information to file arguments: directory (str): directory for product files information (object): information to write to file raises: returns: """ # Specify directories and files. path = os.path.join(directory, "reconciliation") utility.confirm_path_directory(path) path_file = os.path.join(path, "recon2m2_reconciliation.xml") # Write information to file. information.write(path_file, xml_declaration=False)
def write_product(directory=None, information=None): """ Writes product information to file arguments: directory (str): directory for product files information (object): information to write to file raises: returns: """ # Specify directories and files. path_network = os.path.join(directory, "network") path = os.path.join(path_network, "measurement") utility.confirm_path_directory(path) path_pickle = os.path.join(path, "metabolites.pickle") path_metabolites_text = os.path.join(path, "metabolites.tsv") path_reactions_text = os.path.join(path, "reactions.tsv") # Write information to file. with open(path_pickle, "wb") as file_product: pickle.dump(information["metabolites_measurement"], file_product) utility.write_file_table( information=information["metabolites_measurement_text"], path_file=path_metabolites_text, names=information["metabolites_measurement_text"][0].keys(), delimiter="\t" ) if False: utility.write_file_table( information=information["reactions_measurement_text"], path_file=path_reactions_text, names=information["reactions_measurement_text"][0].keys(), delimiter="\t" )
def write_product(directory=None, information=None): """ Writes product information to file arguments: directory (str): directory for product files information (object): information to write to file raises: returns: """ # Specify directories and files. path = os.path.join(directory, "network") utility.confirm_path_directory(path) path_networkx = os.path.join(path, "network_networkx.pickle") path_cytoscape = os.path.join(path, "network_cytoscape.json") # Write information to file. with open(path_networkx, "wb") as file_product: pickle.dump(information["networkx"], file_product) with open(path_cytoscape, "w") as file_product: json.dump(information["cytoscape"], file_product)