Skip to content
This repository has been archived by the owner on Nov 13, 2018. It is now read-only.

Commit

Permalink
Type filter was not added. Fixed broken tooltip descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelafon committed Sep 1, 2016
1 parent 3871e06 commit 7ceb82b
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/resources/descriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const DESC = {
"map_qual_rank_sum": "Z-score From Wilcoxon rank sum test for mapping qualities (quality of reads supporting REF vs. quality of reads supporting ALT).",
"read_pos_rank_sum": "Z-score From Wilcoxon rank sum test for site position within reads (position within reads supporting REF vs. position within reads supporting ALT).",
"strand_bias_odds_ratio": "Symmetric Odds Ratio of 2x2 contingency table to detect strand bias.",
"vqslod": "Variant Quality Score Recalibration (VQSR). Log odds ratio of being a true variant versus being false under the trained Gaussian mixture model.",
"allele_count": "Total number of times this allele appears across all samples (VCF AC field).",
"allele_freq": "Allele frequency across all samples (VCF AF field)."
};
Expand Down
119 changes: 119 additions & 0 deletions app/scripts/modules/react/filters/kinds/OneChoiceFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
'use strict';
var React = require('react');
var FilterActions = require('../../../actions/FilterActions');
var formatters = require('../../../utils/formatters.js');
var HelpTooltip = require('../../tooltips/HelpTooltip.js').HelpTooltip;
/**
* @class OneChoiceFilter
* @description Radio-button to select a unique value.
* Currently only used for "Variant type", and is almost a copy of TrueFalseAnyFilter.
* Make it more general if it applies to more things.
*/


class OneChoiceFilter extends React.Component {
constructor(props) {
super(props);
/* Use props to init the internal state only */
this.state = {value: props.value};
this.onChange = this.onChange.bind(this);
}
/* Because the props might change as the result of another action, like changing the db,
the state needs to be updated when props are received */
componentWillReceiveProps(nextProps) {
this.setState({value: nextProps.value});
}

onChange(e) {
var value = e.target.value;
if (value === 'any') {
value = undefined;
} else {
value = value.toLowerCase();
}
this.setState({ value }); // change checked state right away
FilterActions.updateOneFilterValue(this.props.field, value);
}

render() {
if (! this.props.stats) {
return <div></div>;
}
var stats = this.props.stats;
var key = this.props.key;
var value = this.state.value;
var countBadge = function (option, val) {
/* `option` is true or false or undefined; it represents one of the 3 check options.
`val` is the current state of the choice - also true or false or undefined. */
return (option !== val && option !== undefined && (stats[option] === undefined || stats[option] === 0)) ?
<span></span> :
<span className="badge count">{formatters.kmCount(stats[option] || 0)}</span>;
};

return (
<div id={'one-filter-'+this.props.field} className="one-filter truefalseany-filter">
<div className="filter-name">
{this.props.name}
<span style={{paddingLeft: '5px'}}>
<HelpTooltip name={this.props.field} category={'filters'} />
</span>
</div>
<div className="filter-input">

{/* TRUE */}

<div className="one-choice one-choice-true-false">
<div className="option-name">
<input
type="radio"
name={key}
checked={value === 'snp'}
onChange={this.onChange}
value="SNP"
/>
<span> SNP</span>
</div>
<small className="true">
{countBadge('snp', value)}
</small>
</div>

{/* FALSE */}

<div className="one-choice one-choice-true-false">
<div className="option-name">
<input
type="radio"
name={key}
checked={value === 'indel'}
onChange={this.onChange}
value="Indel"
/>
<span> indel</span>
</div>
<small className="false">
{countBadge('indel', value)}
</small>
</div>

{/* ANY */}

<div className="one-choice once-choice-any">
<div className="option-name">
<input
type="radio"
name={key}
checked={value === undefined}
onChange={this.onChange}
value="any"
/>
<span> any</span>
</div>
</div>
</div>
</div>
);
}
}

module.exports = OneChoiceFilter;
10 changes: 5 additions & 5 deletions app/scripts/modules/react/tooltips/HelpTooltipDescriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ var descriptions = {
'variant_columns': DESC,
'filters': {
'quality': DESC.quality,
'pass_filter': DESC.filter,
'pass_filter': DESC.pass_filter,
'qual_depth': DESC.qual_depth,
'fisher_strand_bias': DESC.strand_bias + ' The higher value, the more likely there is to be bias.',
'fisher_strand_bias': DESC.fisher_strand_bias + ' The higher value, the more likely there is to be bias.',
'rms_map_qual': DESC.rms_map_qual,
//'impact': 'Location of the mutation inside a gene, characterizing the impact on the protein.',
//'impact_severity': 'Severity of the impact of the mutation on the protein.',
'sift_pred': DESC.sift_pred,
'polyphen_pred': DESC.polyphen_pred,
'sift_score': DESC.sift_pred + ' The lower, the more deleterious.',
'polyphen_score': DESC.polyphen_pred + ' The higher, the more deleterious.',
'gerp_bp_score': DESC.gerp_db_score + ' Higher scores reflect greater conservation.',
'gerp_bp_score': DESC.gerp_bp_score + ' Higher scores reflect greater conservation.',
'gerp_element_pval': DESC.gerp_element_pval + ' Lower P-values scores reflect greater conservation.',
'cadd_raw': DESC.cadd_raw + ' Indels have no score and will not be filtered out.',
'cadd_scaled': DESC.cadd_scaled + ' Indels have no score and will not be filtered out.',
Expand All @@ -31,11 +31,11 @@ var descriptions = {
'aaf_max_all': DESC.aaf_max_all,
'base_qual_rank_sum': DESC.base_qual_rank_sum +
' Near 0 is better (means "no difference").',
'map_qual_rank_sum': DESC.map_qual__rank_summ +
'map_qual_rank_sum': DESC.map_qual_rank_sum +
' Near 0 is better (means "no difference").',
'read_pos_rank_sum': DESC.read_pos_rank_sum +
' Near 0 is better (means "no difference").',
'strand_bias_odds_ratio': DESC.sor + ' A high value is indicative of large bias.',
'strand_bias_odds_ratio': DESC.strand_bias_odds_ratio + ' A high value is indicative of large bias.',
},
'scenario': {
'active': 'All variants that are present in at least one of the selected individuals.',
Expand Down

0 comments on commit 7ceb82b

Please sign in to comment.