This function is intended to be an interactive technique for constructing transcripts, probably to be released
    in a future version of msbwt
    @param bwtFN - the filename of the BWT to load
    @param seedKmer - the seed sequence to use for construction
    @param threshold - minimum number for a path to be considered a path
    @param direction - True is forward, False is backward
    @param logger - the logger
    @param

def interactiveTranscriptConstruction(bwtDir, seedKmer, endSeeds, threshold, numNodes, direction, logger):
    '''
    This function is intended to be an interactive technique for constructing transcripts, probably to be released
    in a future version of msbwt
    @param bwtFN - the filename of the BWT to load
    @param seedKmer - the seed sequence to use for construction
    @param threshold - minimum number for a path to be considered a path
    @param direction - True is forward, False is backward
    @param logger - the logger
    @param 
    '''
    kmerLen = len(seedKmer)
    validChars = ['$', 'A', 'C', 'G', 'N', 'T']
    
    pileups = []
    
    logger.info('Loading '+bwtDir+'...')
    msbwt = loadBWT(bwtDir)
    if os.path.exists(bwtDir+'/origins.npy'):
        raise Exception("You haven\'t reimplemented the handling of origin files")
        origins = np.load(bwtDir+'/origins.npy', 'r')
    else:
        origins = None
    
    logger.info('Beginning with seed \''+seedKmer+'\', len='+str(kmerLen))
    
    kmer = seedKmer
    pos = kmerLen
    ret = ''+kmer
    
    #these variable are for counting the average pileup
    totalPileup = 0
    numCovered = 0
    
    discoveredBlocks = []
    discoveredEdges = []
    pathTups = []
    parentID = -1
    blockID = 0
    
    #TODO: make it an input
    #we're stating that 5 reads indicates a path here
    pathThreshold = threshold
    
    foundKmers = {}
    movingAverage = 0
    
    for es in endSeeds:
        foundKmers[es] = 'END_SEED'
    
    terminate = False
    while not terminate and len(discoveredBlocks) < numNodes:
        
        if len(kmer) != kmerLen:
            print 'ERROR: DIFFERENT SIZED K-MER '+str(len(kmer))
            raise Exception('ERROR')
        
        #First, perform all the counts of paths going both forwards and backwards
        counts = {}
        revCounts = {}
        
        maxV = 0
        maxC = ''
        total = 0
        
        numPaths = 0
        numRevPaths = 0
        
        for c in validChars:
            #forward counts
            fr1 = msbwt.findIndicesOfStr(kmer+c)
            fr2 = msbwt.findIndicesOfStr(reverseComplement(kmer+c))
            
            #backward counts
            br1 = msbwt.findIndicesOfStr(c+kmer)
            br2 = msbwt.findIndicesOfStr(reverseComplement(c+kmer))
            
            counts[c] = (fr1[1]-fr1[0])+(fr2[1]-fr2[0])
            revCounts[c] = (br1[1]-br1[0])+(br2[1]-br2[0])
            
            if c != '$':
                total += counts[c]
                if counts[c] > maxV:
                    maxV = counts[c]
                    maxC = c
                
                if counts[c] > pathThreshold:
                    numPaths += 1
                    
                if revCounts[c] > pathThreshold:
                    numRevPaths += 1
            
            if origins != None:
                pass
        
        totalPileup += total
        numCovered += 1
        
        if numRevPaths > 1:
            discoveredBlocks.append((parentID, ret, pileups, 'MERGE_'+str(blockID+1)))
            discoveredEdges.append((blockID, blockID+1, revCounts))
            
            print 'INCOMING MERGE FOUND: '+str(discoveredBlocks[blockID])
            parentID = blockID
            blockID += 1
            
            ret = ''+kmer
            pileups = []
            
        if total == 0:
            print 'No strings found.'
            discoveredBlocks.append((parentID, ret, pileups, 'TERMINAL'))
            
            pileups = []
            
            print pathTups
            print discoveredBlocks
            
            if len(pathTups) == 0:
                terminate = True
            else:
                nextPathTup = pathTups.pop(0)
                print 'Handling1: '+str(nextPathTup)
                parentID = nextPathTup[1]
                direction = nextPathTup[2]
                kmer = nextPathTup[3]
                ret = ''+kmer
                    
                discoveredEdges.append((parentID, blockID+1, nextPathTup[0]))
            
            blockID += 1
            continue
        
        
        #now we identify this kmer as being part of the block
        foundKmers[kmer] = blockID
        r1 = msbwt.findIndicesOfStr(kmer)
        r2 = msbwt.findIndicesOfStr(reverseComplement(kmer))
        kmerCount = (r1[1]-r1[0])+(r2[1]-r2[0])
        pileups.append(kmerCount)
        
        if total == 0:
            perc = 0
        else:
            perc = float(maxV)/total
            
        if numPaths > 1:
            #TODO: reverse ret if direction is reversed
            discoveredBlocks.append((parentID, ret, pileups, 'SPLIT'))
            
            for c in validChars[1:]:
                if counts[c] > pathThreshold:
                    #counts, parent block, direction, starting seed
                    if direction:
                        pathSeed = kmer[1:]+c
                    else:
                        pathSeed = c+kmer[0:-1]
                    
                    pathTup = (counts[c], blockID, direction, pathSeed)
                    pathTups.append(pathTup)
            
            print pathTups
            print discoveredBlocks
            
            if len(pathTups) == 0:
                terminate = True
            else:
                nextPathTup = pathTups.pop(0)
                print 'Handling2: '+str(nextPathTup)
                parentID = nextPathTup[1]
                direction = nextPathTup[2]
                kmer = nextPathTup[3]
                
                ret = ''+kmer    
                pileups = []
                                
                discoveredEdges.append((parentID, blockID+1, nextPathTup[0]))
            
            blockID += 1
            
        else:
            if direction:
                kmer = kmer[1:]+maxC
                ret += maxC
            else:
                kmer = maxC+kmer[0:-1]
                ret = maxC+ret
            pos += 1
            
            movingAverage = .9*movingAverage+.1*maxV
            print str(pos)+':\t'+kmer+'\t'+str(perc)+'\t'+str(maxV)+'/'+str(total)+'\t'+str(total-maxV)+'\t'+str(movingAverage)
            
        while foundKmers.has_key(kmer) and not terminate:
            #TODO: reverse ret if direction is reversed
            discoveredBlocks.append((parentID, ret, pileups, 'MERGE_'+str(foundKmers[kmer])))
            discoveredEdges.append((blockID, foundKmers[kmer], ''))
            
            print pathTups
            print discoveredBlocks
            
            if len(pathTups) == 0:
                terminate = True
            else:
                nextPathTup = pathTups.pop(0)
                print 'Handling3: '+str(nextPathTup)
                #pileups.append(nextPathTup[0])
                parentID = nextPathTup[1]
                direction = nextPathTup[2]
                kmer = nextPathTup[3]
                
                ret = ''+kmer
                pileups = []
                    
                discoveredEdges.append((parentID, blockID+1, nextPathTup[0]))
            blockID += 1
    
    return (discoveredBlocks, discoveredEdges)