@@ -131,6 +131,15 @@ def homer_to_narrow_peaks(self, data, output_file):
131131
132132 '''
133133
134+ # We don't want to require p-value, as Homer doesn't always output it.
135+ # Prep it here if it exists, or substitute tag count.
136+ pval_col = self .get_first_column (data ,
137+ self .p_value_columns , required = False )
138+ if pval_col :
139+ pvals = - np .log10 (pval_col )
140+ else :
141+ pvals = pvals = [- 1 ]* data .shape [0 ]
142+
134143 columns = OrderedDict ((
135144 ('chrom' , self .get_first_column (data , ['chr' ,'chrom' , 'chromosome' ])),
136145 ('chromStart' , self .get_first_column (data , ['chromStart' ,'start' ])),
@@ -139,9 +148,7 @@ def homer_to_narrow_peaks(self, data, output_file):
139148 ('score' , Series ([0 ]* data .shape [0 ])), # Leave zero so that signalValue column is used
140149 ('strand' , self .get_first_column (data , ['strand' ])),
141150 ('signalValue' , self .get_first_column (data , self .tag_count_columns )),
142- ('pValue' , (- np .log10 (self .get_first_column (data ,
143- self .p_value_columns , required = False ))
144- or self .get_first_column (data , self .tag_count_columns ))), # P-value if it exists, or tag count
151+ ('pValue' , pvals ), # P-value if it exists, or tag count
145152 ('qValue' , Series ([- 1 ]* data .shape [0 ])), # Leave -1 as no individual FDR is called for each peak
146153 ('peak' , Series ([- 1 ]* data .shape [0 ])), # Leave -1 as no point-source is called for each peak
147154 ))
0 commit comments