From 734051f9809cee7a99a7b132c5283ac471de17a2 Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent.modolo@ens-lyon.fr>
Date: Thu, 19 Aug 2021 10:02:46 +0200
Subject: [PATCH] kb: add g2t process

---
 src/nf_modules/kb/main.nf | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/nf_modules/kb/main.nf b/src/nf_modules/kb/main.nf
index d27e84fb..ca4e7552 100644
--- a/src/nf_modules/kb/main.nf
+++ b/src/nf_modules/kb/main.nf
@@ -38,7 +38,29 @@ process tr2g {
   """
   t2g.py --gtf ${gtf}
   sort -k1 -u t2g_dup.txt > t2g.txt
-  cp t2g.txt t2g.txt.back
+  """
+}
+
+process g2tr {
+  // create gene to transcript table from gtf if no transcript to gene file is provided
+  container = "${container_url}"
+  label "big_mem_mono_cpus"
+  tag "$file_id"
+  if (params.index_fasta_out != "") {
+    publishDir "results/${params.index_fasta_out}", mode: 'copy'
+  }
+
+  input:
+    tuple val(file_id), path(gtf)
+
+  output:
+    tuple val(file_id), path("g2t.txt"), emit: g2t
+
+  script:
+  """
+  t2g.py --gtf ${gtf}
+  sort -k1 -u t2g_dup.txt > t2g.txt
+  awk 'BEGIN{OFS="\\t"}{print \$2, \$1}' t2g.txt > g2t.txt
   """
 }
 
-- 
GitLab