Code:
f = open("Desktop/MEME_IDS", "r") #open file with list of terms to search for
patterns = {} #create an open dictionary (this is a string)
while True:
line = f.readline() #read each line of file1, put into variable line
if (line == ''): #at the end of file, stop
break
patterns[line] = None #put each line into a list with the key patterns
f = open("Desktop/genelistAFUA.txt", "r") #open next file
while True:
line = f.readline() #read each line in, with break for end of file, as above
if (line == ''):
break
col1, col2 = line.split("\t") #split the file into 2 columns, that are separated by a tab, what I want to match is in col1, info i need is in col2
if (col1 in patterns): # if the value in col1 matches the patterns list above, then print col2
print col2
#from A to parse sublist of genes i am interested in from full genelist
#format of file one is a simple list of single values, the second file has 2 columns, I am matching column 1 from the list from file 1.
#my error is :
Traceback (most recent call last):
File "Desktop/parsefile.py", line 14, in <module>
col1, col2 = line.split("\t" ) #split the file into 2 columns, separated by a tab
ValueError: need more than 1 value to unpack
Any thoughts?
Comment