diff options
-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 868a755..4f7c138 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -342,3 +342,72 @@ class RefsDOI(Refcat): def output(self): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) + + +class RefsPMID(Refcat): + """ + Sorted (pmid, doc) tuples from refs; PMID is an integer. + """ + def requires(self): + return RefsWithUnstructured() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ff -x biblio.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 RefsPMCID(Refcat): + """ + Sorted (pmcid, doc) tuples from refs, e.g. PMC2860560, ... + """ + def requires(self): + return RefsWithUnstructured() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ff -x biblio.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 RefsArxiv(Refcat): + """ + Sorted (arxiv, doc) tuples from refs, e.g. 1802.3912, ... + """ + def requires(self): + return RefsWithUnstructured() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m ff -x biblio.arxiv_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) |