Reputation: 43
I am trying to write output file but not getting any output in file.Using below code I am not able to write the data in output file. Please check my code: In this script i am trying to do some bioinformatics analysis. 1. The first line contains the name of the protein and the count of subsequent lines of output for this protein (say N) 2. Each of the next N lines contains a match information: the locations of the GBoxes and the actual matches (remember there are perturbations and X's, i.e. wild cards, that are allowed).
I am getting expected output but not able to write output data in file.
Script
def write_file(data):
file_name = r'C:\Users\Vishnu\Desktop\Hiral_project_analysis\output_1.txt'
with open(file_name, 'wb') as x_file:
x_file.write('{}'.format(data))
def run():
data = H(protein,x1,x2,x3,x4, protein_name)
write_file(data)
Upvotes: 0
Views: 75
Reputation: 253
First you should get your indentations right (if it's not a copy&paste problem here).
Second: Why are you calling H()
before run()
? H()
is also called inside run()
.
Third: H()
does not have any return value. You assign the return value to data
in run()
but there is no such return value. I guess you want to add return candidates
at the end of your function H()
.
Fourth: You should use 'a'
instead of 'wb'
as file opening mode since you want to append every single line instead of overwriting it.
Upvotes: 2