Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Maaslin only and report method in plot #543

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ export const plugin: ComputationPlugin = {
createDefaultConfiguration: () => undefined,
isConfigurationValid: isCompleteDifferentialAbundanceConfig,
visualizationPlugins: {
volcanoplot: volcanoPlotVisualization, // Must match name in data service and in visualization.tsx
volcanoplot: volcanoPlotVisualization.withOptions({
getPlotSubtitle(config) {
if (DifferentialAbundanceConfig.is(config)) {
return `Differential abundance computed using ${config.differentialAbundanceMethod} with default parameters.`;
}
},
}), // Must match name in data service and in visualization.tsx
},
};

Expand All @@ -117,10 +123,6 @@ function DifferentialAbundanceConfigDescriptionComponent({
'comparator' in configuration
? findEntityAndVariable(configuration.comparator.variable)
: undefined;
const differentialAbundanceMethod =
'differentialAbundanceMethod' in configuration
? configuration.differentialAbundanceMethod
: undefined;

const updatedCollectionVariable = collections.find((collectionVar) =>
isEqual(
Expand Down Expand Up @@ -154,22 +156,14 @@ function DifferentialAbundanceConfigDescriptionComponent({
)}
</span>
</h4>
<h4>
Method:{' '}
<span>
{differentialAbundanceMethod ? (
differentialAbundanceMethod
) : (
<i>Not selected</i>
)}
</span>
</h4>
</div>
);
}

// Include available methods in this array.
const DIFFERENTIAL_ABUNDANCE_METHODS = ['DESeq', 'Maaslin'];
// 10/10/23 - decided to only release Maaslin for the first roll-out. DESeq is still available
// and we're poised to release it in the future.
const DIFFERENTIAL_ABUNDANCE_METHODS = ['Maaslin']; // + 'DESeq' in the future

export function DifferentialAbundanceConfiguration(
props: ComputationConfigProps
Expand All @@ -189,6 +183,11 @@ export function DifferentialAbundanceConfiguration(
const filters = analysisState.analysis?.descriptor.subset.descriptor;
const findEntityAndVariable = useFindEntityAndVariable(filters);

// Only releasing Maaslin for b66
if (configuration)
configuration.differentialAbundanceMethod =
DIFFERENTIAL_ABUNDANCE_METHODS[0];

// Include known collection variables in this array.
const collections = useCollectionVariables(studyMetadata.rootEntity);
if (collections.length === 0)
Expand All @@ -207,13 +206,14 @@ export function DifferentialAbundanceConfiguration(
);

const collectionVarItems = useMemo(() => {
// Show all collections except for absolute abundance. Eventually this will be performed by
// the backend, similar to how we do visualization input var constraints.
return collections
.filter((collectionVar) => {
return collectionVar.normalizationMethod // i guess diy stuff doesnt have this prop?
? // !collectionVar.isProportion &&
// collectionVar.normalizationMethod === 'NULL' &&
!collectionVar.displayName?.includes('pathway')
: true;
return collectionVar.normalizationMethod
? collectionVar.normalizationMethod !== 'NULL' ||
collectionVar.displayName?.includes('pathway')
: true; // DIY may not have the normalizationMethod annotations, but we still want those datasets to pass.
})
.map((collectionVar) => ({
value: {
Expand All @@ -225,7 +225,6 @@ export function DifferentialAbundanceConfiguration(
}));
}, [collections]);

// TODO presumably to keep the saved analyses from breaking, we need to maintain support for a variableId
const selectedCollectionVar = useMemo(() => {
if (configuration && 'collectionVariable' in configuration) {
const selectedItem = collectionVarItems.find((item) =>
Expand Down Expand Up @@ -298,12 +297,6 @@ export function DifferentialAbundanceConfiguration(
}
);

const differentialAbundanceMethod = useMemo(() => {
if (configuration && 'differentialAbundanceMethod' in configuration) {
return configuration.differentialAbundanceMethod;
}
}, [configuration]);

return (
<ComputationStepContainer
computationStepInfo={{
Expand Down Expand Up @@ -465,24 +458,6 @@ export function DifferentialAbundanceConfiguration(
</Tooltip>
</div>
</div>

<div className={cx('-InputContainer')}>
<span>Method</span>
<SingleSelect
value={differentialAbundanceMethod ?? 'Select a method'}
buttonDisplayContent={
differentialAbundanceMethod ?? 'Select a method'
}
onSelect={partial(
changeConfigHandler,
'differentialAbundanceMethod'
)}
items={DIFFERENTIAL_ABUNDANCE_METHODS.map((method) => ({
value: method,
display: method,
}))}
/>
</div>
</div>
</ComputationStepContainer>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { createVisualizationPlugin } from '../VisualizationPlugin';
import LabelledGroup from '@veupathdb/components/lib/components/widgets/LabelledGroup';
import { NumberInput } from '@veupathdb/components/lib/components/widgets/NumberAndDateInputs';

import { LayoutOptions } from '../../layouts/types';
import { LayoutOptions, TitleOptions } from '../../layouts/types';
import { RequestOptions } from '../options/types';

// Volcano plot imports
Expand All @@ -34,7 +34,6 @@ import DataClient, {
VolcanoPlotResponse,
} from '../../../api/DataClient';
import {
VolcanoPlotData,
VolcanoPlotDataPoint,
VolcanoPlotStats,
} from '@veupathdb/components/lib/types/plots/volcanoplot';
Expand All @@ -54,6 +53,7 @@ import SliderWidget, {
import { ResetButtonCoreUI } from '../../ResetButton';
import AxisRangeControl from '@veupathdb/components/lib/components/plotControls/AxisRangeControl';
import { fixVarIdLabel } from '../../../utils/visualization';
import { OutputEntityTitle } from '../OutputEntityTitle';
// end imports

const DEFAULT_SIG_THRESHOLD = 0.05;
Expand Down Expand Up @@ -106,6 +106,7 @@ export const VolcanoPlotConfig = t.partial({

interface Options
extends LayoutOptions,
TitleOptions,
RequestOptions<VolcanoPlotConfig, {}, VolcanoPlotRequestParams> {}

// Volcano Plot Visualization
Expand All @@ -120,8 +121,6 @@ function VolcanoPlotViz(props: VisualizationProps<Options>) {
updateConfiguration,
updateThumbnail,
filters,
dataElementConstraints,
dataElementDependencyOrder,
filteredCounts,
computeJobStatus,
} = props;
Expand Down Expand Up @@ -384,6 +383,11 @@ function VolcanoPlotViz(props: VisualizationProps<Options>) {
]
);

// plot subtitle
const plotSubtitle = options?.getPlotSubtitle?.(
computation.descriptor.configuration
);

// Add labels to the extremes of the x axis. These may change in the future based on the type
// of data. For example, for genes we may want to say Up regulated in...
const comparisonLabels =
Expand Down Expand Up @@ -627,12 +631,7 @@ function VolcanoPlotViz(props: VisualizationProps<Options>) {
/>
</LabelledGroup>

{/* This should be populated with info from the colections var. So like "Showing 1000 taxa blah". Waiting on collections annotations. */}
{/* <OutputEntityTitle
entity={outputEntity}
outputSize={outputSize}
subtitle={plotSubtitle}
/> */}
<OutputEntityTitle subtitle={plotSubtitle} />
<LayoutComponent
isFaceted={false}
legendNode={legendNode}
Expand Down
Loading