Skip to main content

Questions tagged [dna]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
319 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, ...
real trash's user avatar
1 vote
1 answer
727 views

DNA code doesn't work sometimes

OK, so I`ve got a strange bug in my DNA code. Basically, it works fine, but somehow it gives incorrect output at samples 6, 8, 9, 19. When I looked more carefully through my STR check results, it ...
Taras  Lysak's user avatar
1 vote
1 answer
304 views

PSET6: DNA check50 expecting no match on txt18 ,but my program returns harry

my code works for all the other tests on check50 besides the one for txt18. I checked the Large.csv file and the return value of longest_match function (both provided by cs50) and they match up yet ...
ITz_tact1cz's user avatar
1 vote
1 answer
65 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 ...
user13641095's user avatar
1 vote
0 answers
121 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....
Yoda's user avatar
  • 11
1 vote
1 answer
46 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" ...
Rob Watt's user avatar
1 vote
0 answers
119 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, ...
jReX's user avatar
  • 13
0 votes
1 answer
273 views

Why can't I print the entire string from the read file?

For the DNA assignment in pset6, I'm trying to print out the output of slicing the string that was read from one of the DNA sequence text files, which reads as follows: ...
Daniel Hering's user avatar
0 votes
1 answer
105 views

pset6 DNA // having problem comparing elements from the database and the sequence file

Hi there I am having an issue comparing the data I have extracted from the sequence and the database files for now I am doing a sort of in efficient way but later I will fix it I am not sure really ...
Arsham's user avatar
  • 27
0 votes
1 answer
436 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 ...
Alexander Alexandrov's user avatar
0 votes
1 answer
436 views

DNA: Errors in sequences.3 and 18.txt

I have worked hard on writing codes for DNA. Everything works except for sequences/18.txt, which returns "Harry" instead of "No match". The problem still exists in spite of several ...
Winnie HO's user avatar
0 votes
2 answers
432 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) ...
jankendrick's user avatar
0 votes
1 answer
952 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 ...
Sorphil's user avatar
  • 27
0 votes
1 answer
548 views

DNA doesn't work with large database

My program gives valid output with small databases, but with large I always get "No match". Do you have any idea what may be the cause ? Belowe is my code, It may seem a little messy so if you find it ...
Bijacz's user avatar
  • 50
0 votes
1 answer
23 views

PSET 6 - DNA - Checking the equality of STRs

This is my loop to check the equality of STR counts, csv list is a list storing data of the csv file and STRlist is a list storing all the STRs. It prints the wrong name, I guess it has something to ...
Ronit Kumar Singh's user avatar
0 votes
1 answer
8 views

PSET 6 - DNA - Is there something wrong with my if statement?

The individual conditions are satisfied as checked by print statement, but when I consolidate all conditions in my if statement, the does'nt seem to print the name. Any ideas?, is there something ...
Ronit Kumar Singh's user avatar
0 votes
1 answer
328 views

pset6 DNA - help creating and referencing dictionaries

This may be a strange question - my code actually worked, but I feel like I got to a solution by brute force, rather than something more elegant. I'm still not sure how to create and reference ...
Cyrus's user avatar
  • 1
0 votes
1 answer
176 views

DNA - String Compare

I have a question about DNA, specifically this while statement: while dna_string[char: char + length_str] == dna_string[char - length_str: char]: I'm not getting dna_string[char - length_str: char] ...
Drallas's user avatar
0 votes
1 answer
108 views

PSET6 DNA Why is my (count consecutive substrings in string) function always returns 0's?

I tried writing different function variations but my count_dna function keeps returning zeroes (despite having consecutive sequences of STRs in the dna sequences)--can anyone please tell me why? Note: ...
General Noob's user avatar
0 votes
1 answer
85 views

What does "consecutively" mean in pset6 DNA?

I am working on pset6 DNA and I'm not sure I understand the terms of the problem. The objective is to write a program that matches a DNA sequence to a person in a DNA database based on the largest ...
Eystein Thanisch's user avatar
0 votes
1 answer
79 views

PSET6 DNA Think I'm getting an infinite loop which is apparent when testing with every txt file after 4.txt

Hi all I'm having trouble for PSET6 DNA. My code works fine for everything up until and including 4.txt but whenever I go to check the large.csv file and thus 5.txt, 6.txt, 7.txt and so on I seem to ...
M-J -Y's user avatar
  • 1
0 votes
1 answer
180 views

PSET 6 DNA - Computing STRs

I am trying to compute the most repeated STR for each sequence in a dictionary called str_dict. # compute STRs i = 0 # stablish length of the sequence length_seq = len(sequence) # iterate through all ...
Jaime's user avatar
  • 15
0 votes
1 answer
99 views

Computing consecutive STR is sometimes off by a little (Spoiler!)

My code works fine for the small csv file; however, when I get to the big csv file, my counts for the number of consecutive STR are less than the actual value by about 1 or 2. Here is my code: import ...
dillon__nguyen's user avatar
0 votes
1 answer
254 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') ...
Luana Nunes's user avatar
0 votes
1 answer
245 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:...
JackJack's user avatar
0 votes
1 answer
63 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 ...
Mike S's user avatar
  • 1
0 votes
1 answer
511 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): ...
lukezr's user avatar
  • 1
0 votes
1 answer
210 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, ...
flashwingfelix's user avatar
0 votes
1 answer
140 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 ...
Renée's user avatar
  • 19
0 votes
1 answer
400 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 ...
Willis0's user avatar
0 votes
1 answer
53 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 ...
Ayush's user avatar
  • 7
0 votes
1 answer
2k views

PSET6 DNA How to read each value in the CSV file?

In PSET6 DNA, I have to read the CSV file. I use with open("P:\Code\Python\dna\databases\small.csv") as csvfile: #open on my PC dna_db = csv.DictReader(csvfile) for row in dna_db: ...
saquiel's user avatar
  • 153
0 votes
1 answer
2k views

PSET 6 - DNA - How to pass only value in python

~~~python import csv import sys import copy dbPath = sys.argv[1] seqPath = sys.argv[2] if len(sys.argv) > 3: print("error") exit() str_list = [] DB = open(dbPath, 'r') DBreader = csv....
PKiong's user avatar
  • 103
0 votes
2 answers
706 views

PSET 6 - DNA.py faiils checks 2 out of 21 text files. (8.txt and 9.txt.)

My code works fine for 19 out of 21 SRT Counts but fails check on 8.txt and 9.txt files. I am not sure what I am doing wrong. Have tried many different approaches but to no change of luck. please if ...
Sarabjot Singh's user avatar
0 votes
0 answers
34 views

cs50 dna pset 6 - i dont get why my code always return no match

this is my code. whenever i run this code it always returns no match. i cant seem to get the error. pls help me. import csv import sys def main(): # TODO: Check for command-line usage if ...
dhan8293's user avatar
0 votes
1 answer
33 views

My code look correct and work correctly for all other sequence but check50 says sequence/18 is wrong, expected "No match" not harry

import csv import sys global y def main(): y = 0 x = 0 t = 0 # Check for command-line usage if len(sys.argv) != 3: sys.exit("Usage: python dna.py data.csv sequence....
Michael's user avatar
0 votes
1 answer
100 views

My code looks and works correctly but check50 fails

import csv import sys global y def main(): y = 0 x = 0 # Check for command-line usage if len(sys.argv) != 3: sys.exit("Usage: python dna.py data.csv sequence.txt") ...
Michael's user avatar
0 votes
1 answer
33 views

PSET6 DNA storing STR subsequences in a dictionary

I am working on one of the TODOs where the longest match of each short tandem repeat (STR) needs to be found from the DNA sequence read—written as just "sequence" in this code. To check ...
Jae-Min's user avatar
0 votes
1 answer
279 views

CS50 DNA prints "No match"

My pset has some issues,can you please tell me what do i have to change in the main function in order to print name of longest DNA matched person. import csv import sys def main(): # TODO: Check for ...
Kh12769's user avatar
0 votes
0 answers
143 views

pset6 I just don't understand what I have to do

import csv import sys counter = 0 def main(): if len(sys.argv) != 3: sys.exit("Usage: python dna.py data.csv sequence.txt") # Open csv file and read it's contents into memory ...
Pahilajani Palak's user avatar
0 votes
1 answer
120 views

Pset6 - DNA - Strange Error

I'm in the [ Testing ] section and my program works fine with [ small.csv ], but the expected data is not the same as the real data: For example: If I run this: python dna.py databases/large.csv ...
Code Maker's user avatar
0 votes
1 answer
101 views

DNA Max Sequence Bug | Working on small.csv but not on large.csv

This is the complete code: """ - open csv file and sequence , read contents - for each str, compute longest chain - compare str counts aganist ech row in csv file """...
Agnij Moitra's user avatar
0 votes
1 answer
116 views

Pset 6 - Dna - My outputs are slightly incorrect. Could someone help me figure out what might be the problem here?

I've been stuck on this question for a week. After countless hours of debugs, I decided to post it here. Please refer to images and code snippets below and kindly explain to me what might be the ...
Orbey Paltaci's user avatar
0 votes
1 answer
173 views

Minor change in pset6/dna required, need some help or hint

I am really really close to completing pset/dna. But there seems to be some problem in the 'if statement'. Somebody please guide. Before the line of underscores in the terminal, I have printed the ...
Raghav Gupta's user avatar
0 votes
1 answer
101 views

pset6 DNA works with small database but not with the large one

For some reason, when counting the times a substring repeats within a string (a STR in a DNA), my code fails with the large database. It is not a matter of overlapping sequences, because the numbers ...
Lucas RH's user avatar
0 votes
1 answer
127 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) ...
Anon's user avatar
  • 5
0 votes
2 answers
31 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 ()
Olhuwhorlhey's user avatar
0 votes
1 answer
123 views

Getting ONE error on check50 for DNA - ValueError: max() arg is an empty sequence - Where is the bug?

I'm so close the finish line, but I get error on one out of the 21 CS50 tests. The test that is generating the error is number #2, which is: python dna.py databases/small.csv sequences/2.txt And I ...
Alexander's user avatar
  • 145
0 votes
1 answer
218 views

DNA - Getting the highest key value from a defaultdict

I have come a bit on DNA and have managed to write an algorithm for adding the number of matches in the sequence to a defaultdict. But I'm having problems with how to get the maximum value from the ...
Alexander's user avatar
  • 145
0 votes
0 answers
73 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 ...
Mazen's user avatar
  • 5