From 99bd1816c395d090c1baab3dd5d37dcca848bb93 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Thu, 5 Aug 2021 09:53:40 +0200 Subject: tasks: add BrefDOITable --- python/refcat/tasks.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'python') 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 -- cgit v1.2.3