From 3765369687b9a8752aff82be15e8f5d9706497df Mon Sep 17 00:00:00 2001
From: bow <bow@bow.web.id>
Date: Mon, 4 Aug 2014 10:57:11 +0200
Subject: [PATCH] Fix optional symlink error in Cutadapt step in Flexiprep

---
 .../src/main/scala/nl/lumc/sasc/biopet/extensions/Ln.scala   | 5 ++---
 .../nl/lumc/sasc/biopet/pipelines/flexiprep/Cutadapt.scala   | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Ln.scala b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Ln.scala
index a1117f9f5..8d7e7ca33 100644
--- a/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Ln.scala
+++ b/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/Ln.scala
@@ -53,11 +53,10 @@ class Ln(val root: Configurable) extends InProcessFunction with Configurable {
   private lazy val inRelative: String = {
     // calculate 'distance' from output directory to input
     // which is the number of directory walks required to get to the inUnique directory from outDir
-    val outDir = FilenameUtils.getFullPathNoEndSeparator(outUnique)
-    val dist: Int = scala.math.max(0, outDir.split(File.separator).length - 1)
+    val dist: Int = scala.math.max(0, inUnique.split(File.separator).length - 1)
     val result =
       if (dist > 0)
-        ((".." + File.separator) * dist) + File.separator + inUnique
+        ((".." + File.separator) * dist) + inUnique
       else
         inUnique
     result
diff --git a/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Cutadapt.scala b/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Cutadapt.scala
index 6de5da34f..0b5bb29c6 100644
--- a/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Cutadapt.scala
+++ b/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/Cutadapt.scala
@@ -33,8 +33,8 @@ class Cutadapt(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Cutada
     } else {
       analysisName = getClass.getSimpleName + "-ln"
       val lnOut = new Ln(this)
-      lnOut.in = new java.io.File(required(fastq_input))
-      lnOut.out = new java.io.File(required(fastq_output))
+      lnOut.in = fastq_input
+      lnOut.out = fastq_output
       lnOut.relative = true
       lnOut.cmd
     }
-- 
GitLab