-
Notifications
You must be signed in to change notification settings - Fork 1
/
CombineWHDynein.py
executable file
·137 lines (97 loc) · 3.46 KB
/
CombineWHDynein.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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<<<<<<< HEAD
import Mapping
from optparse import OptionParser
from os import path
from numpy import array
parser = OptionParser(usage='Usage: %prog [opts] 585FILE [655FILE]')
parser.add_option('-x', '--pixel-size', dest='pxsize', type="float",
help="Pixel Size (default 106.667 nm/px)", default=106.667)
parser.add_option('-H', '--hole-map', dest="holemap",
help="Output of PostProcessing.py")
parser.add_option('-B', '--bead-map', dest="beadmap",
help="Output of CombineWHSpots.py (offsets...)")
parser.add_option('-p', '--in-pixels', dest="in_nm", action="store_false",
help="Use this if dynein traces have been converted to pixels",
default=True)
opts, args = parser.parse_args()
file585 = args[0]
if len(args) > 1:
file655 = args[1]
else:
file655 = False
mapping = Mapping.loadmapping(opts.holemap)
mapping2 = Mapping.loadmapping(opts.beadmap)
x585, y585 = array(zip(*[(float(line.split()[0]), float(line.split()[1]))
for line in file(file585)
if line[0].isdigit()]))
if file655:
x655, y655 = array(zip(*[(float(line.split()[0]), float(line.split()[1]))
for line in file(file655)
if line[0].isdigit()]))
else:
x655, y655 = (zeros(len(x585)), zeros(len(585)))
if opts.in_nm:
x655 /= opts.pxsize
y655 /= opts.pxsize
x585 /= opts.pxsize
y585 /= opts.pxsize
x585m, y585m = mapping(x585, y585)
xd, yd = mapping2(x585m, y585m)
x585m += xd/opts.pxsize
y585m += yd/opts.pxsize
dirname,fname = path.split(file585)
fname = 'Remapped_' + fname
print "Outputting to ", path.join(dirname, fname)
outfile = open(path.join(dirname, fname), 'w')
for x, y in zip(x585m, y585m):
outfile.write('%f\t%f\n' % (x*opts.pxsize, y*opts.pxsize))
outfile.close()
=======
import Mapping
from optparse import OptionParser
from os import path
from numpy import array
parser = OptionParser(usage='Usage: %prog [opts] 585FILE [655FILE]')
parser.add_option('-x', '--pixel-size', dest='pxsize', type="float",
help="Pixel Size (default 106.667 nm/px)", default=106.667)
parser.add_option('-H', '--hole-map', dest="holemap",
help="Output of PostProcessing.py")
parser.add_option('-B', '--bead-map', dest="beadmap",
help="Output of CombineWHSpots.py (offsets...)")
parser.add_option('-p', '--in-pixels', dest="in_nm", action="store_false",
help="Use this if dynein traces have been converted to pixels",
default=True)
opts, args = parser.parse_args()
file585 = args[0]
if len(args) > 1:
file655 = args[1]
else:
file655 = False
mapping = Mapping.loadmapping(opts.holemap)
mapping2 = Mapping.loadmapping(opts.beadmap)
x585, y585 = array(zip(*[(float(line.split()[0]), float(line.split()[1]))
for line in file(file585)
if line[0].isdigit()]))
if file655:
x655, y655 = array(zip(*[(float(line.split()[0]), float(line.split()[1]))
for line in file(file655)
if line[0].isdigit()]))
else:
x655, y655 = (zeros(len(x585)), zeros(len(585)))
if opts.in_nm:
x655 /= opts.pxsize
y655 /= opts.pxsize
x585 /= opts.pxsize
y585 /= opts.pxsize
x585m, y585m = mapping(x585, y585)
xd, yd = mapping2(x585m, y585m)
x585m += xd/opts.pxsize
y585m += yd/opts.pxsize
dirname,fname = path.split(file585)
fname = 'Remapped_' + fname
print "Outputting to ", path.join(dirname, fname)
outfile = open(path.join(dirname, fname), 'w')
for x, y in zip(x585m, y585m):
outfile.write('%f\t%f\n' % (x*opts.pxsize, y*opts.pxsize))
outfile.close()
>>>>>>> YildizLabCode/master