<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Planning Safety Solutions, Models and Algorithms for Special Databases∗</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Fanni Magdolna Hízó</string-name>
          <email>fanni.hizo@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Attila Kiss</string-name>
          <email>kiss@inf.elte.hu</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>ELTE Eötvös Loránd University, Faculty of Informatics</institution>
          ,
          <addr-line>Budapest</addr-line>
          ,
          <country country="HU">Hungary</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>ELTE Eötvös Loránd University, Faculty of Informatics</institution>
          ,
          <addr-line>Budapest</addr-line>
          ,
          <country country="HU">Hungary</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2020</year>
      </pub-date>
      <fpage>29</fpage>
      <lpage>31</lpage>
      <abstract>
        <p>DNA sequencing is the process of determining the order of nucleotides in DNA. The rapid speed of sequencing attained with modern DNA sequencing technology has been instrumental in the sequencing of complete DNA sequences, including the human genome. Nevertheless it is a sensitive data which needs safe but ecfiient storage methods. The goal in this research was to analyze diferent models and algorithms to determine which is the most applicable for storage, and query considering the need of user permissions, and encryption.</p>
      </abstract>
      <kwd-group>
        <kwd>bioinformatics</kwd>
        <kwd>data science</kwd>
        <kwd>data protection</kwd>
        <kwd>data compression</kwd>
        <kwd>database applications</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Motivation</title>
      <p>Due to cheaper methods it is possible for everyone to keep their own DNA on
their own device. However these are sensitive data which needs to be secured.
Genomes are stored mostly in text files. The size of these files could be even
3GB or more depending on the analyzed species. Secured data management is not
solved in these files. By using database managers, the levels of permissions can
be easily managed, because many database manager systems have built-in security
and encryption possibility.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Works</title>
      <p>
        Previous researches are also available about using database manager systems for
storing genotypic data, describing and comparing multiple techniques [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. One uses
the database as a container to store bioinformatic file formats [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. The authors of
this paper explores the array-based technique, showing that it scales to far greater
volumes than other existing techniques [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        In this paper the authors construct a DNA relational database with a simple
data model in which one DNA molecule stores one piece of data, [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and this
one introduces the database aspects of DNA computing [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. This paper discuss
the Cassandra NoSQL database approach for storing genomic data [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. In [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]
the authors managed to implement a web interface, to help students to develop
informatic thinking skills. When considering possible encryption methods for data
security, one of them is the 64-bit block ciphers (e.g Blowfish, 3DES), but these
ciphers are known to be susceptible to collision attacks [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. On the other hand the
AES-128 uses 128-bit blocks and gives better protection [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. DNA processing</title>
      <p>3.1. DNA
Deoxyribonucleic acid (DNA) is a molecule composed of two chains that coil around
each other to form a double helix carrying genetic instructions. Nucleic acids are
one of the four major types of macromolecules that are essential for all known forms
of life. Each nucleotide is composed of one of four nitrogen-containing nucleobases
(cytosine [C], guanine [G], adenine [A] or thymine [T]). DNA sequencing is the
process of determining the nucleic acid sequence. In this paper we worked with
these sequences.</p>
      <sec id="sec-3-1">
        <title>3.2. MySQL database</title>
        <p>Firstly we created a database in local host, followed by a database table. We split
the sequences into 1680-character-long pieces and uploaded many diferent DNA
sequences into the table.</p>
        <sec id="sec-3-1-1">
          <title>CREATE TABLE dna (</title>
          <p>
            id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
seqPosition INT NOT NULL,
sequence TEXT NOT NULL
);
Only with this structure, a simple pattern searching SQL query took about 5-10
minutes in MySQL [
            <xref ref-type="bibr" rid="ref9">9</xref>
            ].
          </p>
        </sec>
        <sec id="sec-3-1-2">
          <title>SELECT * FROM dna</title>
          <p>where seq like "%GACCGCGGCGCCGAGCGGCAGCCGCGCCGGCCCGGAC%"
and id=101;
1 row(s) returned 550.953 sec / 0.000 sec</p>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>3.3. PostgreSQL database</title>
        <p>We did the same in PostgreSQL.</p>
        <sec id="sec-3-2-1">
          <title>CREATE TABLE dna (</title>
          <p>
            id SERIAL PRIMARY KEY NOT NULL,
seqPosition INT NOT NULL,
sequence TEXT NOT NULL
);
However in PostgreSQL [
            <xref ref-type="bibr" rid="ref10">10</xref>
            ] a pattern searching query has never took more than
5 minutes.
          </p>
        </sec>
      </sec>
      <sec id="sec-3-3">
        <title>3.4. Indexing</title>
        <p>
          A B-tree index can be used for column comparisons in expressions that use the
=, &gt;, &gt;=, &lt;, &lt;=, or BETWEEN operators. The index also can be used for
LIKE comparisons if the argument to LIKE is a constant string that does not start
with a wildcard character. MySQL uses the Turbo Boyer-Moore [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] algorithm
to initialize the pattern for the string and then uses this pattern to perform the
search more quickly. We examined the query runtime after creating indexes for the
table columns. As we mentioned before, a simple selection statement could took
minutes to complete. After creating indexes in the database columns, the following
statement returned within seconds.
        </p>
        <p>SELECT * FROM dna where pos=111;
10 row(s) returned 0.110 sec / 0.015 sec</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. K-mers</title>
      <p>In bioinformatics, k-mers are subsequences of length k contained within a
biological sequence. Primarily used within the context of computational genomics and
sequence analysis. Usually, the term k-mer refers to all of a sequence’s subsequences
of length k, such that the sequence AGAT would have four monomers (A, G, A,
and T), three 2-mers (AG, GA, AT), two 3-mers (AGA and GAT) and one 4-mer
(AGAT). The maximum number of variations of the possible substrings are 4 .</p>
      <sec id="sec-4-1">
        <title>4.1. Method</title>
        <p>We developed a program in python to determine the number of k-mers. With
reading the file line by line it counts the occurring nucleotid variations.</p>
        <p>We examined human, hominoidea, plant and bacteria dna sequence too.
The next diagram shows the diference in percentage between each of the genom
3-mers self-compared value of occurrence.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.2. Multiprocessing</title>
        <p>We had an idea to use multiprocessing to increase the program eficiency. The
basic idea was that if we split the file into smaller pieces, (for example four equal
sized files) and if we add each piece into a thread, it should reduce the runtime.
In python, multiprocessing is a package that supports spawning processes using
an API similar to the threading module. Due to this, the multiprocessing module
allows the programmer to fully leverage multiple processors on a given machine. It
runs on both Unix and Windows.</p>
        <p>The multiprocessing module also introduces APIs which do not have analogs in
the threading module. A prime example of this is the Pool object which ofers a
convenient means of parallelizing the execution of a function across multiple input
values, distributing the input data across processes (data parallelism).</p>
        <p>We get the following results without and with multiprocessing:
The runtime with a 3gb sized dna sequence is more than 24 minutes (1440.026 sec)
without parallelism.</p>
        <p>The runtime with the same, but divided file is less than 10 minutes (585.83 sec)
with parallelism. This means a 59% performance improvement.</p>
        <p>For a better representation we tested our program on a 820MB sized DNA
sequence. At first we did not use multiprocessing, then split the file into 3/6/11
equal pieces and used multiprocessing for our calculation. The following figure
represents the taken time by each run.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Compression</title>
      <p>
        The Lempel–Ziv–Markov chain algorithm (LZMA) is an algorithm used to perform
lossless data compression. This algorithm uses a dictionary compression scheme
somewhat similar to the LZ77 algorithm published by Abraham Lempel and Jacob
Ziv in 1977. It is used by 7zip nowadays [
        <xref ref-type="bibr" rid="ref12 ref13">12, 13</xref>
        ]. We decided to use this algorithm to
compress our data because it features a very high compression ratio. The algorithm
creates a dictionary while encodes the data and the fact that we are working only
four characters provides us a small dictionary. With this method a 3GB sized DNA
sequence compressed size is only 831 MB which means more than 73% storage space
saving.
      </p>
    </sec>
    <sec id="sec-6">
      <title>6. Safety solutions</title>
      <p>In discussing security, it is necessary to consider fully protecting the entire server
host (not just the server) against all types of applicable attacks: eavesdropping,
altering, playback, and denial of service. Both MySQL and PostgreSQL have the
option to create and add privileges with diferent roles to the database. Which
provides the opportunity to determine which user could access the database and
which could edit it. Every fresh MySql and PostgreSql system has an already
defined role, which is always the superuser.
6.1. MySQL
The privilege system is the most basic security feature MySQL has to ofer. It
allows defining who can access database. Each user may be assigned a number
of privileges. They define what each user can do once they have been authorized
to connect. The privileges can be either global, granting specific right without
restrictions, or limited to a specific object such as database or table.</p>
      <p>MySQL implements an SSL library to provide connection encryption. All
endpoints – server and clients – require their own set of private keys and certificates
to be able to use encryption.</p>
      <p>
        It oefrs a number of cryptographic [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] and hashing functions that can be
used to either encrypt or decrypt data directly in queries – AES_ENCRYPT(),
AES_DESCRYPT(), DES_ENCRYPT(), DES_DECRYPT(), SHA(), etc.
      </p>
      <sec id="sec-6-1">
        <title>6.2. PostgreSQL</title>
        <p>Same as in MySQL, PostgreSQL also use user roles to manage access privileges.
Roles can act as users, groups or both. Roles can own database objects and can
manage the permissions on these objects. Both of the discussed database
management systems the owner of a created object is the user who created it.</p>
        <p>PostgreSQL has native support for SSL connections to encrypt client/server
communications for increased security.</p>
        <p>We would like to mention that it also has the possibility to encrypt data, both
one way (e.g passwords) or two way(e.g credit cards). For one way encryption,
the crypt function packaged in pgcrypto provides an added level of security above
the md5 way. We have several ways to accomplish the two way encryption, these
implements the encryption part of the OpenPGP(RFC 4880) standard. However
we did not try these methods out.</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>7. Conclusion</title>
      <p>We created an environment where we can manage the user privileges and store
the data securely and encrypted. The database manager gives us many options to
easily add new users and create user hierarchy, from the principle of least privilege
to a user with admin authority. We also managed to implement the first basic
version of our processing tool that gives us the opportunity to compare diferent
species genomes. Even started to test the multi-threaded version of the program
for faster process of the genomes.</p>
    </sec>
    <sec id="sec-8">
      <title>8. Future Work</title>
      <p>In the future we want to try new data storage options and compare our results
with other database managers, e.g NoSQL. As our reviewers insisted it would be
interesting to examine another compression algorithms, and compare them to our
results. Moreover, the processing optimization and performance improvement is
in our main scope. Implementing a user friendly interface with options to import
genomic data, which also capable of creating diferent graphs and reports based on
the results is also one of our main goals.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Lichtenwalter</surname>
            ,
            <given-names>R.N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zorina-Lichtenwalter</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Diatchenko</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          <article-title>Genotypic data in relational databases: eficient storage and rapid retrieval</article-title>
          , In: Kirikova,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Norvag</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            ,
            <surname>Papadopoulos</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.A. (eds.) ADBIS</surname>
          </string-name>
          <year>2017</year>
          . LNCS vol.
          <volume>10509</volume>
          (
          <year>2017</year>
          ),
          <fpage>408</fpage>
          -
          <lpage>421</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>Uwe</given-names>
            <surname>Roehm</surname>
          </string-name>
          ,
          <article-title>Jose Blakeley Data management for high-throughput genomics (</article-title>
          <year>2009</year>
          ), https://arxiv.org/abs/0909.1764
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Yamamoto</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kita</surname>
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kashiwamura</surname>
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kameda</surname>
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ohuchi</surname>
            <given-names>A</given-names>
          </string-name>
          .
          <article-title>Development of DNA Relational Database and Data Manipulation Experiments</article-title>
          , In: Mao C.,
          <string-name>
            <surname>Yokomori</surname>
            <given-names>T</given-names>
          </string-name>
          . (
          <article-title>eds) DNA Computing</article-title>
          .
          <source>DNA Lecture Notes in Computer Science</source>
          vol.
          <volume>4287</volume>
          (
          <year>2006</year>
          ),
          <fpage>418</fpage>
          -
          <lpage>427</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Gillis</surname>
            <given-names>J.J.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Van den Bussche J. A</surname>
          </string-name>
          <article-title>Formal Model for Databases in DNA</article-title>
          . In:
          <string-name>
            <surname>Horimoto</surname>
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nakatsui</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Popov</surname>
            <given-names>N</given-names>
          </string-name>
          . (eds) Algebraic and
          <string-name>
            <given-names>Numeric</given-names>
            <surname>Biology</surname>
          </string-name>
          . Lecture Notes in Computer Science vol.
          <volume>6479</volume>
          (
          <year>2012</year>
          ),
          <fpage>18</fpage>
          -
          <lpage>37</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Aniceto</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Xavier</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Guimarães</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hondo</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Holanda</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Walter</surname>
            ,
            <given-names>M.E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lifschitz</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <article-title>Evaluating the Cassandra NoSQL database approach for genomic data persistency</article-title>
          ,
          <source>Int. J. Genomics</source>
          <year>2015</year>
          ,
          <fpage>1</fpage>
          -
          <lpage>7</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Rice</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gladstone</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          , Weir,
          <string-name>
            <surname>M.</surname>
          </string-name>
          ,
          <article-title>Relational databases: a transparent framework for encouraging biology students to think informatically</article-title>
          ,
          <source>Cell Biol. Educ</source>
          .
          <volume>3</volume>
          (
          <issue>4</issue>
          ) (
          <year>2004</year>
          ),
          <fpage>241</fpage>
          -
          <lpage>252</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Bhargavan</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Leurent</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <article-title>On the practical (in-) security of 64-bit block ciphers: collision attacks on HTTP over TLS and OpenVPN</article-title>
          ,
          <source>In: Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security</source>
          (
          <year>2016</year>
          ),
          <fpage>456</fpage>
          -
          <lpage>467</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Bogdanov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Khovratovich</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rechberger</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <article-title>Biclique cryptanalysis of the full AES</article-title>
          , In: Lee,
          <string-name>
            <given-names>D.H.</given-names>
            ,
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <surname>X. (eds.) ASIACRYPT</surname>
          </string-name>
          <year>2011</year>
          .
          <article-title>LNCS</article-title>
          , vol.
          <volume>7073</volume>
          (
          <year>2011</year>
          ),
          <fpage>344</fpage>
          -
          <lpage>371</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>MySQL</given-names>
            <surname>Documentation</surname>
          </string-name>
          , https://dev.mysql.com/doc/
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>PostgreSQL</given-names>
            <surname>Documentation</surname>
          </string-name>
          , https://www.postgresql.org/docs/
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Jorma</surname>
            <given-names>Tarhio</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Esko Ukkonen Approximate Boyer-Moore String</surname>
            <given-names>Matching</given-names>
          </string-name>
          ,
          <source>SIAM Journal on Computing</source>
          <volume>22</volume>
          (
          <issue>2</issue>
          ) (
          <year>1993</year>
          ),
          <fpage>243</fpage>
          -
          <lpage>260</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <article-title>Lempel-Ziv-Markov chain algorithm</article-title>
          , https://en.wikipedia.org/wiki/LempelZiv-Markov_chain_algorithm
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>A. D.</given-names>
            <surname>Wyner</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Ziv</surname>
          </string-name>
          <article-title>Fixed data base version of the Lempel-Ziv data compression algorithm</article-title>
          .
          <source>IEEE Transactions on Information Theory</source>
          vol.
          <volume>37</volume>
          (
          <issue>3</issue>
          ) (
          <year>1991</year>
          ),
          <fpage>878</fpage>
          -
          <lpage>880</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>Qiu</surname>
          </string-name>
          , Manying, and
          <article-title>Steve Davis Database Security Mechanisms and Implementation Issues in Information Systems vol</article-title>
          .
          <volume>3</volume>
          (
          <issue>2002</issue>
          ),
          <fpage>529</fpage>
          -
          <lpage>534</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>