Conversation
SeunginLyu
left a comment
There was a problem hiding this comment.
Overall, it looks really good and you also went beyond what was required. I made a few stylistic suggestions for future reference. Keep up the good work!
| # -*- coding: utf-8 -*- | ||
| """ | ||
| YOUR HEADER COMMENT HERE | ||
| First project for Olin Software Design Fall 2017 |
There was a problem hiding this comment.
It might be more helpful to add some short description of what this project is about.
| if nucleotide_inputs[i] == nucleotide: | ||
| complement = nucleotide_complements[i] | ||
| i += 1 | ||
| return complement |
There was a problem hiding this comment.
I like how you implemented this function without using any if or else if statements. Now that you've learned what dictionaries are, you could do something like this as well :
nucleotide_complements' = {'A':'T', 'T':'C', 'C':'G', 'G':'C'}
return nucleotide_complements[nucleotide]
| pair = get_complement(letter) #finds complement | ||
| reverse = reverse + pair | ||
| i += 1 | ||
| return reverse |
There was a problem hiding this comment.
fancy one line code (pythonic stylistic suggestion) :
return [get_complement(c) for c in dna[::-1]]
| 'ATG' | ||
| >>> rest_of_ORF("ATGAGATAGG") | ||
| 'ATGAGA' | ||
| >>> rest_of_ORF("ATTTCGGGT") |
There was a problem hiding this comment.
Nice! Always add your own unit tests 👍
|
|
||
| for a in all_orfs_two: | ||
| return_list.append(a) | ||
| #print(return_list) |
There was a problem hiding this comment.
please remove commented lines when submitting your final code
| pass | ||
| orfs = find_all_ORFs_both_strands(dna) | ||
|
|
||
| #longest_size=len(max(orfs,key=len)) |
| if(leng > max_length): | ||
| max_length = leng | ||
|
|
||
| # maximum = max(lengths) |
| @@ -130,8 +197,17 @@ def longest_ORF_noncoding(dna, num_trials): | |||
| dna: a DNA sequence | |||
| num_trials: the number of random shuffles | |||
| returns: the maximum length longest ORF """ | |||
There was a problem hiding this comment.
One way to add unit tests for random functions is to use a fixed random seed. Check this documentation https://docs.python.org/3/library/random.html if this sounds interesting to you.
| amino_sequences.append(coding_strand_to_AA(snip)) | ||
|
|
||
| print(amino_sequences) | ||
| #print(len(amino_sequences)) |
| @author: Emma Westerhoff | ||
|
|
||
| """ | ||
|
|
There was a problem hiding this comment.
nice! I like the fact that you've learned the concept of dynamic programming. Something to think about : Now that you've learned about recursion, what would be the pros and cons of using recursion vs dynamic programming to tackle this problem?
No description provided.