import random from metagenomics.plugins.statisticalTests.Fishers import Fishers from metagenomics.plugins.statisticalTests.ChiSquare import ChiSquare from metagenomics.plugins.statisticalTests.ChiSquareYates import ChiSquareYates from metagenomics.plugins.statisticalTests.GTest import GTest from metagenomics.plugins.statisticalTests.GTestYates import GTestYates from metagenomics.plugins.statisticalTests.Permutation import Permutation from metagenomics.plugins.statisticalTests.DiffBetweenProp import DiffBetweenProp from metagenomics.plugins.statisticalTests.Bootstrap import Bootstrap from metagenomics.plugins.statisticalTests.Barnard import Barnard fishers = Fishers() chiSquare = ChiSquare() chiSquareYates = ChiSquareYates() gTest = GTest() gTestYates = GTestYates() permutation = Permutation() diffBetweenProp = DiffBetweenProp() bootstrap = Bootstrap() barnard = Barnard() sampleSizes = [5, 10, 15, 25] def mean(x): if len(x) == 0: return 0 sum = 0.0 for i in xrange(0, len(x)): sum += x[i]
import random from metagenomics.plugins.statisticalTests.Fishers import Fishers from metagenomics.plugins.statisticalTests.GTest import GTest from metagenomics.plugins.statisticalTests.GTestYates import GTestYates from metagenomics.plugins.statisticalTests.DiffBetweenProp import DiffBetweenProp fishers = Fishers() gTest = GTest() gTestYates = GTestYates() diffBetweenProp = DiffBetweenProp() numReplicates = 10000 # number of samples to draw popSize = 1000000 # size of underlying population propInSS = [0.1] # proportion of sequences in subsystem (SS) of interest sampleSize1 = [1000] # sample size for community 1 sampleSize2 = [2000] # sample size for community 2 for sampleSizeIndex in xrange(0, len(sampleSize1)): print 'Considering communities with a sample size of: ' + str(sampleSize1[sampleSizeIndex]) + ' and ' + str(sampleSize2[sampleSizeIndex]) for prop in propInSS: print ' Proportion of sequences in subsystem of interest: ' + str(prop) totalSamples1 = sampleSize1[sampleSizeIndex] totalSamples2 = sampleSize2[sampleSizeIndex] fishersResults = [] gTestResults = [] gTestYatesResults = []