aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-05-19 22:33:01 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-05-19 22:33:01 +0200
commit9cdef6270986b48746fa7e4a610f1bbeb2ed8d3d (patch)
treed14908ef8fa432608f8ef1315dc1c09b7c19be42 /python
parent19ab14391f64ed385d05a371b1bb9547cf408b23 (diff)
downloadrefcat-9cdef6270986b48746fa7e4a610f1bbeb2ed8d3d.tar.gz
refcat-9cdef6270986b48746fa7e4a610f1bbeb2ed8d3d.zip
tasks: add RefsMapped
Diffstat (limited to 'python')
-rw-r--r--python/refcat/tasks.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index b00302e..6d7bf56 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -543,6 +543,32 @@ class FatcatMapped(Refcat):
return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd)
+class RefsMapped(Refcat):
+ """
+ Apply mapper on refs.
+ """
+ mapper = luigi.Parameter(default="ts", description="mapper short name")
+
+ def requires(self):
+ return RefsToRelease()
+
+ def run(self):
+ output = shellout("""
+ zstdcat -T0 {input} |
+ skate-map -m {mapper} -skip-on-empty 1 |
+ LC_ALL=C sort -T {tmpdir} -k1,1 -S25% --parallel 4 |
+ zstd -T0 -c > {output}
+ """,
+ n=self.n,
+ mapper=self.mapper,
+ 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 BrefZipDOI(Refcat):
"""
Run skate-reduce from two files.