This file is indexed.

/usr/share/pyshared/cogent/parse/consan.py is in python-cogent 1.5.3-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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python

from cogent.struct.rna2d   import ViennaStructure,wuss_to_vienna
from cogent.util.transform import make_trans

__author__ = "Shandy Wikman"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__contributors__ = ["Shandy Wikman"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Shandy Wikman"
__email__ = "ens01svn@cs.umu.se"
__status__ = "Development"

to_vienna_table = make_trans('><','()')

def consan_parser(lines):
    """
    Takes a series of lines as input.

    Returns a list containing alignment and structure
    ex: [{alignment},[structure]]
    """
    seqs = []
    struct = ''
    pairs = []
    alignment = {}
    for line in lines:
        if sequence(line):
            line = line.split()
            name = line[0].strip()
            seq = line[1].strip()
            #add sequence to alignment
            if name in alignment:
                alignment[name] += seq
            else:
                alignment[name] = seq
        elif line.startswith('#=GC SS_cons'):
            line = line.split()
            struct += line[2].strip()
    pairs = convert_to_pairs(struct)
    return [alignment, pairs]
    
def convert_to_pairs(data):
    """
    Converts format >< to () format, viennaformat. 
    """
    try:
        vienna = ViennaStructure(data.translate(to_vienna_table))
        return toPairs(vienna)
    except IndexError:
        return ''
def toPairs(vienna):
    """
    Converts a vienna structure to a pairs obejct
    """

    pairs = vienna.toPairs()
    return pairs
    
def sequence(line):
    """Determines if line is a sequence line
    """
    answer = False
    if not len(line) == 1 and not line.startswith('#') and not line.startswith('/') and not line.startswith('Using'):
        answer = True
    return answer