aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-08-04 00:58:37 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-08-04 00:58:37 +0200
commit65668624e1a792d479bfdbc35cd465348c224684 (patch)
tree6a3c9ab2ff14cc8df31a7ce3f2e9a29768d70f33
parentcb933900d3e1a8481e1ba647a19f1be564a11585 (diff)
downloadrefcat-65668624e1a792d479bfdbc35cd465348c224684.tar.gz
refcat-65668624e1a792d479bfdbc35cd465348c224684.zip
tasks: add ReleaseIdentDOIList
-rw-r--r--python/refcat/tasks.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 8df25f2..5e53f98 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -375,6 +375,25 @@ class ReleaseExportReduced(Refcat):
def output(self):
return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)
+class ReleaseIdentDOIList(Refcat):
+ """
+ Create TSV (ident, doi).
+ """
+ def requires(self):
+ return ReleaseExportExpanded()
+
+ def run(self):
+ output = shellout("""
+ zstdcat -T0 {input} |
+ parallel --block 10M -j 20 --pipe
+ "jq -rc 'select(.ext_ids.doi != null) | [.ident, .ext_ids.doi] | @tsv'" > {output}
+ """,
+ input=self.input().path)
+ luigi.LocalTarget(output).move(self.output().path)
+
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="tsv"))
+
class UnmatchedRefs(Refcat):
"""