Commit 93af6c95 authored by Yoann Dufresne's avatar Yoann Dufresne

Merge branch 'master' of gitlab.pasteur.fr:ydufresne/10x-deconvolve

parents 678f0477 31dd7951
import sys
if len(sys.argv) < 3:
print("renames nodes of a simulated molecule graph into consecutive integers (for evaluate.py)")
exit("usage: input output")
out = open(sys.argv[2],'w')
for line in open(sys.argv[1]):
# change all occurrences of
# xxxxNC_000913.3_100644_115643_0:0:0_0:0:0_14f1/1xxxx
# to:
# xxxx100644xxxx
while "NC_000913" in line:
s = line.split("NC_000913")
before = s[0] #we'll keep that
cur = s[1] #we'll modify that
if len(s) > 2:#we'll keep that too
after = "NC_000913" + 'NC_000913'.join(s[2:])
else:
after = ""
#print("before:",before+cur+after)
# now we modify 'cur' which hopefully corresponds to [NC_00913].3_100644_115643_0:0:0_0:0:0_14f1/1....[the next NC_00913]
s = cur.split('_')
val = s[1] # this is the start coordinate of the molecule, save it
cur = '_'.join(s[2:]) # restore the rest of cur
s = cur.split('/')
rest = '/'.join(s[1:]) # skip until the next '/' char
rest = rest[1:]
cur = val+rest
#print("after:",before+cur+after)
line = before + cur + after
out.write(line)
out.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment