diff IsoformSwitchAnalyzeR.R @ 2:2b0a6af4b85e draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/isoformswitchanalyzer commit d00628bfc2ac36914885e0941a2b4453ca0bff9a
author iuc
date Wed, 24 May 2023 06:06:54 +0000
parents 2c4e879a81cf
children 02a77166b29a
line wrap: on
line diff
--- a/IsoformSwitchAnalyzeR.R	Fri May 19 21:26:00 2023 +0000
+++ b/IsoformSwitchAnalyzeR.R	Wed May 24 06:06:54 2023 +0000
@@ -34,6 +34,7 @@
                     type = "integer",
                     help = "Read length (required for stringtie)")
 parser$add_argument("--annotation", required = FALSE, help = "Annotation")
+parser$add_argument("--stringtieAnnotation", required = FALSE, help = "Stringtie annotation")
 parser$add_argument("--transcriptome", required = FALSE, help = "Transcriptome")
 parser$add_argument(
   "--fixStringTieAnnotationProblem",
@@ -105,6 +106,12 @@
   help = "Overwrite IF values"
 )
 parser$add_argument(
+  "--removeNonConvensionalChr",
+  required = FALSE,
+  action = "store_true",
+  help = "Remove non-conventional chromosomes"
+)
+parser$add_argument(
   "--reduceToSwitchingGenes",
   required = FALSE,
   action = "store_true",
@@ -348,27 +355,50 @@
   )
 
   if (args$toolSource == "stringtie") {
-    SwitchList <- importRdata(
-      isoformCountMatrix   = quantificationData$counts,
-      isoformRepExpression = quantificationData$abundance,
-      designMatrix         = myDesign,
-      isoformExonAnnoation = args$annotation,
-      isoformNtFasta       = args$transcriptome,
-      showProgress = TRUE,
-      fixStringTieAnnotationProblem = args$fixStringTieAnnotationProblem
-    )
+    if (!is.null(args$stringtieAnnotation)) {
+      SwitchList <- importRdata(
+        isoformCountMatrix   = quantificationData$counts,
+        isoformRepExpression = quantificationData$abundance,
+        designMatrix         = myDesign,
+        removeNonConvensionalChr = args$removeNonConvensionalChr,
+        isoformExonAnnoation = args$stringtieAnnotation,
+        isoformNtFasta       = args$transcriptome,
+        addAnnotatedORFs = FALSE,
+        showProgress = TRUE,
+        fixStringTieAnnotationProblem = args$fixStringTieAnnotationProblem
+      )
+
+      SwitchList <- addORFfromGTF(
+        SwitchList,
+        removeNonConvensionalChr = args$removeNonConvensionalChr,
+        pathToGTF = args$annotation
+      )
+
+    } else {
+      SwitchList <- importRdata(
+        isoformCountMatrix   = quantificationData$counts,
+        isoformRepExpression = quantificationData$abundance,
+        designMatrix         = myDesign,
+        removeNonConvensionalChr = args$removeNonConvensionalChr,
+        isoformNtFasta       = args$transcriptome,
+        isoformExonAnnoation = args$annotation,
+        showProgress = TRUE,
+        fixStringTieAnnotationProblem = args$fixStringTieAnnotationProblem
+      )
+    }
+
   } else {
     SwitchList <- importRdata(
       isoformCountMatrix   = quantificationData$counts,
       isoformRepExpression = quantificationData$abundance,
       designMatrix         = myDesign,
+      removeNonConvensionalChr = args$removeNonConvensionalChr,
       isoformExonAnnoation = args$annotation,
       isoformNtFasta       = args$transcriptome,
       showProgress = TRUE
     )
   }
 
-
   geneCountMatrix <- extractGeneExpression(
     SwitchList,
     extractCounts = TRUE,
@@ -484,16 +514,18 @@
     showProgress = TRUE,
   )
 
-  SwitchList <- analyzeNovelIsoformORF(
-    SwitchList,
-    analysisAllIsoformsWithoutORF = TRUE,
-    minORFlength = args$minORFlength,
-    orfMethod = args$orfMethod,
-    PTCDistance = args$PTCDistance,
-    startCodons = "ATG",
-    stopCodons = c("TAA", "TAG", "TGA"),
-    showProgress = TRUE,
-  )
+  if (!is.null(args$stringtieAnnotation)) {
+    SwitchList <- analyzeNovelIsoformORF(
+      SwitchList,
+      analysisAllIsoformsWithoutORF = TRUE,
+      minORFlength = args$minORFlength,
+      orfMethod = args$orfMethod,
+      PTCDistance = args$PTCDistance,
+      startCodons = "ATG",
+      stopCodons = c("TAA", "TAG", "TGA"),
+      showProgress = TRUE,
+    )
+  }
 
   ### Extract Sequences
   SwitchList <- extractSequence(