diff options
-rw-r--r-- | python/refcat/tasks.py | 30 |
1 files changed, 28 insertions, 2 deletions
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) |