Skip to content

Commit

Permalink
add estimate_background option
Browse files Browse the repository at this point in the history
  • Loading branch information
shapiromatron committed Nov 15, 2024
1 parent 1c3eaf9 commit 79f4f37
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions bmds_ui/analysis/validators/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class NestedDichotomousOption(BaseModel):
litter_specific_covariate: LitterSpecificCovariate
bootstrap_iterations: int
bootstrap_seed: int
estimate_background: bool


class DichotomousOptions(BaseModel):
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/IndividualModel/ModelOptionsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {observer} from "mobx-react";
import PropTypes from "prop-types";
import React, {Component} from "react";

import {getLabel} from "@/common";
import {checkOrEmpty, getLabel} from "@/common";
import TwoColumnTable from "@/components/common/TwoColumnTable";
import {Dtype} from "@/constants/dataConstants";
import {hasDegrees} from "@/constants/modelConstants";
Expand Down Expand Up @@ -70,8 +70,6 @@ class ModelOptionsTable extends Component {
["BMR Type", getLabel(model.settings.bmr_type, dichotomousBmrOptions)],
["BMR", ff(model.settings.bmr)],
["Confidence Level (one sided)", ff(1 - model.settings.alpha)],
["Bootstrap Seed", model.settings.bootstrap_seed],
["Bootstrap Iterations", model.settings.bootstrap_iterations],
[
"Litter Specific Covariate",
getLabel(
Expand All @@ -83,6 +81,9 @@ class ModelOptionsTable extends Component {
"Intralitter Correlation",
getLabel(model.settings.intralitter_correlation, intralitterCorrelation),
],
["Estimate Background", checkOrEmpty(model.settings.estimate_background)],
["Bootstrap Iterations", model.settings.bootstrap_iterations],
["Bootstrap Seed", model.settings.bootstrap_seed],
];
} else {
throw "Unknown dtype";
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/Main/OptionsForm/OptionsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from "@/constants/optionsConstants";

import Button from "../../common/Button";
import CheckboxInput from "../../common/CheckboxInput";
import FloatInput from "../../common/FloatInput";
import IntegerInput from "../../common/IntegerInput";
import SelectInput from "../../common/SelectInput";
Expand Down Expand Up @@ -99,6 +100,14 @@ const OptionsForm = props => {
})}
/>
</td>
<td>
<CheckboxInput
checked={props.options.estimate_background}
onChange={value =>
props.saveOptions("estimate_background", value, props.idx)
}
/>
</td>
<td>
<IntegerInput
value={props.options.bootstrap_iterations}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class OptionsFormList extends Component {
<br />
Covariate
</th>
<th>Estimate Background</th>
<th>
Bootstrap
<br />
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/Main/OptionsForm/OptionsReadOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import PropTypes from "prop-types";
import React from "react";

import {getLabel} from "@/common";
import {checkOrEmpty} from "@/common";
import {
MODEL_CONTINUOUS,
MODEL_DICHOTOMOUS,
Expand Down Expand Up @@ -48,6 +49,7 @@ const OptionsReadOnly = props => {
litterSpecificCovariateOptions
)}
</td>
<td>{checkOrEmpty(options.estimate_background)}</td>
<td>{options.bootstrap_iterations}</td>
<td>{options.bootstrap_seed}</td>
</>
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Output/OptionSetTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {inject, observer} from "mobx-react";
import PropTypes from "prop-types";
import React, {Component} from "react";

import {getLabel} from "@/common";
import {checkOrEmpty, getLabel} from "@/common";
import {adverseDirectionOptions, allDegreeOptions} from "@/constants/dataConstants";
import {MODEL_CONTINUOUS, MODEL_DICHOTOMOUS} from "@/constants/mainConstants";
import {
Expand Down Expand Up @@ -56,15 +56,16 @@ class OptionSetTable extends Component {
["BMR Type", getLabel(selectedModelOptions.bmr_type, dichotomousBmrOptions)],
["BMR", ff(selectedModelOptions.bmr_value)],
["Confidence Level (one sided)", ff(selectedModelOptions.confidence_level)],
["Bootstrap Seed", selectedModelOptions.bootstrap_seed],
["Bootstrap Iterations", selectedModelOptions.bootstrap_iterations],
[
"Litter Specific Covariate",
getLabel(
selectedModelOptions.litter_specific_covariate,
litterSpecificCovariateOptions
),
],
["Estimate Background", checkOrEmpty(selectedModelOptions.estimate_background)],
["Bootstrap Seed", selectedModelOptions.bootstrap_seed],
["Bootstrap Iterations", selectedModelOptions.bootstrap_iterations],
];
} else if (outputStore.isMultiTumor) {
rows = [
Expand Down
1 change: 1 addition & 0 deletions frontend/src/constants/optionsConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const options = {
litter_specific_covariate: 1,
bootstrap_iterations: 1000,
bootstrap_seed: 0,
estimate_background: true,
},
[MODEL_MULTI_TUMOR]: {
bmr_type: 1,
Expand Down
1 change: 1 addition & 0 deletions tests/analysis/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def test_nested_dichotomous(self, nested_dichotomous_datasets):
"litter_specific_covariate": 1,
"bootstrap_iterations": 1000,
"bootstrap_seed": 0,
"estimate_background": True,
}
]
assert validators.validate_input(data, partial=True) is None
Expand Down

0 comments on commit 79f4f37

Please sign in to comment.