annotate maaslin-4450aa4ecc84/src/test-SummarizeMaaslin/test-SummarizeMaaslin.R @ 1:a87d5a5f2776

Uploaded the version running on the prod server
author george-weingart
date Sun, 08 Feb 2015 23:08:38 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
1 c_strDir <- file.path(getwd( ),"..")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
2
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
3 source(file.path(c_strDir,"lib","Constants.R"))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
4 source(file.path(c_strDir,"lib","SummarizeMaaslin.R"))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
5 source(file.path(c_strDir,"lib","Utility.R"))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
6
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
7 context("Test funcSummarizeDirectory")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
8 strDirectoryNone = file.path(c_strDir,c_strTestingDirectory,c_strTestingInput,"funcSummarizeDirectory","None")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
9 strDirectory1 = file.path(c_strDir,c_strTestingDirectory,c_strTestingInput,"funcSummarizeDirectory","1")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
10 strDirectory3 = file.path(c_strDir,c_strTestingDirectory,c_strTestingInput,"funcSummarizeDirectory","3")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
11 strFileBase1 = "FileBase1.txt"
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
12 strFileBase2 = "FileBase2.txt"
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
13
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
14 sKeyword = "Q.value"
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
15 sAltKeyword = "P.value"
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
16 sAltSignificance = "0.35"
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
17
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
18 sBaseName = "FuncSummarizeDirectory"
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
19
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
20 #Output and answer files
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
21 sNoFileResult = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-NoFileResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
22 sNoFileResultAltKeyword = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-NoFileAltKeyResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
23 sNoFileResultAltSig = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-NoFileAltSigResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
24 sNoFileResultAnswer = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-NoFileAnswer.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
25 sNoFileResultAnswerAltKeyword = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-NoFileAltKeyAnswer.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
26 sNoFileResultAnswerAltSig = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-NoFileAltSigAnswer.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
27 unlink(sNoFileResult)
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
28 sCorrectResults1File = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-1FileResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
29 sCorrectResults1FileAltKeyword = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-1FileAltKeyResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
30 sCorrectResults1FileAltSig = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-1FileAltSigResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
31 sCorrectResults1FileAnswer = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-1FileResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
32 sCorrectResults1FileAnswerAltKeyword = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-1FileAltKeyResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
33 sCorrectResults1FileAnswerAltSig = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-1FileAltSigResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
34 unlink(sCorrectResults1File)
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
35 sCorrectResults3Files = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-3FileResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
36 sCorrectResults3FilesAltKeyword = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-3FileAltKeyResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
37 sCorrectResults3FilesAltSig = file.path(c_strDir,c_strTestingDirectory,c_strTemporaryFiles,"FuncSummarizeDirectory-3FileAltSigResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
38 sCorrectResults3FilesAnswer = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-3FileResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
39 sCorrectResults3FilesAnswerAltKeyword = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-3FileAltKeyResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
40 sCorrectResults3FilesAnswerAltSig = file.path(c_strDir,c_strTestingDirectory,c_strCorrectAnswers,"FuncSummarizeDirectory-3FileAltSigResult.txt")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
41 unlink(sCorrectResults3Files)
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
42
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
43 #Run tests
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
44 funcSummarizeDirectory(astrOutputDirectory=strDirectoryNone, strBaseName=sBaseName, astrSummaryFileName=sNoFileResult, astrKeyword=sKeyword, afSignificanceLevel="0.25")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
45 funcSummarizeDirectory(astrOutputDirectory=strDirectory1, strBaseName=sBaseName, astrSummaryFileName=sCorrectResults1File, astrKeyword=sKeyword, afSignificanceLevel="0.25")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
46 funcSummarizeDirectory(astrOutputDirectory=strDirectory3, strBaseName=sBaseName, astrSummaryFileName=sCorrectResults3Files, astrKeyword=sKeyword, afSignificanceLevel="0.25")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
47
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
48 funcSummarizeDirectory(astrOutputDirectory=strDirectoryNone, strBaseName=sBaseName, astrSummaryFileName=sNoFileResultAltKeyword, astrKeyword=sAltKeyword, afSignificanceLevel="0.25")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
49 funcSummarizeDirectory(astrOutputDirectory=strDirectory1, strBaseName=sBaseName, astrSummaryFileName=sCorrectResults1FileAltKeyword, astrKeyword=sAltKeyword, afSignificanceLevel="0.25")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
50 funcSummarizeDirectory(astrOutputDirectory=strDirectory3, strBaseName=sBaseName, astrSummaryFileName=sCorrectResults3FilesAltKeyword, astrKeyword=sAltKeyword, afSignificanceLevel="0.25")
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
51
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
52 funcSummarizeDirectory(astrOutputDirectory=strDirectoryNone, strBaseName=sBaseName, astrSummaryFileName=sNoFileResultAltSig, astrKeyword= sKeyword, afSignificanceLevel=sAltSignificance)
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
53 funcSummarizeDirectory(astrOutputDirectory=strDirectory1, strBaseName=sBaseName, astrSummaryFileName=sCorrectResults1FileAltSig, astrKeyword= sKeyword, afSignificanceLevel=sAltSignificance)
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
54 funcSummarizeDirectory(astrOutputDirectory=strDirectory3, strBaseName=sBaseName, astrSummaryFileName=sCorrectResults3FilesAltSig, astrKeyword= sKeyword, afSignificanceLevel=sAltSignificance)
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
55
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
56 test_that("Check the cases where no, and real summary files exist.",{
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
57 expect_equal(readLines(sNoFileResult),readLines(sNoFileResultAnswer))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
58 expect_equal(readLines(sCorrectResults1File),readLines(sCorrectResults1FileAnswer))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
59 expect_equal(readLines(sCorrectResults3Files),readLines(sCorrectResults3FilesAnswer))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
60 })
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
61
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
62 test_that("Check changing the keyword.",{
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
63 expect_equal(readLines(sNoFileResultAltKeyword),readLines(sNoFileResultAnswerAltKeyword))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
64 expect_equal(readLines(sCorrectResults1FileAltKeyword),readLines(sCorrectResults1FileAnswerAltKeyword))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
65 expect_equal(readLines(sCorrectResults3FilesAltKeyword),readLines(sCorrectResults3FilesAnswerAltKeyword))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
66 })
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
67
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
68 test_that("Check that changing the significance threshold effects inclusion.",{
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
69 expect_equal(readLines(sNoFileResultAltSig),readLines(sNoFileResultAnswerAltSig))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
70 expect_equal(readLines(sCorrectResults1FileAltSig),readLines(sCorrectResults1FileAnswerAltSig))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
71 expect_equal(readLines(sCorrectResults3FilesAltSig),readLines(sCorrectResults3FilesAnswerAltSig))
a87d5a5f2776 Uploaded the version running on the prod server
george-weingart
parents:
diff changeset
72 })