03 Complementing a Strand of DNA

Problem

In DNA stringssymbols ‘A‘ and ‘T‘ are complements of each other, as are ‘C‘ and ‘G‘.

The reverse complement of a DNA string ss is the string scsc formed by reversing the symbols of ss, then taking the complement of each symbol (e.g., the reverse complement of "GTCA" is "TGAC").

Given: A DNA string ss of length at most 1000 bp.

Return: The reverse complement scsc of ss.

Sample Dataset

AAAACCCGGT

Sample Output

ACCGGGTTTT

方法一
def reverse(seq):
    dict = {‘A‘: ‘T‘, ‘C‘: ‘G‘, ‘T‘: ‘A‘, ‘G‘: ‘C‘}

    revSeqList = list(reversed(seq))                #[‘T‘, ‘G‘, ‘G‘, ‘C‘, ‘C‘, ‘C‘, ‘A‘, ‘A‘, ‘A‘, ‘A‘]
    revComSeqList = [dict[k] for k in revSeqList]  # [‘A‘, ‘C‘, ‘C‘, ‘G‘, ‘G‘, ‘G‘, ‘T‘, ‘T‘, ‘T‘, ‘T‘]
    revComSeq = ‘‘.join(revComSeqList)             # ACCGGGTTTT
    return revComSeq

seq = ‘AAAACCCGGT‘

print (reverse(seq))

  

				
时间: 2024-10-30 05:24:37

03 Complementing a Strand of DNA的相关文章

HBV(2.1)_嗜肝DNA病毒

单词: polymerase聚合酶['p?l?m?re?z; p?'l?m?re?z] an enzyme that catalyzes(催化) the formation of new DNA and RNA from an existing strand of DNA or RNA covalently共价的 Hepadnaviridae嗜肝DNA病毒 viridae病毒科 Orthohepadnavirus, 又称正肝病毒属; 代表种:乙型肝炎病毒 Avihepadnavirus(avia

词汇_HBV

hepatitis    [,hep?'ta?t?s]肝炎    107 antigen   ['ænt?d??n]抗原,any substance (as a toxin or enzyme) that stimulates an immune response in the body (especially the production of antibodies) antibody抗体 Antibodies are substances that a person's or an anim

HBV(2)_基因

单词: polymerase聚合酶['p?l?m?re?z; p?'l?m?re?z] an enzyme that catalyzes(催化) the formation of new DNA and RNA from an existing strand of DNA or RNA covalently共价的 The structure of hepatitis B virus The genome organisation of HBV. The genes overlap. Hepati

HBV(14)_核苷酸药物治疗

单词: polymerase聚合酶['p?l?m?re?z; p?'l?m?re?z] an enzyme that catalyzes(催化) the formation of new DNA and RNA from an existing strand of DNA or RN 目录 1.拉米夫定 (lamivudine) 2.阿德福韦酯 (adefovir dipivoxil) 3.恩替卡韦 (entecavir) 4.随访 (一) 拉米夫定 (lamivudine) lamivudin

snap

1.snap的下载与安装 snap的说明文档: /home/share/biosoft/snap/00README 下载: wget http://korflab.ucdavis.edu/Software/snap-2013-11-29.tar.gz 文件说明: DNA Contains some sample sequences HMM Contains SNAP parameter files LICENSE The GNU General Public License Makefile F

UVA - 1368 DNA Consensus String

DNA Consensus String Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Submit Status Description  Figure 1. DNA (Deoxyribonucleic Acid) is the molecule which contains the genetic instructions. It consists of four different nuc

DNA Sequence(POJ2778 AC自动机dp+矩阵加速)

传送门 DNA Sequence Time Limit: 1000MS   Memory Limit: 65536K       Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequenc

POJ 2778 DNA Sequence

DNA Sequence Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on PKU. Original ID: 277864-bit integer IO format: %lld      Java class name: Main It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's

UVA 题目760 DNA Sequencing (后缀数组求两个串最长公共子串,字典序输出)

 DNA Sequencing  A DNA molecule consists of two strands that wrap around each other to resemble a twisted ladder whose sides, made of sugar and phosphate molecules, are connected by rungs of nitrogen-containing chemicals called bases. Each strand is