##########################################################

#get windows and analyse
if windType == "coordinate":
    windowGenerator = genomics.slidingCoordWindows(genoFile,
                                                   windSize,
                                                   stepSize,
                                                   sampleData.indNames,
                                                   include=scafsToInclude,
                                                   exclude=scafsToExclude)
elif windType == "sites":
    windowGenerator = genomics.slidingSitesWindows(genoFile,
                                                   windSize,
                                                   overlap,
                                                   maxDist,
                                                   minSites,
                                                   sampleData.indNames,
                                                   include=scafsToInclude,
                                                   exclude=scafsToExclude)
else:
    windowGenerator = genomics.predefinedCoordWindows(genoFile, windCoords,
                                                      sampleData.indNames)

for window in windowGenerator:
    windowQueue.put((windowsQueued, window))
    windowsQueued += 1

############################################################################################################################################

print >> sys.stderr, "\nWriting final results...\n"
while resultsHandled < windowsQueued:
Example #2
0
#get windows and analyse
if windType == "coordinate":
    windowGenerator = genomics.slidingCoordWindows(inFile,
                                                   windSize,
                                                   stepSize,
                                                   headerLine=args.header,
                                                   names=args.columns,
                                                   include=scafsToInclude,
                                                   exclude=scafsToExclude)
elif windType == "sites":
    windowGenerator = genomics.slidingSitesWindows(inFile,
                                                   windSize,
                                                   overlap,
                                                   maxDist,
                                                   minSites,
                                                   headerLine=args.header,
                                                   names=args.columns,
                                                   include=scafsToInclude,
                                                   exclude=scafsToExclude)
else:
    windowGenerator = genomics.predefinedCoordWindows(inFile,
                                                      windCoords,
                                                      headerLine=args.header,
                                                      names=args.columns)

n = 0

for window in windowGenerator:
    #if its the first window, get the headings and write
    if n == 0:
Example #3
0
if args.windType == "cat":
    window = genomics.parseGenoFile(genoFile, headerLine = args.header, names=sampleData.indNames)
    windowQueue.put((windowsQueued,window))
    windowsQueued += 1
    
else:
    #get windows and analyse
    if args.windType == "coordinate": windowGenerator = genomics.slidingCoordWindows(genoFile, windSize, stepSize,
                                                                                     headerLine = args.header,
                                                                                     names = sampleData.indNames,
                                                                                     include = scafsToInclude,
                                                                                     exclude = scafsToExclude)
    elif args.windType == "sites": windowGenerator = genomics.slidingSitesWindows(genoFile, windSize, overlap,
                                                                                  maxDist, minSites,
                                                                                  headerLine = args.header,
                                                                                  names = sampleData.indNames,
                                                                                  include = scafsToInclude,
                                                                                  exclude = scafsToExclude)
    else: windowGenerator = genomics.predefinedCoordWindows(genoFile, windCoords,
                                                            headerLine = args.header,
                                                            names = sampleData.indNames)
    
    for window in windowGenerator:
        windowQueue.put((windowsQueued,window))
        windowsQueued += 1

############################################################################################################################################

while resultsHandled < windowsQueued:
  sleep(1)
Example #4
0
##########################################################################################################

#get windows and analyse
if windType == "coordinate":
    windowGenerator = genomics.slidingCoordWindows(inFile,
                                                   windSize,
                                                   stepSize,
                                                   columns,
                                                   include=scafsToInclude,
                                                   exclude=scafsToExclude)
elif windType == "sites":
    windowGenerator = genomics.slidingSitesWindows(inFile,
                                                   windSize,
                                                   overlap,
                                                   maxDist,
                                                   minSites,
                                                   columns,
                                                   include=scafsToInclude,
                                                   exclude=scafsToExclude)
else:
    windowGenerator = genomics.predefinedCoordWindows(inFile, windCoords,
                                                      columns)

n = 0

for window in windowGenerator:
    #if its the first window, get the headings and write
    if n == 0:
        for name in window.names:
            outFile.write("," + ",".join([
                name + "_mean", name + "_median", name + "_max", name +
Example #5
0
        windSize = 1e7
        minSites = 1
        stepSize = 1e7
    #initialise window generator
    if windType == "coordinate":
        windowGenerator = genomics.slidingCoordWindows(
            genoFile,
            windSize,
            stepSize,
            args.samples,
            splitPhased=args.splitPhased)
    else:
        windowGenerator = genomics.slidingSitesWindows(
            genoFile,
            windSize,
            overlap,
            maxDist,
            minSites,
            args.samples,
            splitPhased=args.splitPhased)

    for window in windowGenerator:

        posString = str(window.firstPos()) + "_" + str(window.lastPos())

        #open file if necessary
        if args.separateFiles:
            if args.format == "fasta": ext = ".fa"
            else: ext = ".phy"
            seqFileName = args.seqFile + "." + window.scaffold
            if args.mode == "windows": seqFileName += "_" + posString
            seqFileName += ext