Bioinformatics in Python: DNA Toolkit. Part 4: Translation, Codon Usage

  Рет қаралды 13,704

rebelScience

rebelScience

Күн бұрын

Пікірлер: 24
@BasicScienceSeries
@BasicScienceSeries 4 жыл бұрын
If you are getting Counter error : This is what worked for my Counter error: freqDict = dict(collections.Counter(tmpList)) Thanks rebelCoder for these videos ! Keep Going..
@mustafaburakzeybek3619
@mustafaburakzeybek3619 4 жыл бұрын
thanks a lot
@Sun48100
@Sun48100 4 жыл бұрын
saved my life thanks!!!
@tinos542
@tinos542 4 жыл бұрын
You are amazing! Thank you for this
@bryzsalvador8692
@bryzsalvador8692 4 жыл бұрын
return [DNA_Codons[seq[pos:pos...... len(seq) -2, 3)]
@rebelScience
@rebelScience 4 жыл бұрын
Basically, this is made to make sure we don't hit array/list out of bounds error and we also we scan every triplet (codon) in a string. As we have a third parameter '3' that will ensure we read 3 nucleotides, jump 3 positions, read another 3. I always suggest writing a simplified version of a code you are trying to understand and print() the results of every step so you can see what is happening: --- seq = "ATCGCATACA" k = 3 # With - 2 correction for pos in range(0, len(seq) - 2, k): print(seq[pos:pos + k]) Result: ATC GCA TAC # Without -2 correction: for pos in range(0, len(seq), k): print(seq[pos:pos + k]) ATC GCA TAC A ^-- this last, single nucleotide 'A' will result in a KeyError as we will try to search/match A in our DNA_Codons dictionary. And DNA_Codons only has triplets/codons. So we need to make sure we always read 3 nucleotides and any 'tail' is discarded. Try using VSCode debugger to see what is happening at every stage. Also join our Telegram/Matrix chat. It is easier to discuss code there.
@bryzsalvador8692
@bryzsalvador8692 4 жыл бұрын
@@rebelScience Thank you so much. I also tried omitting that "-2" and I found that I'm having a problem with that tail. Sorry I'm really new at this. Just started learning coding this sem. What I used to get around the keyerror was a function where if the len(seq) %3 = 0 or 1 or 2 and it trimmed nucleotides at the end that but I had problems when I tried to attach my reverse complement code and translation of that complement because the sequence is now trimmed.
@talkpython
@talkpython 3 жыл бұрын
Thanks a bunch for recommending @talkpython at the end of the video. :)
@吕萌-e3e
@吕萌-e3e 4 жыл бұрын
Hi, I have a little question about this part. When I use function -codon_usage, "freqDict = dict(Counter(tmpList)) NameError: name 'Counter' is not defined" was happened. I don't know why.
@rebelScience
@rebelScience 4 жыл бұрын
Hi! Did you watch previous videos ? We included that module before. You can see it on a line 3 in this video at 3:00
@吕萌-e3e
@吕萌-e3e 4 жыл бұрын
@@rebelScience I watched previous videos. Maybe I missed the key point. OK! I will check it again. Thank you!
@吕萌-e3e
@吕萌-e3e 4 жыл бұрын
@@rebelScience oh! I found it!
@rebelScience
@rebelScience 4 жыл бұрын
Good. Basically Counter is a method from Python's collections module. It has a lot of good stuff it it. You should search for a video on that module.
@吕萌-e3e
@吕萌-e3e 4 жыл бұрын
@@rebelScience Thanks for your advice!
@dylanneal8244
@dylanneal8244 3 жыл бұрын
what is the "-2" for in the translate_seq function? Great video by the way!
@rebelScience
@rebelScience 3 жыл бұрын
Hey! Someone already asked this in the comments and got an answer. Make sure you look through next time :) We read triplets in this function, right? Three amino acids at a time. -2 will ensure we stop at the very end and don't ready past the last three. Don't just take my word, and try using a small string of 9 and print every step, so you can see and understand why we are doing this. Try removing -2, see what happens, experiment, break things. Make sure you don’t just copy-past code.
@f-man3274
@f-man3274 2 жыл бұрын
Hi, thank you for video freqDict = dict(Counter(tmpList)) ^ SyntaxError: invalid syntax Do you know why that error can occur?
@proyectoalejandria6609
@proyectoalejandria6609 2 жыл бұрын
Did you try importing the Counter class from collections?
@dr.lokbahadurshrestha4507
@dr.lokbahadurshrestha4507 3 жыл бұрын
In codon usage, I am getting "seq_type" is not defined.
@ariellewolter8296
@ariellewolter8296 2 жыл бұрын
same
@moa4f223
@moa4f223 4 жыл бұрын
I have counter is not defined and i don't know which video to watch (it's title) pls
@rebelScience
@rebelScience 4 жыл бұрын
Hey! 'counter' is a method, that is built-in to Python. Python has this cool module, called 'collections', right? We use some of that functionality. 'counter' method is one of them. You can just make sure you include that module by adding it on the very first line in your file: 'from collections import counter' or you can watch the very first video in this series here: kzbin.info/www/bejne/jZzbYZl_acpjnNU
@ethan_bodybuilder
@ethan_bodybuilder 4 жыл бұрын
Hi rebelCoder if you were to try and join the amino acids together and omit the [] and '' how would you do that?
@CakeAndPi3
@CakeAndPi3 4 жыл бұрын
return "".join([DNA_Codons[seq[pos:pos+ 3 ]] for pos in range(init_pos, len(seq) - 2, 3)])
Bioinformatics in Python: DNA Toolkit. Part 5: Open Reading Frames
6:42
Rosalind Problems: Counting DNA Nucleotides
8:23
rebelScience
Рет қаралды 25 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 29 МЛН
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
Examining DNA Sequence Content with Basic Python
15:26
Professor Hendrix
Рет қаралды 7 М.
Rosalind Problems: GC Content, FASTA File Format, Data Processing
17:02
Five steps for getting started with bioinformatics
17:40
OMGenomics
Рет қаралды 90 М.
Reading FASTA files in python3 : Tut2
9:35
Shad Arf
Рет қаралды 29 М.
How to Run a Regression in Python
9:20
Mike Jonas Econometrics
Рет қаралды 26 М.
Getting started with bioinformatics
18:53
OMGenomics
Рет қаралды 79 М.
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 29 МЛН