diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-05-13 00:01:41 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-05-13 00:01:41 +0200 |
commit | f0e41af0498a85773fbba28cb8552152365a612f (patch) | |
tree | 4efd84d5dc21a3ad27095c1d804eca3b87c3742d /python | |
parent | ef4127637c91cbf75ca4be711b0825306887d95b (diff) | |
download | refcat-f0e41af0498a85773fbba28cb8552152365a612f.tar.gz refcat-f0e41af0498a85773fbba28cb8552152365a612f.zip |
tasks: add three more extraction tasks
Diffstat (limited to 'python')
-rw-r--r-- | python/refcat/tasks.py | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 0339932..86a3712 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -437,3 +437,72 @@ class FatcatDOI(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) + + +class FatcatPMID(Refcat): + """ + PMID from fatcat. + """ + def requires(self): + return ReleaseExportReduced() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ff -x ext_ids.pmid -skip-on-empty 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) + + +class FatcatPMCID(Refcat): + """ + PMCID from fatcat. + """ + def requires(self): + return ReleaseExportReduced() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ff -x ext_ids.pmcid -skip-on-empty 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) + + +class FatcatArxiv(Refcat): + """ + Arxiv from fatcat. + """ + def requires(self): + return ReleaseExportReduced() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ff -x extra.arxiv.base_id -skip-on-empty 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) |