在python中反转字符串 [英] reversing string in python

查看:112
本文介绍了在python中反转字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算使用字符串和反向函数在python中为DNA构建一个简单的应用程序(由A,G,G和T表示),当其中一个子字符串在复制过程中被反转时。逆转发生在所谓的倒置对中。例如,如果模式TGAA之后是反转的图案AAGT,则由这些图案界定的DNA切片可以被反转并重新附着。有点像


TGAA CATT AAGT

将被反转为

TGAA TTAC AAGT


------------------------------- -

程序很简单,但我不知道如何操纵字符串使其按照我想要的方式反转。这是我不完整的设计:

I intend use string and reverse function to build a simple application in python for DNA (presented by A,G,G, and T) mutation when one of its substring is reversed during the replication process. The reversal happens what are termed inverted pairs. For instance, if the pattern TGAA is later followed byinverted pattern AAGT, the slice of DNA delimited by those patterns could be inverted and reattached. Something''s like

TGAACATTAAGT
will be inversed to
TGAATTACAAGT

---------------------------------
The program is simple but I don''t know how to manipulate the string to make it be reversed in the way I would like to. Here is my incomplete design:

展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号

推荐答案


我打算使用字符串和反向函数在python中为DNA构建一个简单的应用程序(由A,G,G和T表示),当其中一个子字符串在复制过程中被反转时。逆转发生在所谓的倒置对中。例如,如果模式TGAA之后是反转的图案AAGT,则由这些图案界定的DNA切片可以被反转并重新附着。有点像


TGAA CATT AAGT

将被反转为

TGAA TTAC AAGT


------------------------------- -

程序很简单,但我不知道如何操纵字符串使其按照我想要的方式反转。这是我不完整的设计:
I intend use string and reverse function to build a simple application in python for DNA (presented by A,G,G, and T) mutation when one of its substring is reversed during the replication process. The reversal happens what are termed inverted pairs. For instance, if the pattern TGAA is later followed byinverted pattern AAGT, the slice of DNA delimited by those patterns could be inverted and reattached. Something''s like

TGAACATTAAGT
will be inversed to
TGAATTACAAGT

---------------------------------
The program is simple but I don''t know how to manipulate the string to make it be reversed in the way I would like to. Here is my incomplete design:
展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


谢谢你我有原则,我会试着看看我能走多远。


无论如何,如果在第一个和第二个输入中使用了另一个字母而不是A,C,G,T,我应该使用什么命令(如果有错误的话)输入,会出现一条消息,这样用户可以重新输入)?
thank you I got the principle, I will try to see how far I can go.

Anyway, what command(s) should I use if there is another letter rather than A,C,G,T used in the first and second input (if there is a error of inputing, there will be a message appear so user can re-input)?



谢谢你我有原则,我会试试看看我能走多远。


无论如何,什么如果在第一个和第二个输入中使用了另一个字母而不是A,C,G,T,我应该使用命令(如果输入错误,将出现一条消息,以便用户可以重新输入) ?
thank you I got the principle, I will try to see how far I can go.

Anyway, what command(s) should I use if there is another letter rather than A,C,G,T used in the first and second input (if there is a error of inputing, there will be a message appear so user can re-input)?

展开 | 选择 < span class =codeDivider> | Wrap | 行号


这篇关于在python中反转字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆