comparison IsoformSwitchAnalyzeR.R @ 5:b3f292d9f35d draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/isoformswitchanalyzer commit 7b7d9892618706dad95641831db8b9f83deb86e1
author iuc
date Fri, 02 Jun 2023 10:27:16 +0000
parents 512d6462f2ce
children
comparison
equal deleted inserted replaced
4:512d6462f2ce 5:b3f292d9f35d
27 # Collect arguments from command line 27 # Collect arguments from command line
28 parser <- ArgumentParser(description = "IsoformSwitcheR R script") 28 parser <- ArgumentParser(description = "IsoformSwitcheR R script")
29 29
30 parser$add_argument("--modeSelector") 30 parser$add_argument("--modeSelector")
31 parser$add_argument("--parentDir", required = FALSE, help = "Parent directory") 31 parser$add_argument("--parentDir", required = FALSE, help = "Parent directory")
32 parser$add_argument("--condition",
33 action = "append",
34 required = FALSE,
35 help = "Conditions")
36 parser$add_argument("--sampleID",
37 action = "append",
38 required = FALSE,
39 help = "SampleID")
40 parser$add_argument("--replicate",
41 action = "append",
42 required = FALSE,
43 help = "Replicates")
32 parser$add_argument("--readLength", 44 parser$add_argument("--readLength",
33 required = FALSE, 45 required = FALSE,
34 type = "integer", 46 type = "integer",
35 help = "Read length (required for stringtie)") 47 help = "Read length (required for stringtie)")
48 parser$add_argument("--pairedSamples", action = "store_true", required = FALSE, help = "Paired samples")
36 parser$add_argument("--annotation", required = FALSE, help = "Annotation") 49 parser$add_argument("--annotation", required = FALSE, help = "Annotation")
37 parser$add_argument("--stringtieAnnotation", required = FALSE, help = "Stringtie annotation") 50 parser$add_argument("--stringtieAnnotation", required = FALSE, help = "Stringtie annotation")
38 parser$add_argument("--transcriptome", required = FALSE, help = "Transcriptome") 51 parser$add_argument("--transcriptome", required = FALSE, help = "Transcriptome")
39 parser$add_argument( 52 parser$add_argument(
40 "--fixStringTieAnnotationProblem", 53 "--fixStringTieAnnotationProblem",
342 parentDir = args$parentDir, 355 parentDir = args$parentDir,
343 addIsofomIdAsColumn = TRUE, 356 addIsofomIdAsColumn = TRUE,
344 readLength = args$readLength 357 readLength = args$readLength
345 ) 358 )
346 359
360 if (!args$pairedSamples) {
347 ### Make design matrix 361 ### Make design matrix
348 myDesign <- data.frame( 362 myDesign <- data.frame(
349 sampleID = colnames(quantificationData$abundance)[-1], 363 sampleID = args$sampleID,
350 condition = gsub( 364 condition = args$condition)
351 "[[:digit:]]+", 365 } else {
352 "", 366 myDesign <- data.frame(
353 colnames(quantificationData$abundance)[-1] 367 sampleID = args$sampleID,
354 ) 368 condition = args$condition,
355 ) 369 replicate = args$replicate)
370 }
371
372 comparisons <- as.data.frame(cbind(
373 condition_1 = myDesign$condition[1],
374 condition_2 = myDesign$condition[length(myDesign$condition)]
375 ))
356 376
357 if (args$toolSource == "stringtie") { 377 if (args$toolSource == "stringtie") {
358 if (!is.null(args$stringtieAnnotation)) { 378 if (!is.null(args$stringtieAnnotation)) {
359 SwitchList <- importRdata( 379 SwitchList <- importRdata(
360 isoformCountMatrix = quantificationData$counts, 380 isoformCountMatrix = quantificationData$counts,
363 removeNonConvensionalChr = args$removeNonConvensionalChr, 383 removeNonConvensionalChr = args$removeNonConvensionalChr,
364 isoformExonAnnoation = args$stringtieAnnotation, 384 isoformExonAnnoation = args$stringtieAnnotation,
365 isoformNtFasta = args$transcriptome, 385 isoformNtFasta = args$transcriptome,
366 addAnnotatedORFs = FALSE, 386 addAnnotatedORFs = FALSE,
367 showProgress = TRUE, 387 showProgress = TRUE,
388 comparisonsToMake = comparisons,
368 fixStringTieAnnotationProblem = args$fixStringTieAnnotationProblem 389 fixStringTieAnnotationProblem = args$fixStringTieAnnotationProblem
369 ) 390 )
370 391
371 SwitchList <- addORFfromGTF( 392 SwitchList <- addORFfromGTF(
372 SwitchList, 393 SwitchList,
381 designMatrix = myDesign, 402 designMatrix = myDesign,
382 removeNonConvensionalChr = args$removeNonConvensionalChr, 403 removeNonConvensionalChr = args$removeNonConvensionalChr,
383 isoformNtFasta = args$transcriptome, 404 isoformNtFasta = args$transcriptome,
384 isoformExonAnnoation = args$annotation, 405 isoformExonAnnoation = args$annotation,
385 showProgress = TRUE, 406 showProgress = TRUE,
407 comparisonsToMake = comparisons,
386 fixStringTieAnnotationProblem = args$fixStringTieAnnotationProblem 408 fixStringTieAnnotationProblem = args$fixStringTieAnnotationProblem
387 ) 409 )
388 } 410 }
389 411
390 } else { 412 } else {
393 isoformRepExpression = quantificationData$abundance, 415 isoformRepExpression = quantificationData$abundance,
394 designMatrix = myDesign, 416 designMatrix = myDesign,
395 removeNonConvensionalChr = args$removeNonConvensionalChr, 417 removeNonConvensionalChr = args$removeNonConvensionalChr,
396 isoformExonAnnoation = args$annotation, 418 isoformExonAnnoation = args$annotation,
397 isoformNtFasta = args$transcriptome, 419 isoformNtFasta = args$transcriptome,
398 showProgress = TRUE 420 showProgress = TRUE,
421 comparisonsToMake = comparisons
399 ) 422 )
400 } 423 }
401 424
402 geneCountMatrix <- extractGeneExpression( 425 geneCountMatrix <- extractGeneExpression(
403 SwitchList, 426 SwitchList,