/usr/lib/python2.7/dist-packages/pbsuite/utils/jellyoutputrename.py is in python-pbsuite-utils 15.8.24+dfsg-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 | from pbsuite.utils.FileHandlers import FastaFile
import json, re, sys
"""
## Arguments
1 - reference.fasta -- input reference created by Setup.py
2 - liftOverTable.json - created at end of Jelly run
3 - jelly.out.fasta -- new reference created by Jelly
"""
fasta = FastaFile(sys.argv[1])
nameLookup = {}
for entry in fasta:
data = entry.split('|')
refKey = data[-1]
origName = "|".join(data[:-1])
nameLookup[refKey] = origName
liftOver = json.load(open(sys.argv[2],'r'))
jellyFasta = FastaFile(sys.argv[3])
regex = re.compile("ref\d{7}")
for key in liftOver:
myRefs = set()
for id, strand, size in liftOver[key]:
myRefs.update(regex.findall(id))
newName = []
for refId in myRefs:
newName.append(nameLookup[refId])
sys.stdout.write(">%s\n%s\n" % ("_".join(newName), jellyFasta[key]))
|