-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIGV_mod_medstore.py
executable file
·38 lines (29 loc) · 1.19 KB
/
IGV_mod_medstore.py
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
#!/usr/bin/env python
import os
def igv_modification(user, infile):
"""
Adds entries for seg files to user IGV xml list.
"""
with open("/medstore/IGV_Folders/igv/users/%s_igv.xml" % user, "r+") as userfile:
lines_of_file = userfile.readlines()
bam = os.path.basename(infile)
lines_of_file.insert(-2,
'\t\t<Resource name="%s" path="http://medstore.sahlgrenska.gu.se:8008/data/%s/%s" />\n' % (
bam, user, bam))
userfile.seek(0)
userfile.truncate()
userfile.writelines(lines_of_file)
with open("/medstore/IGV_Folders/igv/users/%s_igv_su.xml" % user, "r+") as userfile:
lines_of_file = userfile.readlines()
bam = os.path.basename(infile)
lines_of_file.insert(-2,
'\t\t<Resource name="%s" path="http://medstore.sahlgrenska.gu.se:80/data/%s/%s" />\n' % (
bam, user, bam))
userfile.seek(0)
userfile.truncate()
userfile.writelines(lines_of_file)
if __name__ == "__main__":
from sys import argv
user = argv[1]
infile = argv[2]
igv_modification(user, infile)