Skip to content
Snippets Groups Projects
Commit 4c7e0611 authored by Jasper Koehorst's avatar Jasper Koehorst
Browse files

taxonomy split fix

parent 16167999
Branches
Tags
No related merge requests found
...@@ -140,7 +140,7 @@ def process_rdf_files(rdf_file): ...@@ -140,7 +140,7 @@ def process_rdf_files(rdf_file):
def biom_preformatter(): def biom_preformatter():
# Format tax matrix a bit so further parsing as added prefixes # Format tax matrix a bit so further parsing as added prefixes
tax_df = process_tax() tax_df = process_tax()
# Load and transform the ASV file into a matrix # Load and transform the ASV file into a matrix
lines = [] lines = []
for line in open("asv.tsv"): for line in open("asv.tsv"):
...@@ -218,9 +218,12 @@ def tsv_to_biom(): ...@@ -218,9 +218,12 @@ def tsv_to_biom():
# Create Python object from JSON string data # Create Python object from JSON string data
obj = json.loads(json_data) obj = json.loads(json_data)
# Fix taxonomy split issue
for index, row in enumerate(obj["rows"]):
row['metadata']['taxonomy'] = row['metadata']['taxonomy'].split("; ")
# Pretty Print JSON # Pretty Print JSON
json_formatted_str = json.dumps(obj, indent=4, sort_keys=True) json_formatted_str = json.dumps(obj, indent=4, sort_keys=True)
biom_file = job.split("/")[-1].replace(".job", ".biom") biom_file = job.split("/")[-1].replace(".job", ".biom")
print("Writing biom file to", biom_file) print("Writing biom file to", biom_file)
print(json_formatted_str, file=open(biom_file, "w")) print(json_formatted_str, file=open(biom_file, "w"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment