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

Rare phenotypes #801

Merged
merged 2 commits into from
Dec 3, 2024
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
3 changes: 2 additions & 1 deletion src/components/PigeanTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,12 @@ export default Vue.component("pigean-table", {
)}`"
:plot-name="`PIGEAN_${row.item.phenotype}`"
:phenotypes-data="phewasData[phewasKey(row.item)]"
:phenotype-map="$store.state.bioPortal.phenotypeMap"
:phenotype-map="phenotypeMap || $store.state.bioPortal.phenotypeMap"
:colors="plotColors"
:render-config="phewasRenderConfig"
:utils="utilsBox"
:native-dl-btn="false"
:top1500="true"
>
</research-phewas-plot>
<pigean-table
Expand Down
25 changes: 17 additions & 8 deletions src/components/researchPortal/ResearchPheWAS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ Vue.use(BootstrapVueIcons);
export default Vue.component("ResearchPhewasPlot", {
props: [
"canvasId", "phenotypeMap", "phenotypesData", "renderConfig", "pkgData", "pkgDataSelected",
"colors", "plotMargin", "filter", "options", "sectionId", "sectionId", "utils", "plotName"
"colors", "plotMargin", "filter", "options", "sectionId", "sectionId", "utils", "plotName",
"top1500"
],

data() {
Expand Down Expand Up @@ -201,20 +202,23 @@ export default Vue.component("ResearchPhewasPlot", {

if (!!this.phenotypesData) {
let phenotypesData = cloneDeep(this.phenotypesData);
phenotypesData.forEach(d => {
d["rawPValue"] = this.getPValue(d);
});
phenotypesData = phenotypesData.sort((a,b) => a.rawPValue - b.rawPValue);
if (!!this.top1500){
// Restrict to the top 1500 phenotypes by p-value
// for when 6500 traits are used.
phenotypesData = phenotypesData.slice(0,1500);
}

phenotypesData.map((d) => {
let pValue =
typeof d[this.renderConfig["y axis field"]] == "string"
? Number(d[this.renderConfig["y axis field"]])
: d[this.renderConfig["y axis field"]];
d["rawPValue"] = pValue;

if (
this.renderConfig["convert y -log10"] == true ||
this.renderConfig["convert y -log10"] == "true"
) {
d[this.renderConfig["y axis field"] + "-log10"] =
-Math.log10(pValue);
-Math.log10(d["rawPValue"]);
}

if (
Expand Down Expand Up @@ -270,6 +274,11 @@ export default Vue.component("ResearchPhewasPlot", {
},
},
methods: {
getPValue(d){
return typeof d[this.renderConfig["y axis field"]] == "string"
? Number(d[this.renderConfig["y axis field"]])
: d[this.renderConfig["y axis field"]];
},
downloadImage(ID, NAME, TYPE) {
if (TYPE == "svg") {
this.$refs[this.canvasId + "_pheWasPlot"].renderPlot();
Expand Down
1 change: 1 addition & 0 deletions src/views/PIGEAN/Phenotype/Template.vue
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
:pigeanData="$store.state.pigeanFactor.data"
:config="$parent.factorTableConfig"
:phewasRenderConfig="$parent.renderConfig"
:phenotypeMap="$parent.pigeanMap"
>
</pigean-table>
</div>
Expand Down
Loading