I dont know what is wrong with my script, it only returns the last line from a file with some E coli data.
It should return a dictionary where the keys are the names of the proteins and sequences are the values.
It should return a dictionary where the keys are the names of the proteins and sequences are the values.
def read_fasta(str): file = open(str).read() holder = [] table_dict = {} for line in file.split('>'): #table_dict[line.split()[0]] = line.splitlines()[1:] table_dict["Name"] = (line.splitlines()[:1]) table_dict["Value"] = (line.splitlines()[1:]) print table_dictIn another Python file I import this function and test whether it works or not
import module module.read_fasta("Ecoli.prot.fasta")