hello everyone rabble Cora here today we're going to continue our work on DNA 大家好，今天我们在这里狂欢Cora，我们将继续进行DNA研究
toolkit last time we left off and these two functions one of them was validating 我们上次停止使用工具箱时，这两个功能之一正在验证
the sequence and the other one was counting nucleotides and we use this 序列，另一个在计数核苷酸，我们使用这个
function as well to solve one of the problems on Rosalyn so today we are 也可以解决Rosalyn的问题之一，所以今天我们是
going to add two more functions to our DNA toolkit and those functions will 将向我们的DNA工具包中添加另外两个功能，这些功能将
replicate a real biological function let me switch to the browser so I can show 复制真实的生物学功能，让我切换到浏览器，以便我可以显示
you what we are going to work on today so two steps are transcription and 您今天要进行的工作有两个步骤，分别是转录和
translation we have been working with a single DNA string DNA sequence but we 翻译我们一直在处理单个DNA字符串DNA序列，但是我们
did not generate a DNA reverse complement so we are going to implement 没有产生DNA反向补体，所以我们要实施
this function today to generate this other missing part and then we're going 今天该功能来生成其他缺少的部分，然后我们将
to implement a function that generates RNA from our DNA and of course we're 实现从我们的DNA生成RNA的功能，当然
going to go into translation in our upcoming videos so let me show you a 我们将在即将到来的视频中进行翻译，所以让我向您展示
couple more images here so here we have a DNA again we only work with one part 这里有更多的图像，所以这里我们有了DNA，我们只处理一个部分
we're going to generate a second part and then we're going to use 我们将生成第二部分，然后我们将使用
transcription to get an RNA from our DNA string okay so again we're going to 转录以从我们的DNA字符串中获得RNA，好了，我们再次
implement step one and step two I'm going to link these images in the 实施第一步和第二步，我将链接这些图像
description as well so let's go back to our code so again that's where we left 以及描述，所以让我们回到我们的代码，再说一遍，就是我们离开的地方
off let's just run it again and see if it works okay it still does work so 让我们再次运行它，看看它是否还可以
we're going to create our first function here let me copy that from my snippets 我们将在这里创建我们的第一个功能，让我从片段中复制该功能
we're going to go back to DNA toolkit so next function is going to be 我们将回到DNA工具包中，因此下一个功能将是
transcription so you probably know what transcription is it's the process where 转录，所以您可能知道转录是什么过程
DNA is transcribed into RNA to be used to create proteins from codons but again DNA被转录为RNA，用于从密码子中产生蛋白质，但同样
we're going to look into that in our next upcoming videos so here the only 我们将在接下来的视频中对此进行研究，因此这里唯一的
thing we do is we take the sequence of DNA and we're replacing T thymine with 我们要做的是获取DNA的序列，并用T取代胸腺嘧啶
you uracil so let's go back to our code here and actually try running this very 您尿嘧啶，所以让我们回到这里的代码，然后实际上尝试运行
small and simple func but it is a very powerful biological 小而简单的功能，但这是一个非常强大的生物学功能
process so let's try printing out the result of this function which is called 处理，所以让我们尝试打印出此函数的结果，即
transcription we can see that it is in our DNA toolkit that's why it's 转录，我们可以看到它是在我们的DNA工具包中，这就是为什么
auto-completed and we're going to pass a DNA string to 自动完成，我们将传递一个DNA字符串给
it the one we generated before so now we're gonna run it okay so now we can 它是我们之前生成的那个，所以现在我们可以运行它了，所以现在我们可以
see two outputs which is counting nucleotides and then RNA string that has 看到两个输出，它们正在计数核苷酸，然后是具有
been generated from our DNA string so for the examples sake we're going to 是从我们的DNA字符串生成的，因此出于示例的考虑，我们将
annotate all of the outputs so it is much easier to read and understand what 注释所有输出，因此更容易阅读和理解
is actually happening on every step so let me copy and paste some of that stuff 实际上发生在每个步骤上，所以让我复制并粘贴一些东西
from my notes here so let's try printing out our results and very readable and 从我这里的笔记中，所以让我们尝试打印出我们的结果，并且可读性强，
easy to understand manner so let me try running this here and as you can see we 易于理解的方式，因此让我尝试在此处运行此程序，如您所见，
can see the sequence that were generated right here that's a 50 nucleotide long 可以看到这里生成的序列长度为50个核苷酸
sequence and of course we can see that the length is 50 nucleotide frequencies 序列，当然我们可以看到长度为50个核苷酸
here too okay so we have all original three steps annotated let's add our new 这里也很好，所以我们对所有原始三个步骤都进行了注释，让我们添加新的
step that we just added a function for it is going to be DNA to RNA 我们刚刚添加了功能的步骤将是DNA到RNA
transcription and let's try running this here too okay so now we have a clear 转录，让我们尝试在这里也可以正常运行，所以现在我们有了一个清晰的
step by step execution this will matter in the future because we're gonna 一步一步执行，这将在将来很重要，因为我们要
combine a lot of different functions to actually get our last final result 结合了许多不同的功能，实际上得到了我们最后的最终结果
example would be where we have a DNA string it has to be converted to RNA 例子是我们有一个DNA字符串，必须将其转换为RNA
then we are going to try looking for codons and then match them with amino 然后我们将尝试寻找密码子，然后将其与氨基
acids to build an amino acid sequence that is a protein so step by step output 酸来构建蛋白质的氨基酸序列，因此逐步输出
is very important in this case as we will see in our future videos okay so we 在这种情况下非常重要，因为我们会在以后的视频中看到
can see that this actually works and the easiest way to understand if it works it 可以看到这确实有效，并且是了解其是否有效的最简单方法
should match this string exactly but instead of thymine we're gonna have your 应该完全匹配此字符串，但不是胸腺嘧啶，我们有您的
cell okay so it's CAC GA T and after a we have W and we have double T here so 单元格好，所以它是CAC GA T，a之后有W，这里有double T，所以
this is a very simple function and it works so now we're going to implement 这是一个非常简单的函数，它可以正常工作，所以现在我们要实现
our second function which is a reverse complement 我们的第二个功能是反向补码
for this function we're going to use a dictionary of complement nucleotides 为此功能，我们将使用补体核苷酸字典
this one here so let me explain why would we need that it is the easiest and 这个在这里，所以让我解释一下为什么我们需要它是最简单的
the fastest way to actually swap the characters so we're going to pass a DNA 实际交换角色的最快方法，因此我们将传递DNA
string to our function and is going to see if it's a we're going to swap it 字符串到我们的函数，将要查看是否是一个，我们将交换它
with T if it's T we're going to swap it with a so let's look at this image and 与T如果是T，我们将其与交换，让我们看一下这张图片，
this is the biological process we're trying to replicate encode which is 这是我们试图复制编码的生物学过程
reverse complement if we're going to find in our original string a we're 反向补码，如果我们要在原始字符串中找到a
going to swap it with T go find T with swap with a and so forth okay let's go 将其与T交换，去寻找与a交换的T，以此类推，走吧
back to the editor so let's implement our function I'm going to copy and paste 回到编辑器，让我们实现我们的功能，我将复制并粘贴
that from my snippets here okay so here's the function the only thing we do 从我的摘录中可以，所以这是我们唯一要做的功能
here is we loop through our sequence that we pass to this function and then 这是我们遍历我们传递给该函数的序列，然后
we reverse it so in this part right here we are using list comprehension again 我们将其反转，因此在本部分中，我们将再次使用列表推导
and we are giving it a DNA sequence that we passed to this function it is going 我们给它一个传递给该功能的DNA序列
to loop character by character and then let's say first character nucleotide is 逐个字符地循环，然后说第一个字符核苷酸是
a it is going to go into that dictionary pass a to it and look at this thing 它要进入该词典，将其传递给它，然后看一下这个东西
right here if we pass a we're going to get T back let's say we're passing G 就在这里，如果我们通过a，我们将取回T，假设我们正在通过G
let's say next nucleotide is G we are going into our dictionary with G & G 假设下一个核苷酸是G，我们将与G＆G一起进入字典
returns C and this way we're swapping characters the other interesting part 返回C，这样我们交换字符的另一个有趣的部分
right here is this this is the Python way of basically reversing the string 就在这里，这是基本上反转字符串的Python方法
just to give you a quick refresher let's see how it works if you're not sure so 只是为了让您快速入门，如果您不确定，请看一下它是如何工作的
let's do a temporary string and test okay if we're going to print this string 让我们做一个临时字符串，如果要打印此字符串，请测试一下
right now we're going to see test let's do the reverse and run it again it's T 现在，我们将看到测试，让我们做相反的操作，然后再次运行它，它是T
as et so this is how it works so the only thing this function does it loops 正如et这样，它是如何工作的，因此此函数唯一循环的事情
through the DNA string that we'd give it and it matches that with complement 通过我们给它的DNA字符串，它与补码匹配
nucleotides from this dictionary okay so let's do a quick test and now 字典中的核苷酸好吧，现在让我们进行快速测试
we can make it a nice output as well we're going to print out reverse 我们也可以使它成为一个不错的输出，我们将打印出反向
compliment and we're going to give it our DNA string here let's see what we 赞美，我们将在这里给它我们的DNA字符串，让我们看看我们
get okay so this is the output so we can actually check it very easy it's T here 可以，所以这是输出，因此我们可以非常方便地检查它是否在这里
and it's a here and we know that a is what was T and T is swapped with a and 在这里，我们知道a是T，而T与a互换
then it's reversed okay so this actually works I have created a very nice way to 然后将其反转好，所以这实际上可行，我创建了一种非常好的方法
output this to kind of simulate a DNA pattern let me copy and paste that from 输出此内容以模拟一种DNA模式，让我复制并粘贴
my snippets let's run it here and as you can see I've also added a notation of 我的摘要让我们在这里运行，如您所见，我还添加了
five prime end to three prime end and three prime end to five prime end and 五个主要端到三个主要端，三个主要端到五个主要端，
this is sort of a a connection between nucleotides so this way we can actually 这是核苷酸之间的一种氨基酸连接，因此我们可以
see what is going on step by step we have one two three four steps and we 看一步一步，我们有一个一二三四个步骤，我们
know what's happening at every single step in our case because we're going to 知道在我们的案例中每一步都发生了什么，因为我们要
be adding so much more functionality to our DNA toolkit it is a very good idea 在我们的DNA工具包中添加更多功能，这是一个非常好的主意
to split that into multiple files so we're going to create a file called 将其拆分为多个文件，因此我们将创建一个名为
sequences pi right here let me create a new file and we're going to move all of 序列pi在这里，让我创建一个新文件，我们将移动所有
our sequences here we're going to have a lot of different ones we can have 我们在这里的序列我们将拥有很多不同的序列
protein RNA DNA code and sequences so it is a good idea to keep them in a 蛋白质RNA DNA编码和序列，因此最好将它们保留在
separate file okay so now let's import that structures import everything just 单独的文件好了，所以现在让我们导入该结构，导入所有内容
to make sure it still works let's go back here and run our code okay 为了确保它仍然可以正常工作，让我们回到这里并运行我们的代码
as we can see generates a random string every time so it's very nice to see you 如我们所见，每次都会生成一个随机字符串，所以很高兴见到您
know different strings every time we run and of course it is going to look much 每次我们运行时都知道不同的字符串，这当然会看起来很多
more interesting when we apply our code to a real genome and we find real 当我们将代码应用于真实的基因组并且发现真实的
proteins real sequences in the future okay so now we have an extra file here 蛋白质在未来的真实序列好吧，所以现在我们在这里有一个额外的文件
structures we're going to populate this file with a lot of different structures 我们将使用许多不同的结构填充此文件
in the future now we implemented two new functions we tested that they work one 在将来，我们现在实现了两个新功能，我们测试了它们是否可以正常工作
other thing I wanted to add is it is a very good idea to use a good 我想补充的另一件事是使用好
code editor that will do all the completion for you it will give you 代码编辑器将为您完成所有工作
extra information about the functions that you use and leaving a good comments 有关您使用的功能的更多信息，并留下良好的注释
is a very good approach to so let's say we switch to this main file here then we 是一种非常好的方法，所以假设我们在这里切换到该主文件，然后
have these functions that we use transcription for example if I just 具有这些功能，例如，如果我只是
pointed it it just says transcription here it just says reverse complement 指出它只是说转录在这里它只是说反向补语
what we can actually do we can add a dark strings to that these functions are 我们实际上可以做什么，我们可以在这些函数中添加暗字符串
not very complicated so you know translation or transcription or reverse 不太复杂，所以您知道翻译，转录或反向
complement the names of the functions tell you exactly what they do 补充功能名称，告诉您确切的功能
but we can always add extra information okay so let's do this this is how you 但是我们总是可以添加额外的信息，所以让我们这样做，这就是您的方式
define a doc string let's save this file now and let's go back to our main file 定义一个文档字符串，让我们现在保存这个文件，然后回到我们的主文件
here and let's point at this function right now this is much nicer it's as 在这里，让我们现在指向此函数，它的功能要好得多
transcription that's name of the function it accepts sequence and this is 转录是它接受序列的函数的名称，这是
what it does it translates DNA to RNA and it replaces thymine with uracil so 它能将DNA转化为RNA，并用尿嘧啶代替胸腺嘧啶，所以
leaving comments like that in your code especially if your functions are very 在代码中留下这样的注释，特别是如果您的函数非常
complex is a very good idea let's actually do the same thing for our 复杂是一个好主意，让我们实际上为我们做同样的事情
next function we're going to add our doc string here and let's go back to our 下一个函数，我们将在此处添加文档字符串，然后回到我们的
code here and pointed it okay so we're swapping adenine with thymine and 在这里编码，并指出可以，所以我们将腺嘌呤与胸腺嘧啶和
guanine with cytosine and reversing newly generated string okay so let's 鸟嘌呤与胞嘧啶并逆转新产生的琴弦好吧，让我们
make sure it still runs just fine we have this very nice clean output we know 确保它仍然可以正常运行，我们知道这个非常干净的输出
exactly what we're doing at every single step one extra thing I want to add to 正是我们在每一步中所做的，我想添加的一件事
this video it is not really buying for Mattox related it's more like a Python 这个视频不是真的为Mattox买的，更像是Python
II thing if you want to practice your Python if we're gonna go back to the 第二件事，如果您想练习Python如果我们要回到
browser here we can see that most of the images display nucleotides in color so 在这里的浏览器中，我们可以看到大多数图像以彩色显示核苷酸
maybe we can implement a small function that we can pass our DNA sequence or the 也许我们可以实现一个小的功能，使我们可以传递我们的DNA序列或
output of the function and it will call our nucleotides for us it is not very 函数的输出，它将为我们调用我们的核苷酸，这不是很
necessary thing but it might be useful if you want to create a presentation of 必要的事情，但如果您想创建一个演示文稿，则可能会很有用
your output okay and this is very easy to do in the Python as well let's go 您的输出还可以，这在Python中也很容易做到
back to our code and let's create another file that we're gonna populate 回到我们的代码，让我们创建另一个我们要填充的文件
in the future as well it is going to be called 将来也将被称为
utilities dot pi so in this file we're going to add a lot of functionality like 实用程序点pi，因此在此文件中，我们将添加很多功能，例如
reading from files writing to files reading from databases checking if we 从文件读取到从数据库读取文件，检查是否
can read or write files as well but now we're going to add this small function 可以读取或写入文件，但是现在我们要添加这个小功能
which is called colored that I've created okay so all this function does 这就是我已经创建的好色的，所以所有这些功能都可以
it receives a string of text it loops through that string and just looks at 它接收到一个文本字符串，并循环遍历该字符串，然后查看
the character by character if it's a then we're going to return this which is 如果是一个字符，那么我们将返回这个
a color I think it's red actually a is red and then it adds color plus the 我认为它是红色的颜色实际上是红色，然后添加颜色加上
nucleotide as a text so if you're interested in colorized output for some 核苷酸作为文本，因此如果您对某些颜色的输出感兴趣
reason I will leave a link in description as well this is a very nice 我也会在说明中留下一个链接的原因，这非常好
page colorized terminal output in Python so you can kind of go through that and 页面在Python中将终端输出着色，因此您可以通过
see how you can very nicely colorize your output there's a lot of complex 看看如何很好地为输出着色
things you can do with a background color foreground color different fonts 背景色前景色可以做的事情
and things like that okay let's go back to our code and see if we can pass one 像这样的事情，让我们回到我们的代码，看看是否可以通过
of our output strings to this function colored okay 我们的输出字符串到此函数的颜色正确
so let's go back to our main so now we're going to need to import colored 所以让我们回到主界面，现在我们需要导入彩色
function from utilities module we just created okay okay so let's try getting 实用程序模块中的函数，我们刚刚创建了好吧，好吧，让我们尝试获取
one of our output strings colorized one thing you will notice that the output of 我们的输出字符串之一使一件事变色，您会注意到
your editor might not support that format so let's do let's do colored for 您的编辑器可能不支持该格式，所以让我们为
our DNA sequence here and let's run it in the output of this editor as you can 我们的DNA序列在这里，让我们在编辑器的输出中运行它
see it has a lot of kind of garbage in here that is because we've added all of 看到这里有很多垃圾，这是因为我们添加了所有
these extra things to it to make it colorized so you have to run this code 这些额外的东西使其变色，因此您必须运行此代码
in the terminal a separate terminal or built in terminal into your editor I'm 在终端中，您可以在编辑器中使用单独的终端或内置终端
using Visual Studio so if I go control tilde the terminal will open up instead 使用Visual Studio，因此如果我控制波浪号，则终端将打开
of the original output that we seen before so terminal right here let's run 我们之前看到的原始输出的内容，所以在这里运行终端
it by hand Python and our file is called main dot pi okay so nice it works we can 它是由Python手工编写的，我们的文件称为主点pi好的，很好，我们可以
see that our sequence is colorized let's try adding this colorization to 看到我们的序列是彩色的，让我们尝试将这种彩色添加到
our nucleotide frequency to RNA and to our DNA with its reverse complement okay 我们对RNA和我们的DNA的核苷酸频率及其反向补体都可以
so we're going to try this it is not going to work let's try running it and 因此，我们将尝试该操作无法正常工作，让我们尝试运行它，
you can see that nucleotide frequency was a dictionary with values and keys 您会看到核苷酸频率是带有值和键的字典
now is just a CGT it is because our count nucleotide frequency returns a 现在只是一个CGT，是因为我们的计数核苷酸频率返回一个
dictionary but we're trying to colorize a string so instead of using colorized 字典，但我们尝试将字符串着色，因此不使用colorized
here we're gonna do a little bit of a weird thing what we're gonna do this 在这里，我们要做些奇怪的事情，我们要做的是
we're going to pass the whole string to it again let's try running it let me 我们将再次将整个字符串传递给它，让我们尝试运行它，让我
clean the screen here and now it is printing out exactly as it should very 清洁这里的屏幕，现在它正在完全打印出来
nice okay let's add the same thing to our reverse 好吧，让我们添加相同的东西到我们的反向
complement here colored okay and we're gonna add that to a transcription here 补充这里的颜色好吧，我们将其添加到此处的转录中
as well because again it is returning a string so we can colorize that string 以及因为它再次返回一个字符串，所以我们可以为该字符串着色
and we need to do that same thing for reverse complement here too again it's 我们需要在反向补码上做同样的事情
not very necessary thing but if you want to use this colorized function for some 不是很必要的事情，但是如果您想将此彩色功能用于某些
of the output you can of course use that let's try running it so I ran it in the 您当然可以使用的输出，让我们尝试运行它，以便我在
output again by accident and you can see all of the garbage that is printed out 再次意外输出，您可以看到所有打印出的垃圾
let's go back to our terminal let's clean that screen the output and run it 让我们回到终端，让我们清理该屏幕的输出并运行它
again and here we have a very nice and beautiful kind of cartoon help but I 再次，在这里，我们有非常漂亮的卡通帮助，但我
have to say okay everyone this is it for today we have added two more functions 不得不说，大家好，今天是我们添加了两个功能
to our code and both of them do replicate a real biological function 到我们的代码，并且它们确实复制了真实的生物学功能
like transcription here and our reverse compliment right here in our upcoming 就像这里的转录，以及我们即将到来的反向赞美
videos we are going to go even further than that we're going to add code on 视频，我们要比添加视频上的代码更进一步
functions and protein search functions is gonna be a lot of fun I hope and 功能和蛋白质搜索功能将会很有趣，我希望并
thank you very much for watching and listening so this code is going to be 非常感谢您的收看和收听，因此这段代码将是
available on get lab so you can go there and for example grab that colorized 在get lab上可用，因此您可以去那里，例如，抓取已着色的
function it's not really by informatics related stuff so you don't have to 功能并不是真的与信息学相关的东西，因此您不必
figure out how it's written unless you're interested in or you can just 弄清楚它的写法，除非您对此感兴趣，或者只是
pull down latest version or copy that from the 下拉最新版本或从
file I will leave a link in the description too and just use it if you 文件，我也会在说明中留下一个链接，如果您愿意，也可以使用它
have any questions about this video please leave them in a comment section 对此影片有任何疑问，请在评论部分中留下
below or just pop it into telegram or matrix 在下面或只是将其弹出电报或矩阵
chat we have more and more people joining everyday this video will also be 即时通讯，我们每天都有越来越多的人加入，这部影片也会
available on library platform at the same time thank you very much again for 同时可在图书馆平台上使用
listening rebel coder signing out 侦听反叛编码器退出