DNA Common Sequence DNA Common Sequence
Undefined
JA English

Deoxyribonucleic acid is a molecule that encodes the genetic instructions used in the development and functioning of all known living organisms and many viruses. 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 a linear arrangement of repeating similar units called nucleotides. Each nucleotide is composed of a nitrogen-containing nucleobase—either guanine (G), adenine (A), thymine (T), or cytosine (C). The particular order of the bases arranged along the sugar-phosphate backbone is called the DNA sequence; the sequence specifies the exact genetic instructions required to create a particular organism with its own unique traits.

For this mission, we want to compare DNA strands and find the longest common base subsequence in the two strands. Subsequences are not required to occupy consecutive positions within the original sequences and letters can be placed at varying distances between each other. These strands can be represented as strings consisting of the letters "ACGT". For example the longest common sequence for strands "ACGTC" and "TTACTC" is "ACTC".

You are given two strand descriptions and you should find the longest common subsequence (not the substring). If we find several “longest” sequences with equal length, then return each of them as a string where these sequence are written in lexicographical order separated by commas. For example, for "CGCTA" and "TACCG" we found three sequences "CG", CC and "TA", so the result is "CC,CG,TA". If the given sequences don't have a common sequence then return an empty string.

Input: Two arguments. Base sequences as strings.

Output: The common longest sequence or sequences as a string.

Example:


How it is used: Bioinformatic scientists often use programming skills to model and examine DNA sequences in a lab. With the concepts from this mission, you can create the foundation of such a tool.

Precondition:
all(0 < len(seq) ≤ 64 and all(x in "ACGT" for x in seq) for seq in args)

Settings
Code:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

×
 
 
<< <
> >>
exec

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Share your own solution
Go to the next mission Back to the list of missions Back to the map