This file is indexed.

/usr/share/pyshared/cogent/parse/psl.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env python
"""Parser for PSL format (default output by blat).
   Compatible with blat v.34
"""

from cogent import LoadTable
from cogent.parse.table import ConvertFields

__author__ = "Gavin Huttley, Anuj Pahwa"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Rob Knight","Peter Maxwell", "Gavin Huttley", "Anuj Pahwa"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Gavin Huttley"
__email__ = "gavin.huttley@anu.edu.au"
__status__ = "Development"

def make_header(lines):
    """returns one header line from multiple header lines"""
    lengths = map(len, lines)
    max_length = max(lengths)
    for index, line in enumerate(lines):
        if lengths[index] != max_length:
            for i in range(lengths[index], max_length):
                line.append('')
    
    header = []
    for t, b in zip(*lines):
        if t.strip().endswith('-'):
            c = t.strip()+b
        else:
            c = ' '.join([t.strip(), b.strip()])
        header += [c.strip()]
    return header

int_series = lambda x: map(int, x.replace(',',' ').split())

row_converter = ConvertFields([(i, int) for i in range(8)]+\
                              [(i, int) for i in range(10, 13)]+\
                              [(i, int) for i in range(14, 18)]+\
                              [(i, int_series) for i in range(18, 21)])

def MinimalPslParser(data, row_converter=row_converter):
    """returns version, header and rows from data"""
    if type(data) == str:
        data = open(data)
    
    psl_version = None
    header = None
    rows = []
    
    for record in data:
        if psl_version is None:
            assert 'psLayout version' in record
            psl_version = record.strip()
            yield psl_version
            continue
        
        if not record.strip():
            continue
        
        if header is None and record[0] == '-':
            header = make_header(rows)
            yield header
            rows = []
            continue
        
        rows += [record.rstrip().split('\t')]
        if header is not None:
            yield row_converter(rows[0])
            rows = []
        
    

def PslToTable(data):
    """converts psl format to a table"""
    parser = MinimalPslParser(data)
    version = parser.next()
    header = parser.next()
    rows = [row for row in parser]
    table = LoadTable(header=header, rows=rows, title=version)
    return table