This file is indexed.

/usr/lib/python3/dist-packages/biotools/complement.py is in python3-biotools 1.2.12-2.

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
#!/usr/bin/env python
from biotools.sequence import isprot

_ref = {
    'DNA': {
        'A': 'T', 'T': 'A', 'a': 't', 't': 'a', 
        'C': 'G', 'G': 'C', 'c': 'g', 'g': 'c',
        'R': 'Y', 'Y': 'R', 'r': 'y', 'y': 'r',
        ' ': ' ', '-': '-'
    },
    'RNA': {
        'A': 'U', 'U': 'A', 'a': 'u', 'u': 'a',
        'C': 'G', 'G': 'C', 'c': 'g', 'g': 'c',
        'R': 'Y', 'Y': 'R', 'r': 'y', 'y': 'r',
        ' ': ' ', '-': '-'
    }
}


def complement(s):
    '''
    Creates the complement of a sequence, which can then be reversed by using
    `seq[::-1]`, if it needs to be reversed. This function accepts either
    `Sequence`s or strings.
    '''

    if isprot(s):
        return s
    has_u = ('U' in s or 'u' in s)
    has_t = ('T' in s or 't' in s)
    if has_u and not has_t:
        repl = _ref['RNA']
    elif has_t and not has_u:
        repl = _ref['DNA']
    else:
        repl = _ref['DNA']
    value = ''.join(repl.get(c, 'N') for c in s)
    try:
        return s.__class__("complement(%s)" % s.name, value,
                           original=s.original, start=s.start,
                           end=s.end, step=s.step, qual=s.qual)
    except (AttributeError, TypeError):
        return s.__class__(value)


if __name__ == '__main__':
    assert complement('ATCGTAGCTGATCGAT') == 'TAGCATCGACTAGCTA'
    assert complement('AUCGUAGCUGAUCGAU') == 'UAGCAUCGACUAGCUA'
    print(complement('AUCgu--cuGAUCGAU'))