Commit 40b823f2 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Add file metadata for card

parent 2b71cd2d
#!/usr/bin/env python3
import dbman.helper as h
import json
import os
import logging
......@@ -22,9 +23,23 @@ fn =
# extract archive
# detect version
version = lookup_card_version()
# lookup tags for fasta files
fastas = [ for f in os.scandir('.') if f.is_file() and'.fasta')]
parts = []
for fasta in fastas:
tags = fasta .replace('_protein_', '_') .replace('.fasta', '') .split('_',2)
parts.append({'files': [fasta], 'tags': tags})
tsvs = [ for f in os.scandir('.') if f.is_file() and ('.tsv') or == 'snps.txt')]
for tsv in tsvs:
parts.append({'files': [tsv], 'tags': ['tsv']})
parts.append({'files': ['card.json'], 'tags':['json', 'model']})
parts.append({'files': ['CARD-Download-README.txt'], 'tags':['text', 'readme']})
# write metadata file
h.create_metadata(dbname, "download", dbdescription, version=version)
h.create_metadata(dbname, "download", dbdescription, version=version, other={'parts': parts})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment