Rosalind第58题:Constructing a De Bruijn Graph

Problem

Consider a set  of -mers of some unknown DNA string. Let  denote the set containing all reverse complements of the elements of . (recall from “Counting Subsets” that sets are not allowed to contain duplicate elements).

The de Bruijn graph  of order  corresponding to  is a digraph defined in the following way:

  • Nodes of  correspond to all -mers that are present as a substring of a -mer from .
  • Edges of  are encoded by the -mers of  in the following way: for each -mer  in , form a directed edge (, ).

Given: A collection of up to 1000 (possibly repeating) DNA strings of equal length (not exceeding 50 bp) corresponding to a set  of -mers.

Return: The adjacency list corresponding to the de Bruijn graph corresponding to .

考虑一 的一些不知名的聚体DNA串。让 表示包含元素的所有反向互补的集合。(从“计数子集”中回想起,不允许集合包含重复元素)。

对应的de Bruijn 有序是通过以下方式定义的有向图

  • 节点的对应于所有所存在的氨基酸聚体a的从聚体。
  • 边缘的由编码的氨基酸聚体以下列方式:对于每个聚体中,形成有向边(,)。

下式给出:高达1000(可能重复)长度相等的DNA串的集合(不超过50碱基对)对应于一组的氨基酸聚体。

返回值:与对应的de Bruijn图对应的邻接表

 

Sample Dataset

TGAT
CATG
TCAT
ATGC
CATC
CATC

Sample Output

(ATC, TCA)
(ATG, TGA)
(ATG, TGC)
(CAT, ATC)
(CAT, ATG)
(GAT, ATG)
(GCA, CAT)
(TCA, CAT)
(TGA, GAT)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值