New gwas track - #503
Conversation
adjust DEFAULTS_PROPERTIES/FLOAT_PROPERTIES/plot command to match options and remove unused ones
|
@bgruening would you mind to review this PR? |
| line = next(self.file_handle) | ||
| line = to_string(line) | ||
| if line.startswith("#") or line.strip() == '': | ||
| line = self.get_no_comment_line() |
There was a problem hiding this comment.
Do we really need a recursion here? Will a file with a lot of comments hit the python recursion stack?
for line in self.file_handle:
line = to_string(line)
self.line_number += 1
if not (line.startswith("#") or line.strip() == ''):
return line
simple forloop?
| from .utilities import InputError, to_string | ||
|
|
||
|
|
||
| class ReadGwas(object): |
There was a problem hiding this comment.
maybe refactor to ReadTabular or something like that and share with GTF, BED etc?
There was a problem hiding this comment.
Yes I will do this
| from .utilities import InputError, to_string | ||
|
|
||
|
|
||
| class ReadGwas(object): |
There was a problem hiding this comment.
This (object) thing is also something we should clean for version 4.0 ... its old Python2 syntax afaik.
| # Fill in the position and pvalues lists with data from the GWAS file | ||
| position = [region.begin for region in gwas_overlap] | ||
| # Notice the -log10 transformation | ||
| y_values = [-np.log10(region.data.pvalue) if region.data.pvalue > 0 else 0 |
There was a problem hiding this comment.
Mh, a pvalue of 0 is plotted at Y=0 ... is that what we want?
There was a problem hiding this comment.
Fair comment. The clamping is just to avoid breaking the log function, but this then causes invalid p-values (negative or 0) to be plotted at Y=0.
They could be removed instead, or an error could be raised. Depends on how you want to handle incorrect input data
There was a problem hiding this comment.
Could we set the transformation as a parameter? like we do in bedgraph or bigwig?
Currently, options are:
- transform: no (default) or log, log1p, -log, log2 or log10.
- log_pseudocount: 0 (default) or any float
And we could add -log10
There was a problem hiding this comment.
If p-values are 0 or negative it would raise an error, see:
pyGenomeTracks/pygenometracks/utilities.py
Line 258 in f25fcf1
| show_data_range = true | ||
| # the default for min_value and max_value is 'auto' which means that the scale will go | ||
| # roughly from the minimum value found in the region plotted to the maximum value found. | ||
| min_value = 0 |
There was a problem hiding this comment.
The default is auto. We put here suggestions for possible values.
This is based on #493