Пример #1
0
def runNeEst(files, runFolder, locisampling, popsampling, regressConfig):
    statsFile = ""
    #create output folder
    #run neEstimator
    neFile = ""
    #run lineregress
    configVals = ResultScraper.configRead(regressConfig)
    statsFile = LineRegress._neStatsHelper(
        neFile,
        configVals["alpha"],
        outFileName=statsFile,
        significantValue=configVals["sigSlope"],
        firstVal=configVals["startData"])
    return statsFile
Пример #2
0
def collectStatsData(neDict, statsDict, outFolder, regressConfig):
    slopesName = "slopes.csv"
    powerName = "power.csv"
    neName = "Ne.csv"
    statConfig = ResultScraper.configRead(regressConfig)

    nePath = os.path.join(outFolder, neName)
    neOut = open(nePath, "w")
    neOut.write("parameters,replicate,Reproductive Cycle,Ne\n")
    for identifier in neDict:
        neFile = neDict[identifier]
        neData = gatherNe(neFile, statConfig["startData"])
        for datapoint in neData:
            print(datapoint)
            data = neData[datapoint]
            print(data)
            for point in data:
                neOut.write(
                    str(identifier) + "," + str(datapoint) + "," +
                    str(point[0]) + "," + str(point[1]) + "\n")
    neOut.close()

    #compile stats file
    slopePath = os.path.join(outFolder, slopesName)
    powerPath = os.path.join(outFolder, powerName)
    powerOut = open(powerPath, "w")
    powerOut.write(
        "parameters,Positive Slopes,Neutral Slopes, Negative Slopes, Total\n")
    slopeOut = open(slopePath, "w")
    slopeOut.write("parameters,Slope,Intercept,CI Slope Min,CI Slope Max\n")
    for identifier in statsDict:
        statsFile = statsDict[identifier]
        power = gatherPower(statsFile)
        slopes = gatherSlopes(statsFile)
        sumPower = sum(power.values())
        powerOut.write(
            str(identifier) + "," + str(power["positive"]) + "," +
            str(power["neutral"]) + "," + str(power["negative"]) + "," +
            str(sumPower) + "\n")
        for dataPoint in slopes:
            slopeOut.write(
                str(identifier) + "," + dataPoint["slope"] + "," +
                dataPoint["intercept"] + "," + dataPoint["lowerCI"] + "," +
                dataPoint["upperCI"] + "\n")
    powerOut.close()
    slopeOut.close()
Пример #3
0
def gatherSlopes(filename):
    instanceArray, arrayDict = ResultScraper.scrapeSlopes(filename)
    return instanceArray
Пример #4
0
def gatherPower(filename):
    powerData = ResultScraper.scrapePower(filename)
    return powerData
Пример #5
0
def gatherNe(fileName, firstVal):
    results, temp = ResultScraper.scrapeNE(fileName, firstVal)
    return results
Пример #6
0
def gatherSlopes(filename):
    instanceArray, arrayDict = ResultScraper.scrapeSlopes(filename)
    return instanceArray
Пример #7
0
def gatherPower(filename):
    powerData = ResultScraper.scrapePower(filename)
    return powerData
Пример #8
0
def gatherNe(fileName,firstVal):
    results, temp = ResultScraper.scrapeNE(fileName,firstVal)
    return results