aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-08-05 09:53:40 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-08-05 09:53:40 +0200
commit99bd1816c395d090c1baab3dd5d37dcca848bb93 (patch)
treefdfbf08f9b70e909503e99f5e155382e17af2340 /python
parent2196f2c81494f351b83041b3ed36cd11fed73509 (diff)
downloadrefcat-99bd1816c395d090c1baab3dd5d37dcca848bb93.tar.gz
refcat-99bd1816c395d090c1baab3dd5d37dcca848bb93.zip
tasks: add BrefDOITable
Diffstat (limited to 'python')
-rw-r--r--python/refcat/tasks.py21
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