def main(): if not len(sys.argv) in [3]: print 'Usage: ' print ' %s data index' % sys.argv[0] os.abort() else: if not isfile(sys.argv[1]): print "Input file doesn't exist" os.abort() inp = open(sys.argv[1]) # read input data = inp.read() # create index idx = fmindex.index(data) # save index to file fmindex.save(sys.argv[2], idx) print "search results: " list_matches = idx.search( "ctaactgataccggaataccttaactacggacgtttgtttttgcgccacgc") for each in list_matches: print each
def main(): if not len(sys.argv) in [3]: print('Usage: ') print(' %s data index' % sys.argv[0]) os.abort() else: if not isfile(sys.argv[1]): print("Input file doesn't exist") os.abort() inp = open(sys.argv[1]) data = inp.read() idx = fmindex.index(data) fmindex.save(sys.argv[2], idx)
def main(): if not len(sys.argv) in [3]: print 'Usage: ' print ' %s data index' % sys.argv[0] os.abort() else: if not isfile(sys.argv[1]): print "Input file doesn't exist" os.abort() inp = open(sys.argv[1]) # read input data = inp.read() # create index idx = fmindex.index(data) # save index to file fmindex.save(sys.argv[2], idx)
def main(): tim = time.clock index = [] # Run the above function and store its results in a variable. full_file_paths = get_filepaths(sys.argv[1]) #print(full_file_paths) t_start = tim() for f in full_file_paths: print(f) inp = open(f) # read input data = inp.read() s = data.split('\n', 1)[-1].replace("\n", "") #print(concat_rc(s)) index.append(fmindex.index(concat_rc(s))) t_load = tim() print("Number of genomes: " + str(len(index))) print("Indexing: %sms" % diff_time(t_start, t_load)) time.sleep(5) lines2 = [line.rstrip('\n') for line in open(sys.argv[2])] lines3 = [line.rstrip('\n') for line in open(sys.argv[3])] #print(lines2) idx2 = [] idx3 = [] read2 = [] read3 = [] for i in range(len(lines2)): if i%4 == 0: idx2.append(lines2[i]) idx3.append(lines3[i]) for i in range(len(lines3)): if i%4 == 1: read2.append(lines2[i]) read3.append(lines3[i]) #print(idx2) #print(read2) for r in range(len(read2)): print(read2[r]) print(idx2[r]) tmp1 = tim() for i in range(len(index)): if index[i].search(read2[r]): #print(index[i].search(r)) print(full_file_paths[i]) time.sleep(0.5) break tmp2 = tim() print("Search: %sms" % diff_time(tmp1, tmp2)) for r in range(len(read3)): print(read3[r]) print(idx3[r]) tmp1 = tim() for i in range(len(index)): if index[i].search(read3[r]): #print(index[i].search(r)) print(full_file_paths[i]) time.sleep(0.5) break tmp2 = tim() print("Search: %sms" % diff_time(tmp1, tmp2))