aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-12 00:14:00 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-12 00:14:03 +0200
commit5923185345449f89281f6d5208e6f09dc29b41b9 (patch)
treef3dcd716827ca6ec94c067ed6400f865e96b9263
parent624343cb15b2b8d8830194451299735a2a7def9b (diff)
downloadrefcat-5923185345449f89281f6d5208e6f09dc29b41b9.tar.gz
refcat-5923185345449f89281f6d5208e6f09dc29b41b9.zip
tasks: move id extraction to skate-map
-rw-r--r--python/refcat/tasks.py69
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)