diff --git a/src/App.vue b/src/App.vue index 835ca0dfe019e67b82203489fa1779769df44d92..102a535e1d76c49662b8772c4ffc90a294e8f7ea 100644 --- a/src/App.vue +++ b/src/App.vue @@ -591,42 +591,42 @@ export default { isActive: true, categories: [ { - id: 1, + id: "biologicalMacromolecule", component: "uniprot", description: "Biological macromolecules", question: "Connection to biological macromolecules", fields: [] }, { - id: 2, + id: "life", component: "taxon_cell", description: "Living organisms", question: "Connection to living organisms", fields: [] }, { - id: 3, + id: "assay", component: "bioassay", description: "Bioassay", question: "Bioassay content", fields: [] }, { - id: 4, + id: "disease", component: "disease", description: "Diseases", question: "Connection to diseases", fields: [] }, { - id: 5, + id: "anatomicalCategory", component: "anatomy", description: "Anatomical entity", question: "Relation to anatomical entity", fields: [] }, { - id: 6, + id: "goTerm", component: "GO", description: "GO terms", question: "Matching Gene Ontology terms", @@ -635,21 +635,21 @@ export default { fields: [] }, { - id: 7, + id: "chebi", component: "chebi", question: "Associated CHEBI-terms", description: "CHEBI-terms", fields: [] }, { - id: 8, + id: "technique", component: "technique", question: "Used techniques", description: "Techniques", fields: [] }, { - id: 9, + id: "discipline", component: "discipline", question: "Involved disciplines", description: "Disciplines", diff --git a/src/components/display/pharma_display/PhDJsonld.vue b/src/components/display/pharma_display/PhDJsonld.vue index cba7c6fbc2b622ea23175b3d45b2f4e9a61b6f6f..be8821f8344bddfceeb7a6a44d012d758a9e3d94 100644 --- a/src/components/display/pharma_display/PhDJsonld.vue +++ b/src/components/display/pharma_display/PhDJsonld.vue @@ -310,15 +310,16 @@ </template> </template> <template v-for="(categ,index) in pharmaStructure"> - <v-card v-if="categ.fields.length>0" :key="'category'+index"> + <v-card v-if="categ.fields.length>0" :key="index+categ.category"> <v-toolbar dense flat> <v-layout> - <v-toolbar-title class="font-weight-light">{{categ.category}}</v-toolbar-title> + <v-toolbar-title class="font-weight-light">{{categ.label}}</v-toolbar-title> </v-layout> </v-toolbar> <template v-if="categ.fields.length>0"> <v-card v-for="l in categ.fields" :key="l+'field'"> + l {{l}} <!-- s {{s}} type {{sec.type}} label {{s.label}} if {{getSelectionElem(sec.type,s.label)}}--> <v-layout v-if="l"> <v-flex xs1 class="subheading"> @@ -366,6 +367,66 @@ :key="inputf+index+'pharmasubject'" ></ph-d-metadata> + <v-divider></v-divider> + </v-card> + </template>--> + </v-card> + <v-card v-if="categ.subcategory" :key="index+categ.subcategory"> + <v-toolbar dense flat> + <v-layout> + <v-toolbar-title class="font-weight-light">{{categ.label}}</v-toolbar-title> + </v-layout> + </v-toolbar> + + <template v-if="categ.subcategory.length>0"> + <v-card v-for="l in categ.subcategory" :key="l+'field'"> + <!-- s {{s}} type {{sec.type}} label {{s.label}} if {{getSelectionElem(sec.type,s.label)}}--> + <v-layout v-if="l"> + l{{l}} + <v-flex xs1 class="subheading"> + <a :href="l.id" target="_blank">{{l.category}}</a> + </v-flex> + <v-flex xs11> + <v-card v-for="(inputf,index) in l.fields" :key="index+'subjectField'"> + <!-- <v-flex xs2 v-if="inputf.selection">{{getLabel(inputf.data['@type'])}}</v-flex>--> + <p-d-skos-preflabel + v-if="getSkosexactMatch(inputf)==undefined" + :p="getLabel(inputf['@type'])" + :o="inputf" + :key="inputf+index+'pharmafreesubject'" + ></p-d-skos-preflabel> + + <ph-d-metadata + v-if="getSkosexactMatch(inputf)" + :o="inputf" + :p="p" + :key="inputf+index+'pharmasubject'" + ></ph-d-metadata> + </v-card> + </v-flex> + <v-divider></v-divider> + </v-layout> + </v-card> + </template> + <!--<template v-else> + <v-card v-for="(inputf,index) in getCatElem(sec.type)" :key="index+'subj'"> + <v-flex xs2> + <a :href="sec.id" target="_blank">{{getLabel(inputf.data['@type'])}}</a> + </v-flex> + + <p-d-skos-preflabel + v-if="getSkosexactMatch(inputf.data)==undefined" + :p="getLabel(inputf.data['@type'])" + :o="inputf.data" + :key="inputf+index+'pharmafreesubject'" + ></p-d-skos-preflabel> + <ph-d-metadata + v-if="getSkosexactMatch(inputf.data)" + :o="inputf.data" + :p="p" + :key="inputf+index+'pharmasubject'" + ></ph-d-metadata> + <v-divider></v-divider> </v-card> </template>--> @@ -507,63 +568,111 @@ export default { for (let i = 0; i < formCategories.length; i++) { //only look at the ones which have not a skos:Concept type var formFields = formCategories[i].fields; - + console.log("formCategories @@@@@@@@@@@", formCategories[i]); jsonStructured[i] = { - category: formCategories[i].description, + category: formCategories[i].id, + label: formCategories[i].description, fields: [] }; var formFieldsFiltered = formFields.filter( formFields => formFields.type != "skos:Concept" ); - //check which of those filetered fields ffields have a value in subjects + //check which of those filetered fields ffields have a value in the jsonld for (var j = 0; j < formFieldsFiltered.length; j++) { - console.log( - "looping over fileds", - formFieldsFiltered[j].label, - formFieldsFiltered[j].subcategory - ); // console.log("ffields[j].type", ffields[j].type); //filter all the elem in subjects which have this type var jsonTypeArray = pharmajson.filter(function(fs) { return fs["@type"] == formFieldsFiltered[j].type; }); - if (jsonTypeArray.length > 0) { + /*if (jsonTypeArray.length > 0) { console.log( "got those", jsonTypeArray, "for", formFieldsFiltered[j].type ); - } + }*/ if (jsonTypeArray.length > 0) { - jsonStructured[i].fields[j] = { - label: "", - id: "" - }; + console.log( + "looping over fileds", + formFieldsFiltered[j].label, + formFieldsFiltered[j].category[0] + ); + //find first whether there is a subcategory if (formFieldsFiltered[j].subcategory) { console.log( "formFieldsFiltered[j].subcategory", - formFieldsFiltered[j].subcategory + formFieldsFiltered[j].subcategory[0] + ); + //the category is formFieldsFiltered[j].category + // if it exists, push to it, otherwise create it + var n_categ = formFieldsFiltered[j].category[0]; + var n_subcat = formFieldsFiltered[j].subcategory[0]; + //check if it exists already + var result = jsonStructured.findIndex( + obj => obj.category === n_categ ); - jsonStructured[i].fields[j].subcategory = - formFieldsFiltered[j].subcategory; - //jsonStructured[i].fields[j].subcategory = { - // label: formFieldsFiltered[j].label, - // id: formFieldsFiltered[j].infoRef - //}; - //jsonStructured[i].fields[j].subcategory.entries = jsonTypeArray; + console.log( + "n_categ", + n_categ, + "result", + result, + "subcat", + n_subcat + ); + if (result >= 0) { + if (jsonStructured[result].subcategory) { + var r = jsonStructured[result].subcategory.findIndex( + obj => obj.category === n_subcat + ); + console.log( + "n_sub r", + r, + "formFieldsFiltered[j].infoRef", + formFieldsFiltered[j].infoRef + ); + if (r >= 0) { + jsonStructured[result].subcategory[r].fields.push( + jsonTypeArray[0] + ); + } else { + jsonStructured[result].subcategory.push({ + category: n_subcat, + id: formFieldsFiltered[j].infoRef, + fields: jsonTypeArray + }); + } + } else { + jsonStructured[result].subcategory = [ + { + category: formFieldsFiltered[j].subcategory[0], + fields: jsonTypeArray + } + ]; + } + } } - jsonStructured[i].fields[j] = { - label: formFieldsFiltered[j].label, - id: formFieldsFiltered[j].infoRef - }; - jsonStructured[i].fields[j].entries = jsonTypeArray; + //if there is a subcategory, we need to push those as a subcategory of the category + //jsonStructured[i].fields[j].subcategory = + // formFieldsFiltered[j].subcategory; + console.log("jsonstructHERE", jsonStructured[i]); + //jsonStructured[i].fields[j].subcategory = { + // label: formFieldsFiltered[j].label, + // id: formFieldsFiltered[j].infoRef + //}; + //jsonStructured[i].fields[j].subcategory.entries = jsonTypeArray; } + //jsonStructured[i].fields[j] = { + // label: formFieldsFiltered[j].label, + // id: formFieldsFiltered[j].infoRef + //}; + //jsonStructured[i].fields[j].entries = jsonTypeArray; } } + console.log("jsonStructured", jsonStructured); return jsonStructured; }, diff --git a/src/utils/fields.js b/src/utils/fields.js index 70c2d76e8d4e6631efd88cbaf7cde8da896d13c6..010121f3da0765bf62c50afe56fe1970cb985179 100644 --- a/src/utils/fields.js +++ b/src/utils/fields.js @@ -212,7 +212,7 @@ const fields = [ category: ["biologicalMacromolecule"], subcategory: ["Protein"], description: "Protein", - infoRef: "", + infoRef: "http://purl.obolibrary.org/obo/", info: "UniProt ID EDAM>data:3021 Accession number of a UniProt (protein sequence) database entry" }, @@ -252,7 +252,7 @@ const fields = [ description: "Protein", info: "Any subcellular or molecular event, process, or condition that produces a divergence from the usual wild-type condition in the primary sequence of a peptide or protein molecule. (NCI) [ NCI ]", - infoRef: "NCIT:C21070" + infoRef: "http://purl.obolibrary.org/obo/NCIT:C21070" }, { id: "1-Protein-modification", @@ -271,7 +271,7 @@ const fields = [ description: "Protein", info: "Covalent modification of, or a change resulting in an alteration of the measured molecular mass of, a peptide or protein amino acid residue. [ PubMed:18688235 ]", - infoRef: "protein modification MOD:00000" + infoRef: "http://purl.obolibrary.org/obo/MOD:00000" }, { id: "1-Entrez-gene-ID", @@ -290,7 +290,7 @@ const fields = [ description: "Gene", info: "EntrezGene_ID NCIT:C49379 Indicates the accession number for a Gene within the Entrez Gene database. [ NCI ]", - infoRef: "NCIT:C49379" + infoRef: "http://purl.obolibrary.org/obo/NCIT:C49379" }, { id: "1-Gene-modification", @@ -309,7 +309,7 @@ const fields = [ description: "Gene", info: "Gene modification NCIT:C126104 Any gene manipulation method used to generate a product with an altered sequence, structure, or conformation. [ NCI ]", - infoRef: "NCIT:C126104" + infoRef: "http://purl.obolibrary.org/obo/NCIT:C126104" }, { id: "1-Nucleic-acid-type", @@ -329,9 +329,10 @@ const fields = [ topId: "CHEBI_15986", component: "ext-service", category: ["biologicalMacromolecule"], - subcategory: ["Polynucleotide"], - description: "Polynucleotide", - info: "CHEBI:15986" + subcategory: ["polynucleotide"], + description: "polynucleotide", + info: "CHEBI:15986", + infoRef: "http://purl.obolibrary.org/obo/CHEBI:15986" }, { id: "1-RefSeq-accession", @@ -387,6 +388,7 @@ const fields = [ treeview: false, component: "ext-service", category: ["biologicalMacromolecule"], + subcategory: ["Protein Subunit"], description: "Protein Subunit", info: "UniProt ID EDAM>data:3021 Accession number of a UniProt (protein sequence) database entry" @@ -405,6 +407,7 @@ const fields = [ freefield: true, component: "text-field", category: ["biologicalMacromolecule"], + subcategory: ["Protein Subunit"], description: "Protein Subunit", info: "A quality of a protein that harbors a variation from the native protein (called canonical form), which could arise due to alternative promoter usage, alternative splicing, alternative translation initiation and ribosomal frameshifting.", @@ -424,6 +427,7 @@ const fields = [ freefield: true, component: "text-field", category: ["biologicalMacromolecule"], + subcategory: ["Protein Subunit"], description: "Protein Subunit", info: "Any subcellular or molecular event, process, or condition that produces a divergence from the usual wild-type condition in the primary sequence of a peptide or protein molecule. (NCI) [ NCI ]", @@ -443,6 +447,7 @@ const fields = [ freefield: true, component: "text-field", category: ["biologicalMacromolecule"], + subcategory: ["Protein Subunit"], description: "Protein Subunit", info: "Covalent modification of, or a change resulting in an alteration of the measured molecular mass of, a peptide or protein amino acid residue. [ PubMed:18688235 ]", @@ -461,6 +466,7 @@ const fields = [ removable: false, component: "text-field", category: ["biologicalMacromolecule"], + subcategory: ["Protein Complex"], description: "Protein Complex", info: "A persistent (stable) and unique identifier of the manually curated EMBL-EBI Complex-Portal (Complex Portal", @@ -484,6 +490,7 @@ const fields = [ topId: "CHEBI_18154", component: "ext-service", category: ["biologicalMacromolecule"], + subcategory: ["Polysaccharide"], description: "Polysaccharide", info: "" }, @@ -504,6 +511,7 @@ const fields = [ topId: "CHEBI_18059", component: "ext-service", category: ["biologicalMacromolecule"], + subcategory: ["Lipid"], description: "Lipid", info: "" }, @@ -522,6 +530,7 @@ const fields = [ multiplicable: false, visible: true, category: ["life"], + vocabulary: "life", info: "Life NCIT:C142142 Thee biochemical phenomenon that distinguishes organisms from inorganic matter. It is characterized by growth, metabolism, and reproduction. [ NCI ]" @@ -546,6 +555,7 @@ const fields = [ //topId: "NCBITaxon_1", topId: "NCBITaxon_1", category: ["life"], + //baseurl: "http://purl.obolibrary.org/obo/" description: "Living Organisms", infoRef: "http://purl.obolibrary.org/obo/NCBITaxon_1", @@ -570,6 +580,7 @@ const fields = [ //topId: "NCBITaxon_1", topId: "NCBITaxon_10239", category: ["life"], + subcategory: ["Viruses"], //baseurl: "http://purl.obolibrary.org/obo/" description: "Living Organisms", infoRef: "http://purl.obolibrary.org/obo/NCBITaxon_10239", @@ -594,6 +605,7 @@ const fields = [ //topId: "NCBITaxon_1", topId: "NCBITaxon_12884", category: ["life"], + subcategory: ["Viroids"], //baseurl: "http://purl.obolibrary.org/obo/" description: "Living Organisms", infoRef: "http://purl.obolibrary.org/obo/NCBITaxon_12884", @@ -618,6 +630,7 @@ const fields = [ //topId: "NCBITaxon_1", topId: "NCBITaxon_131567", category: ["life"], + subcategory: ["Cellular organisms"], //baseurl: "http://purl.obolibrary.org/obo/" description: "Living Organisms", infoRef: "http://purl.obolibrary.org/obo/NCBITaxon_131567", @@ -628,7 +641,7 @@ const fields = [ predicate: "dcterms:subject", type: "pharmaWien:LivingOrganismOSeq", //subjectType: "LivingOrganism", - label: "other sequences:", + label: "Other sequences:", value: "", visible: false, required: false, @@ -642,6 +655,7 @@ const fields = [ //topId: "NCBITaxon_1", topId: "NCBITaxon_28384", category: ["life"], + subcategory: ["Other sequences:"], //baseurl: "http://purl.obolibrary.org/obo/" description: "Living Organisms", infoRef: "http://purl.obolibrary.org/obo/NCBITaxon_28384", @@ -666,6 +680,7 @@ const fields = [ //topId: "NCBITaxon_1", topId: "NCBITaxon_12908", category: ["life"], + subcategory: ["Unclassified sequences:"], //baseurl: "http://purl.obolibrary.org/obo/" description: "Living Organisms", infoRef: "http://purl.obolibrary.org/obo/NCBITaxon_12908",