changeset 4:f8af57d6f60b

Fixed bug causing fastq input to break - Moved misplaced error check causing fastq inputs to not function
author shian_su <registertonysu@gmail.com>
date Mon, 24 Feb 2014 14:41:39 +1100
parents 076ca575208f
children 17befe9f8b03
files hairpinTool.R
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hairpinTool.R	Fri Feb 21 12:52:56 2014 +1100
+++ b/hairpinTool.R	Mon Feb 24 14:41:39 2014 +1100
@@ -170,10 +170,6 @@
        offenders, " are repeated")
 } # Check that IDs in sample annotation are unique
 
-if (any(is.na(match(samples$ID, colnames(counts))))) {
-  stop("not all samples have groups specified")
-} # Check that a group has be specifed for each sample
-
 if (inputType=="fastq") {
 
   if (any(table(hairpins$ID)>1)){
@@ -182,8 +178,11 @@
     stop("ID column of hairpin annotation must have unique values, values ",
     offenders, " are repeated")
   } # Check that IDs in hairpin annotation are unique
-
+  
 } else if (inputType=="counts") {
+  if (any(is.na(match(samples$ID, colnames(counts))))) {
+    stop("not all samples have groups specified")
+  } # Check that a group has be specifed for each sample
   
   if (any(table(counts$ID)>1)){
     tab <- table(counts$ID)
@@ -293,7 +292,7 @@
 
 # Make the names of groups syntactically valid (replace spaces with periods)
 data$samples$group <- make.names(data$samples$group)
-} else {
+} else if (inputType=="counts") {
   # Process counts information, set ID column to be row names
   rownames(counts) <- counts$ID
   counts <- counts[ , !(colnames(counts)=="ID")]