diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-08-05 09:53:40 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-08-05 09:53:40 +0200 |
commit | 99bd1816c395d090c1baab3dd5d37dcca848bb93 (patch) | |
tree | fdfbf08f9b70e909503e99f5e155382e17af2340 /python | |
parent | 2196f2c81494f351b83041b3ed36cd11fed73509 (diff) | |
download | refcat-99bd1816c395d090c1baab3dd5d37dcca848bb93.tar.gz refcat-99bd1816c395d090c1baab3dd5d37dcca848bb93.zip |
tasks: add BrefDOITable
Diffstat (limited to 'python')
-rw-r--r-- | python/refcat/tasks.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 75a3daa..39d4486 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -438,6 +438,27 @@ class BrefWithDOI(Refcat): return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) +class BrefDOITable(Refcat): + """ + Extract a table with source ident, target ident, source doi, target doi. + """ + def requires(self): + return BrefWithDOI() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + parallel --block 10M -j 20 --pipe + "jq -rc '[.source_release_ident, .target_release_ident, .source_doi, .target_doi] | @tsv' + | zstd -c -T0 > {output} + """, + input=self.input().path) + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="tsv.zst")) + + class UnmatchedRefs(Refcat): """ File with not yet considered refs (e.g. no title, doi, ...); around |