/usr/share/pyshared/cogent/parse/ilm.py is in python-cogent 1.5.1-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 | #!/usr/bin/env python
from cogent.struct.rna2d import Pairs
from cogent.struct.knots import opt_single_random
from cogent.struct.pairs_util import adjust_base
__author__ = "Shandy Wikman"
__copyright__ = "Copyright 2007-2011, The Cogent Project"
__contributors__ = ["Shandy Wikman"]
__license__ = "GPL"
__version__ = "1.5.1"
__maintainer__ = "Shandy Wikman"
__email__ = "ens01svn@cs.umu.se"
__status__ = "Development"
def ilm_parser(lines=None,pseudo=True):
"""Ilm format parser
Takes lines as input and returns a list with Pairs object.
Pseudo - if True returns pairs with possible pseudoknot
if False removes pseudoknots
"""
pairs = []
for line in lines:
if line.startswith('Final') or len(line)==1:#skip these lines
continue
line = line.strip('\n')
line = map(int,line.split(None,2))
if line[1] == 0:
continue #Skip this line, not a pair
else:
pairs.append(line)
pairs = adjust_base(pairs,-1)
tmp = Pairs(pairs).directed()
tmp.sort()
if not pseudo:
tmp = opt_single_random(tmp)
tmp.sort()
result = []
result.append(tmp)
return result
|