Skip to content

Commit

Permalink
Merge pull request #240 from andersen-lab/barcode-format-change
Browse files Browse the repository at this point in the history
make json format readable
  • Loading branch information
joshuailevy authored Jun 10, 2024
2 parents e1ce2ed + a58da30 commit 1e3ba1b
Show file tree
Hide file tree
Showing 2 changed files with 253,129 additions and 6 deletions.
11 changes: 6 additions & 5 deletions freyja/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,16 @@ def update(outdir, noncl, buildlocal):
os.path.join(locDir, 'usher_barcodes.feather'))

dictMuts = {}
for lin in df.index:
muts = sorted([df.columns[m0] for m0, v in enumerate(df.loc[lin])
if v > 0], key=sortFun)
for lin in df_barcodes.index:
muts = sorted([df_barcodes.columns[m0]
for m0, v in enumerate(df_barcodes.loc[lin])
if v > 0], key=sortFun)
dictMuts[lin] = muts

import json
jpath = os.path.join(locDir, "lineage_mutations.json")
with open(jpath, "w") as outfile:
json.dump(dictMuts, outfile)
json.dump(dictMuts, outfile, indent=4)

# delete files generated along the way that aren't needed anymore
print('Cleaning up')
Expand Down Expand Up @@ -310,7 +311,7 @@ def barcode_build(pb, outdir, noncl):
import json
jpath = os.path.join(locDir, "lineage_mutations.json")
with open(jpath, "w") as outfile:
json.dump(dictMuts, outfile)
json.dump(dictMuts, outfile, indent=4)

# delete files generated along the way that aren't needed anymore
print('Cleaning up')
Expand Down
253,124 changes: 253,123 additions & 1 deletion freyja/data/lineage_mutations.json

Large diffs are not rendered by default.

0 comments on commit 1e3ba1b

Please sign in to comment.