This file is indexed.

/usr/lib/python3/dist-packages/benchmarks/benchmarks.py is in python3-skbio 0.5.1-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Write the benchmarking functions here.
# See "Writing benchmarks" in the asv docs for more information.

from skbio import DNA, RNA
import numpy as np

num_bases = 1000000
size = int(num_bases / 4)
short_len = 100

dna_template_bytes = [ord(x) for x in 'ACGT']
dna_template_bytes_gapped = [ord(x) for x in 'AC-.']
rna_template_bytes = [ord(x) for x in 'ACGU']

dna_bytes = np.array(dna_template_bytes * size, dtype=np.uint8)
dna_bytes_short = dna_bytes[:short_len]
dna_bytes_gapped = np.array(dna_template_bytes_gapped * size, dtype=np.uint8)
rna_bytes = np.array(rna_template_bytes * size, dtype=np.uint8)

dna_seq = DNA(dna_bytes)
dna_seq_short = DNA(dna_bytes_short)
dna_gapped = DNA(dna_bytes_gapped)
rna_seq = RNA(rna_bytes)

motif_1 = "GGTGCAAGCCGGTGGAAACA"
motif_1_regex = '(' + motif_1 + ')'


def consume_iterator(iterator):
    for _ in iterator:
        pass


class BenchmarkSuite:

    def time_object_creation(self):
        DNA(dna_bytes, validate=False)

    def time_object_creation_validate(self):
        DNA(dna_bytes)

    def time_reverse_complement(self):
        dna_seq.reverse_complement()

    def time_degap_all(self):
        dna_seq.degap()

    def time_translate(self):
        rna_seq.translate()

    def time_search_for_motif(self):
        consume_iterator(dna_seq.find_with_regex(motif_1_regex))

    def time_kmer_count_5(self):
        dna_seq_short.kmer_frequencies(5)

    def time_kmer_count_25(self):
        dna_seq_short.kmer_frequencies(25)

    def time_gc_content(self):
        dna_seq.gc_content()

    def time_search_for_motif_in_gapped(self):
        consume_iterator(
            dna_seq.find_with_regex(motif_1_regex, ignore=dna_seq.gaps()))