<commit_before>"""
.. See the NOTICE file distributed with this work for additional information
   regarding copyright ownership.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
"""
from __future__ import print_function

import os
import shutil
import gzip
import subprocess
import pytest

from basic_modules.metadata import Metadata

from tool.bowtie_aligner import bowtie2AlignerTool


@pytest.mark.bowtie2
def test_bowtie2_aligner_00():
    """
    Extract the compressed FASTQ files
    """
    resource_path = os.path.join(os.path.dirname(__file__), "data/")
    fastq_file_1 = resource_path + "bsSeeker.Mouse.SRR892982_1.fastq"
    fastq_file_2 = resource_path + "bsSeeker.Mouse.SRR892982_2.fastq"

    files = [fastq_file_1, fastq_file_2]

    for fastq_gz in files:
        with gzip.open(fastq_gz + '.gz', 'rb') as fgz_in:
            with open(fastq_gz, 'w') as f_out:
                f_out.write(fgz_in.read())

    assert os.path.isfile(fastq_file_1) is True
    assert os.path.getsize(fastq_file_1) > 0
    assert os.path.isfile(fastq_file_2) is True
    assert os.path.getsize(fastq_file_2) > 0


@pytest.mark.bowtie2
def test_bowtie2_aligner_single():
    """<commit_msg>Python 3 syntax error<commit_after>"""
.. See the NOTICE file distributed with this work for additional information
   regarding copyright ownership.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
"""
from __future__ import print_function

import os
import shutil
import gzip
import subprocess
import pytest

from basic_modules.metadata import Metadata

from tool.bowtie_aligner import bowtie2AlignerTool


@pytest.mark.bowtie2
def test_bowtie2_aligner_00():
    """
    Extract the compressed FASTQ files
    """
    resource_path = os.path.join(os.path.dirname(__file__), "data/")
    fastq_file_1 = resource_path + "bsSeeker.Mouse.SRR892982_1.fastq"
    fastq_file_2 = resource_path + "bsSeeker.Mouse.SRR892982_2.fastq"

    files = [fastq_file_1, fastq_file_2]

    for fastq_gz in files:
        with gzip.open(fastq_gz + '.gz', 'rb') as fgz_in:
            with open(fastq_gz, 'wb') as f_out:
                f_out.write(fgz_in.read())

    assert os.path.isfile(fastq_file_1) is True
    assert os.path.getsize(fastq_file_1) > 0
    assert os.path.isfile(fastq_file_2) is True
    assert os.path.getsize(fastq_file_2) > 0


@pytest.mark.bowtie2
def test_bowtie2_aligner_single():
    """
{'fraction_non_alphanumeric': 0.0778990852758926, 'fraction_numerical': 0.02095013278253172, 'mean_word_length': 3.68232044198895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5299231', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1073, 'n_words': 339}