aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-19 21:27:43 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-19 21:27:43 +0200
commit88b711997ec1bd1d91bc443744e40f85e25e996b (patch)
tree8eb12e6512462e887caf9fc40bfb37fa0804e02a
parent24a3c67d1397f5c2802e71c2160c3ec9524df220 (diff)
downloadrefcat-88b711997ec1bd1d91bc443744e40f85e25e996b.tar.gz
refcat-88b711997ec1bd1d91bc443744e40f85e25e996b.zip
tasks: add exact join tasks
-rw-r--r--python/refcat/tasks.py50
1 files changed, 48 insertions, 2 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 9d4c982..07c1217 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -572,8 +572,8 @@ class BrefZipPMID(Refcat):
"""
def requires(self):
return {
- "refs": RefsDOI(),
- "fatcat": FatcatDOI(),
+ "refs": RefsPMID(),
+ "fatcat": FatcatPMID(),
}
def run(self):
@@ -587,3 +587,49 @@ class BrefZipPMID(Refcat):
def output(self):
return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)
+
+
+class BrefZipPMCID(Refcat):
+ """
+ Run skate-reduce from two files.
+ """
+ def requires(self):
+ return {
+ "refs": RefsPMCID(),
+ "fatcat": FatcatPMCID(),
+ }
+
+ def run(self):
+ output = shellout(r"""
+ skate-reduce -m exact -r pmcid -F <(zstdcat -T0 {refs}) -L <(zstdcat -T0 {fatcat}) |
+ zstd -c -T0 > {output}
+ """,
+ refs=self.input().get("refs").path,
+ fatcat=self.input().get("fatcat").path)
+ luigi.LocalTarget(output).move(self.output().path)
+
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)
+
+
+class BrefZipArxiv(Refcat):
+ """
+ Run skate-reduce from two files.
+ """
+ def requires(self):
+ return {
+ "refs": RefsArxiv(),
+ "fatcat": FatcatArxiv(),
+ }
+
+ def run(self):
+ output = shellout(r"""
+ skate-reduce -m exact -r arxiv -F <(zstdcat -T0 {refs}) -L <(zstdcat -T0 {fatcat}) |
+ zstd -c -T0 > {output}
+ """,
+ refs=self.input().get("refs").path,
+ fatcat=self.input().get("fatcat").path)
+ luigi.LocalTarget(output).move(self.output().path)
+
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)