diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-05-12 00:23:44 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-05-12 00:23:44 +0200 |
commit | b8b528d3a31a39478ad0d7ddafda8bc3c7be362a (patch) | |
tree | abdbe350df5ea3a5306c001b2c2f1862fd0cdfbe /python | |
parent | 118d5bac457d163e25140624ccdcb0ed7dba820f (diff) | |
download | refcat-b8b528d3a31a39478ad0d7ddafda8bc3c7be362a.tar.gz refcat-b8b528d3a31a39478ad0d7ddafda8bc3c7be362a.zip |
tasks: add FatcatDOI
Diffstat (limited to 'python')
-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) |