Questions tagged [dna]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
28 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. ...
1
vote
1answer
23 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" ...
0
votes
0answers
19 views

DNA Pset6 Can't run my program

I cant even run my program it keeps saying "list index out of range". I don't know whats wrong... Does anyone have any idea? import sys import csv def repeats(seq, part): rep = [0] * ...
0
votes
1answer
62 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
0answers
58 views

PSET6 DNA [SPOILER] Refactor

I have solved the problem however is there anyway to optimize this further? Also, how do I judge the time-space complexity of the same? import csv from sys import argv, exit from csv import reader, ...
0
votes
0answers
14 views

my count is not working for csv.large [closed]

for j in range(len(STRs)): inilist = [i for i in range(0, len(sequence)) if sequence[i:].startswith(STRs[j])] for k in range(len(inilist)): k += 1 ...
0
votes
0answers
52 views

Confused about DNA in pset6

I've just started DNA, and I've got what seems to be a working algorithm to see if the count of the STRs in the database and sequence are the same, but it does not seem to be working. I've been a bit ...
0
votes
0answers
40 views

PSET 6 DNA! Stuck for so long

so the problem I face is when computing the greatest number of STR's in a sequence. I was able to hardcode "GATA" and compute the greatest sequence for a textfile using my sequencecount ...
0
votes
0answers
71 views

cs50 pset6 DNA, minor differences in counting STRs |Spoiler entire code included|

My code counts STRs for some people correctly, but for others the difference is very small. For example for python dna.py databases/large.csv sequences/5.txt expected output is Luna, whose STR counts ...
0
votes
1answer
30 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
28 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
29 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
0answers
36 views

SPOILER - CS50: Python PSET6. How do I ensure that my code does not show 1 and 2?

I am about halfway done with my python Pset6 code for DNA. One problem I have been having is that without this particular line of code below: lresults = [i for i in lresults if i != '1' and i != '2'] ...
0
votes
1answer
90 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
118 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
89 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
194 views

My code is 95% correct and I can't understand why. Why, Harry? WHY?

I can't figure out why just only one is not correct. I really need to understand this. Please, help me import sys import csv # Open sequence file sequence_file = open(str(sys.argv[2]), 'r') ...
0
votes
1answer
121 views

PSET6: DNA returns “no match”

import csv import sys def maxrepeats(sequences, substring): # calculate maximum consecutive frequency for each STR repeats = [0] * (len(sequences)+1) for i in range(len(sequences)-len(...
0
votes
1answer
63 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
1answer
97 views

PSet 6: DNA gives correct as well as wrong ouput

Problem Set 6: DNA gives output No Match No Match No Match No Match No Match No Match No Match No Match No Match No Match Lavender No Match No Match No Match No Match No Match No Match No Match No ...
0
votes
0answers
65 views

PSET6 - DNA - Code works for small database, but not large

I believe that the issue comes from my 'sequencing' function. When I run the small database, everything works, however, when I run the large database, the counts of specific STRs are incorrect. I'm ...
0
votes
0answers
47 views

Can you help me making my pset6's 'dna' more dynamic

I want suggestions on how to manage my so many lists in the loops. Hello helpful soul, I actually can't figure out how I can declare lists more dynamically, and thus using them in the loops easily. ...
0
votes
0answers
61 views

PSET6 DNA algorithm help and comparing data

I've really struggled with DNA trying to come up with a good algorithm. I have half my code written, but I have no idea how to compare the data in the Dict with the CSV file. Any thoughts would be ...
1
vote
0answers
33 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
41 views

Using csv.reader and csv.DictReader on the same file

I'm working on pset6 - DNA. My code is a work in progress, but the part I'm having trouble with is at the bottom. Right now I'm running without cmd line arguments, so I'm opening 1.txt and small.csv. ...
0
votes
1answer
83 views

Pset6, DNA - Convert all columns in a list to integers, skipping the first column

I'm trying to figure out how to take the csv file I opened and convert specific columns to ints since when the csv is opened and read, every element becomes an int. Inside of the for row in csv_list:...
0
votes
1answer
37 views

Counter fails to update for DNA

My dna program always returns no match and after debugging it I've pin pointed the problem to the counter not updating correctly. My program finds the correct number of matches, which I've confirmed ...
0
votes
1answer
168 views

DNA pset6 - Unable to calculate maximum STR repeats in DNA file

Below is my code for PSET6 DNA: from sys import argv import csv # "string" represents the DNA chain and "substring" represents an individual STR e.g. "ACTGC" def maxrepeats(string, substring): ...
0
votes
0answers
77 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
87 views

solved pset6 BUT still wondering

while reading the CSV file in these lines : csv_file = open(sys.argv[1], "r") # reading the csv file into memoery csv_reader = csv.DictReader(csv_file) when i tried to make a copy of the csv_reader ...
0
votes
1answer
122 views

PSET6 DNA - I passed every test it wanted me to do, but I got 42% after submitting?

I completed the DNA problem on pset6. There is a series of tests you need to enter into the command line before you submit, and I did all of them and passed every single one (as shown below). However, ...
0
votes
0answers
20 views

checking column for value results in wrong column being searched

I am trying to obtain obtain a column from a dataframe. I used panda to read the file. df = pd.read_csv(sys.argv[1]) When I am trying to access the df by a specific STR, the STR is placed as the ...
0
votes
1answer
69 views

MY code works with a hardcoded string, but not a string object

I'm working on pset6 2020 dna. I'm having trouble inputting the sequence file to be compared into my search function. If I just open the file and copy paste the sequence into the code as a string, it ...
0
votes
0answers
119 views

PSET6 DNA - Counting some of the STRs incorrectly

I've spent many days working on DNA and on the verge of giving up. I was hoping to get some help with my code. It finds some of the STRs correctly but miscounts the other STRs. I'm trying to ...
0
votes
0answers
49 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
0answers
106 views

Problems with PSET6 – DNA

I don't understand why my code below isn't working. Instead of printing out the name of the person, it simply prints out No match found every time, even when there is supposed to be a match. If anyone ...
0
votes
1answer
77 views

Python pset6 - should a file be closed at the end of the program or in the middle?

I'm slowly working through DNA on pset6 and I am running into some issues with the opening/closing of CSVs. I open the CSV using with open(database, "r") as csv_file: csv_reader = csv.DictReader(...
0
votes
1answer
224 views

Kind of lost in pset6 dna, How to compare the max number of occurrences of the STR's with the database?

I'm kind of lost I don't know how I can compare the max number of occurrences with the database. My program here can get the max number of it stored in a list called counts to get it I used a function ...
0
votes
1answer
242 views

Difficulty comparing sequence and individual in PSET6 DNA

I have nearly completed DNA in Pset6 of CS50 but I am having difficulty on the last section. I have managed to populate each of the max_AGATC, max_TTTTTTCT, max_AATG etc. with the correct values from ...
0
votes
0answers
72 views

Hello, why does my code only work with the small database but it's inaccurate for the large one?

i'm just working out my code for the correct cases! i know there are a few conditions I have to add when the user enters wrong input but i'll work on that later:) why does my code give me a wrong ...
0
votes
0answers
178 views

cs50 pset6 DNA Help (Spoiler Full Code Inside) i keep getting a no match

from csv import reader, DictReader from sys import argv if len(argv) < 3: print("error, python dna.py data.csv sequence.txt") exit() with open(argv[2]) as dnafile: dnareader = reader(...
0
votes
1answer
45 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
77 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
24 views

Stroring the header row from a csv file

Trying to store the header row of csv file, i.e. it's first row in a list after reading the file using reader(). Tried using next() and filednames() but none worked. Could anyone guide me how to ...
0
votes
0answers
205 views

Possible error in check50 for pset6 - DNA? Code attached, explanation given

My problem may be because of my misunderstanding of the problem statement, so please bear with me. This is what I have understood about the problem: You take one person out of the csv and check if ...
0
votes
1answer
200 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
273 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
2answers
218 views

PSET6(DNA)- How do I access the STR's from the list (first line of csv file) dna

so I basically finished the code but the problem is I can't access the first line of the csv file. What I did was this with open(sys.argv[1], newline='') as database: reader = csv.reader(database) ...
0
votes
1answer
416 views

Problem Set 6 - DNA (Using the DictReader function)

Currently my code functions in so far that I get the appropriate results for the maximum STR counts when I pass a certain sequence. However, I have no clue as to what I should do to progress; I tried ...
0
votes
0answers
374 views

PSET6 DNA [SPOILER]

during solving the dna problem i had a hard time trying to work out the large database " the small one work just fine" anyway i reached to this abstract solution to get "scores" of the sample dna so ...