@@ -59,34 +59,23 @@ def getHagfishOptparser():
59
59
help = 'Show debug information' )
60
60
return parser
61
61
62
- def addPlotParameters (parser ):
62
+
63
+ def addBasePlotParameters (parser ):
63
64
parser .set_defaults (ntPerBand = - 1 )
64
65
65
66
parser .add_option ('-n' , dest = 'ntPerBand' ,
66
67
help = 'no nucleotides per band' )
67
68
68
- parser .add_option ('-i' , dest = 'inputFile' ,
69
- help = 'input file with the coverage data (npz, if not specified, ' +
70
- 'the input file name will be inferred from the sequence Id' )
71
-
72
69
parser .set_defaults (imageWidth = 1000 )
73
70
parser .set_defaults (bandHeight = 200 )
74
71
parser .add_option ('-W' , dest = 'imageWidth' , type = 'int' , help = 'imageWidth (in px)' )
75
72
parser .add_option ('-H' , dest = 'bandHeight' , type = 'int' , help = 'bandHeight (in px)' )
76
73
77
- parser .set_defaults (yfrac = 0.98 )
78
- parser .add_option ('-Y' , dest = 'yfrac' , type = 'float' , help = 'percentage of the plotted'
79
- 'fraction that must fall inside the Y boundaries of the graph - use'
80
- 'this to scale the y axis' )
81
- parser .add_option ('--ymax' , dest = 'ymax' ,
82
- help = 'Alternatively, set a max value for the y axis' )
83
-
84
74
parser .add_option ('-s' , dest = 'start' ,
85
75
help = 'Start position (nt) of the plot' )
86
76
parser .add_option ('-e' , dest = 'stop' ,
87
77
help = 'Stop position (nt) of the plot' )
88
78
89
-
90
79
parser .add_option ('-o' , dest = 'outfile' ,
91
80
help = 'Output file name' )
92
81
@@ -98,9 +87,24 @@ def addPlotParameters(parser):
98
87
parser .add_option ('--dpi' , dest = 'dpi' , type = 'int' ,
99
88
help = 'dpi of the image, pixel calculations are based on dpi 100, setting dpi to 200 will double the x/y pixel size of your image)' )
100
89
90
+
91
+ def addPlotParameters (parser ):
92
+ addBasePlotParameters (parser )
93
+ parser .add_option ('-i' , dest = 'inputFile' ,
94
+ help = 'input file with the coverage data (npz, if not specified, ' +
95
+ 'the input file name will be inferred from the sequence Id' )
96
+
97
+ parser .set_defaults (yfrac = 0.98 )
98
+ parser .add_option ('-Y' , dest = 'yfrac' , type = 'float' , help = 'percentage of the plotted'
99
+ 'fraction that must fall inside the Y boundaries of the graph - use'
100
+ 'this to scale the y axis' )
101
+ parser .add_option ('--ymax' , dest = 'ymax' ,
102
+ help = 'Alternatively, set a max value for the y axis' )
101
103
parser .add_option ('-Q' , dest = 'quick' , action = 'store_true' ,
102
104
help = 'Create a "light" version of this graph (if implemented)' )
103
105
106
+ def addBinPlotParameters (parser ):
107
+ addBasePlotParameters (parser )
104
108
105
109
class hagfishData :
106
110
@@ -167,6 +171,41 @@ def __init__(self, options, args, seqId = None, inputFile=None):
167
171
#self.z = np.zeros_like(self.x)
168
172
self .vectors .append ('x' )
169
173
174
+
175
+ class hagfishBinData :
176
+
177
+ def __init__ (self , options , args , seqId = None , inputFile = None ):
178
+
179
+ if seqId :
180
+ self .seqId = seqId
181
+ else :
182
+ self .seqId = args [0 ]
183
+
184
+ self .options = options
185
+
186
+ self .l = getLogger ('data' , options .verbose )
187
+ self .l .info ("Loading sequence: %s" % self .seqId )
188
+
189
+ if not inputFile :
190
+ l .critical ("need to provide an input file" )
191
+ sys .exit ()
192
+ self .inputFile = inputFile
193
+
194
+ self .l .info ('loading %s' % self .inputFile )
195
+
196
+ self .data = np .load (self .inputFile )
197
+ self .bins = self .data ['bins' ]
198
+ self .binSize = self .data ['binSize' ]
199
+
200
+ self .seqLen = len (self .data ['bins' ]) * self .binSize
201
+
202
+
203
+ self .x = np .arange (0 , self .seqLen , dtype = "int" )
204
+ self .l .info ("discovered bin sequence of %d nt" % self .seqLen )
205
+
206
+ #self.z = np.zeros_like(self.x)
207
+ #self.vectors.append('x')
208
+
170
209
class hagfishPlot :
171
210
172
211
def __init__ (self , options , data , title = None , data2 = None , ymax = None ):
0 commit comments