Questions tagged [dna]

The tag has no usage guidance.

40 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
40 views

DNA: Excluding a column from my dict iteration

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 ...
1
vote
0answers
111 views

PSET 6 DNA ~ some STR count is above the correct value by 1?

I'm almost done with pset6 hopefully but I have one problem with my code When i run it with for example python dna.py databases/small.csv sequences/4.txt python dna.py databases/large.csv sequences/10....
1
vote
1answer
43 views

Unexpected error in homemade string search function

I am playing around with Python on the DNA problem. I realize there are some string methods that might make this problem easier but my gut instinct was to try and make an "search function" ...
1
vote
0answers
94 views

PSET6: dna.py, updating dictionary

I'm struggling with Python, specifically adding/updating keys and values in a dictionary. This is my code so far (I know it's probably far from perfect, this is my first time working with Python, ...
0
votes
0answers
27 views

There is something wrong with the DNA file

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 ...
0
votes
0answers
21 views

How to get the index of iteration from the 'for' loop?

I've been trying to solve pset6 (DNA in specific). I finished all of its parts but stuck on the part of comparing two lists. A list of lists containing the STR repetitions of each person (sth like ...
0
votes
0answers
20 views

My DNA program is showing me this error repeatedly

The error is written below: Traceback (most recent call last): File "/home/ubuntu/pset/pset6/dna/dna.py", line 54, in <module> main() File "/home/ubuntu/pset/pset6/dna/dna....
0
votes
0answers
26 views

Code Pset6 - DNA fails: no result at all

Can anyone please give me a hint? I've been working on my code for days now and I don't have a clue how to fix it. My code is included below. import csv from sys import argv, exit #initialize ...
0
votes
1answer
76 views

PSET6 DNA Almost done - matching not working correctly

I have been stuck with last part of the code that is supposed to match the DNA sequence from sequence.txt with the one in database.csv. It passes most of the tests in check50 and fails only in ...
0
votes
1answer
67 views

pset6 - DNA - works for small.csv but not large.csv

import csv import sys with open(sys.argv[1], 'r') as file: # stores data from small.csv in both dict and list form dna_names_dict = csv.DictReader(file) ...
0
votes
1answer
20 views

Index to integer

How do i convert an index to an integer? I tried int(index), that didnt work. For example; S = [a,b,c,d] For index in S: n = int(index) print (n) break print ()
0
votes
0answers
86 views

pset6 dna question regarding searching string for substring, two types of code give different output

I am currently following along ayoutube tutorial for pset 6 DNA, and have a small question regarding a specific function. In this function, it basically takes a substring and a string, and counts the ...
0
votes
0answers
52 views

CS50 PSET 6 DNA Just Returns First Name

I've been working on DNA for a while now and thought I was done, but there's a problem with my code. Everytime I run it, the program just prints the first name on the database, so either 'Albus' or '...
0
votes
1answer
44 views

Print keys of CSV files in DNA pset6

I want to see what the keys of the reader dictionary are so I use the print(key) function. The result is all the lines of the dictionary. Why is that? import csv from sys import argv, exit # Check if ...
0
votes
0answers
22 views

DNA code can't count

My program always return 'no match' and it's because it can't count the occurence of a substring. I have spent a lot of time trying to figure it out, so I hope someone can help me. here's the function....
0
votes
1answer
130 views

pset6 count STR in the DNA sequence issues

so i m a bit confused...i have been testing my code using the small database and what i have so far produced what i expected .... more specifically the STRcounts (i marked that part #?????). it is ...
0
votes
1answer
215 views

PSET 6 DNA: How to get number of repeats for each value of STR's? [SPOILER: Full code]

I have written a code to count the highest number of consecutive repeats of specific DNA substring sequences in a long string of DNA...or so I thought. While my code can correctly count the longest ...
0
votes
1answer
66 views

Issue with recording STRs in memory (PSET6 - DNA)

I'm trying to record the number of repetitions of each str in the sequence. I created a dictionary as below and another empty dict because i couldn't update a dict while iterating through it. But for ...
0
votes
1answer
254 views

Struggling with PSET6 DNA

I've been doing this for quite some time now, but I'm struggling to get the appropriate output. In the below code (which is incomplete as of now, but the main pieces are all on the board), I'm not ...
0
votes
1answer
198 views

Pset6 DNA Not matching to names in the database

The print statements seem to turn out what I hoped for up until trying to compare the STR counts to the database STR counts. I would just appreciate any pointers of where I'm going wrong thanks. ...
0
votes
1answer
216 views

Pset6 DNA help - trouble calculating STR repeats with long database

I have really tried to just solve this one myself but after a few weeks this seems futile without guidance. I am having trouble getting a for loop to calculate the maximum consecutive occurrences of ...
0
votes
1answer
60 views

Desperately need help with DNA Python! please help!

Desperately need help with my DNA python code. I get the correct sequence printed out but I can't seem to find a working comparison code. Please someone take a look: https://pastebin.com/DCdxtxMx
0
votes
1answer
57 views

Help with Python DNA!

Here is the code I have an issue with: https://i.ibb.co/0VrvCqj/code2.jpg It works for small databases but not the big ones. Here the code works and shows Albus when it should show Lavander. As you ...
0
votes
0answers
43 views

How can I compare 2 dataframes on DNA?

obtained 2 data frames but I really don't know how can I compare them. Do you have any ideas? ~/pset6/dna/ $ python dna.py databases/small.csv sequences/1.txt name AGATC AATG TATC 0 0 4 1 ...
0
votes
1answer
142 views

PS6 - DNA (Python) Weird problem counting STRs

Which part of the problem are you working on? I am at a very early stage of the problem, trying to scan a specific sequence for STRs, counting how many times they show up and storing this count as a ...
0
votes
1answer
221 views

PSET6 DNA only getting no match

I've been stuck on this pset for days, trying to get some help here :x Basically my program only outputs no match no matter what I do. I tested my re.finditer separately and it prints out what I want, ...
0
votes
1answer
105 views

Else is ruining my code in dna and I don't get why

I'm trying to record the longest run of each STR I need and I'm close. Without the final "else" the code works fine with small dictionary and almost fine with long (because the count I ...
0
votes
1answer
96 views

pset6 DNA - range() not working as expected

DNA was a breeze until I got to the part where I have to check the dna sequences for patterns. Regardless of wich file I pass to the program it always detects only 1 repetition for every pattern. ...
0
votes
0answers
111 views

DNA is good for the small database but not for the large database - CS50 Pset6

I'm currently developing the small and the large database functions separately and I wonder why in the large one it does not keep track of the STR repetitions. Here is my code from both functions: ...
0
votes
0answers
90 views

Need help with Iteration & Compare DNA - CS50

I need help building code to iterate through the DNA sequence and then compare it with Names in CSV. Can anyone please guide me on how to proceed from the code written below with proper comment ...
0
votes
1answer
123 views

pset6 DNA: check50 ran into an error while running checks! at checking 'dna.py exists!'

The code runs for all 20 sequences on the terminal but during submit50/check50, it runs into an error with the following log: the code is attached for reference. import csv import sys if __name__ ==...
0
votes
2answers
109 views

cs50 pset6 takes too long to run

I am trying to improve my code for pset6, it works but currently takes a few minutes for the larges files. Can I get some help as to how to improve performance? from sys import argv, exit import csv ...
0
votes
1answer
214 views

My DNA code works with the small database but not the large one

My code works perfectly fine with the small database but gives "No Match" for the large one and I can't figure out why. Any help would be appreciated! import csv from sys import argv, exit def main()...
0
votes
1answer
391 views

PSET 6 DNA.py wrong output [spoiler]

I am a beginner in cs50 and I have a problem with the DNA problem that gives the wrong result for most of the queries. I wonder if anyone could point where is the mistake. ie. python dna.py databases/...
0
votes
1answer
2k views

cs50 pset 6 DNA. How to compare my results with the databse to print out the answer?

I got to a point in this problem where my code was working alright for the small csv, but it was clumsy and repetitive, so I tried to make it more elegant by making more complicated nested loops to ...
0
votes
1answer
636 views

pset6 DNA. My code passes all tests but this one: python dna.py databases/large.csv sequences/18.txt

from sys import argv, exit import pandas as pd # Checks if the number of files is correct if len(argv) != 3: print("Usage: python dna.py data.csv sequence.txt") exit(1) # Reads the text file ...
0
votes
0answers
2k views

PSET6 DNA need some help and hints

I started to do DNA and I dont't have any idea what to do next. Having done the first part with opening a file and checking command line I don't know how to check number of repetitions. I tried to use ...
0
votes
1answer
172 views

cs50 pset6 dna error while reading two file 8.txt and 9.txt

import sys import csv AATG, GATA, TATC, TCTG, AGATC, GAAA, TCTAG = 1, 1, 1, 1, 1, 1, 1 TTTTTTCT = 1 temp = 0 if int(len(sys.argv)) > 3 or int(len(sys.argv)) < 3: print("Usage: python dna.py ...
0
votes
1answer
708 views

PSET6 DNA Sumbit50 not matching with usual output

Hello, After a lots of effort I was finally able to implement DNA and it works correctly ! but Submit50 shows correct output for text file (1-5) but incorrect for rest The text file which have ...
0
votes
1answer
66 views

DNA pset6 My code works fine in small csv, but not large (Spoiler)

The problem happens with the count when i try to count STRs, it counts some str right and some wrong, which is strange for me, and when i deal with small csv all works fine. can someone help me in ...