Logic: I'm trying to do this in such a way that I check the database first, then I check the DNA sequence to see if that information corresponds to any of the information in my database.
I want to convert all my numbers that are, by default of using DictReader
, strings to integers. Then I can multiply my current STR by the number associate with that person
E.g Multiply 'AGATC' * 2
as it is for Alice in small.csv
.
THEN check if that matches any part of my DNA sequence.
Issue: Of course firstly I'll need to convert my actual numbers to ints. The way I'm iterating over my dict
I'm always hitting my name
column. How can I exclude this without removing it as I'll need it as a reference later?
Code
def main():
if len(sys.argv) != 3:
sys.exit("Usage: python dna.py data.csv sequence.txt")
# some placeholding lists
memory = []
database = sys.argv[1]
seq = sys.argv[2]
with open(database, "r") as fdata, open(seq, "r") as sequence:
reader = csv.DictReader(fdata)
strs = sequence.read()
for line in reader:
memory.append(line)
for row in memory:
for column in row:
row[column] = int(row[column])
if column * int(row[column]) in strs:
print(f"found", column)
else:
(f"Not this", column)