From b8b528d3a31a39478ad0d7ddafda8bc3c7be362a Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 12 May 2021 00:23:44 +0200 Subject: tasks: add FatcatDOI --- python/refcat/tasks.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 4f7c138..5553b23 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -346,7 +346,8 @@ class RefsDOI(Refcat): class RefsPMID(Refcat): """ - Sorted (pmid, doc) tuples from refs; PMID is an integer. + Sorted (pmid, doc) tuples from refs; PMID is an integer, + https://www.ncbi.nlm.nih.gov/pmc/pmctopmid/ """ def requires(self): return RefsWithUnstructured() @@ -369,7 +370,8 @@ class RefsPMID(Refcat): class RefsPMCID(Refcat): """ - Sorted (pmcid, doc) tuples from refs, e.g. PMC2860560, ... + Sorted (pmcid, doc) tuples from refs, e.g. PMC2860560, + https://www.ncbi.nlm.nih.gov/pmc/pmctopmid/ """ def requires(self): return RefsWithUnstructured() @@ -411,3 +413,27 @@ class RefsArxiv(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) + + +class FatcatDOI(Refcat): + """ + DOI from fatcat. + """ + def requires(self): + return ReleaseExportReduced() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ff -x ext_ids.doi -skip-on-empty 1 | + skate-cleanup -c doi -f 1 | + LC_ALL=C sort -T {tmpdir} -k1,1 -S25% --parallel 4 | + zstd -T0 -c > {output} + """, + n=self.n, + tmpdir=self.tmpdir, + input=self.input().path) + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) -- cgit v1.2.3