I am doing Problem Set 6 DNA. And it looks like the data given to me in the
large file is incorrect. When I am running my code with
small file it works fine. But when I run with
large file it is not working.
Here is my code:
from csv import reader from sys import argv def main(): if len(argv) < 3: print("Usage: python dna.py data.csv sequence.txt") exit() with open(argv, 'r') as file: readcsvdata = file.read() sequence_file = open(argv) line_list = list(sequence_file.readlines()) i = 0 count =  Recordcount =  readcsv = readcsvdata.split('\n') record = 0 while i < (len(readcsv)-1): if(i == 0): Row_Record = readcsv[i].split(",") No_Of_Column = len(Row_Record) count =  * No_Of_Column j = 1 while j < No_Of_Column: str1 = " " count[j] = len(str1.join(line_list).split(Row_Record[j].strip())) - 1 j += 1 j = 1 else: Row_Record = readcsv[i].split(",") j = 1 record = 1 while(j < (No_Of_Column-1)): num1 = Row_Record[j] num2 = count[j] #if(Row_Record[j]!= count[j]): if(num1.strip() != str(num2).strip()): record = 0 break j = j+ 1 if(record == 1): print(Row_Record) break i = i + 1 if(record == 0): print("No Match") sequence_file.close() main()
According to me I guess that the large file has got a mistake or is wrong.
Please help me with this, as soon as possible.