Skip to content

Commit

Permalink
fix PCC and removed GO. filtered the extension relatioship
Browse files Browse the repository at this point in the history
  • Loading branch information
tmushayahama committed May 3, 2024
1 parent 340a4be commit 73c6dce
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 8 deletions.
10 changes: 7 additions & 3 deletions src/@noctua.form/data/config/data-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ export class DataUtils {
return result;
}

public static getPredicates(shapes: ShexShapeAssociation[], subjectIds?: string[], objectIds?: string[]): string[] {
public static getPredicates(shapes: ShexShapeAssociation[], subjectIds?: string[], objectIds?: string[], excludeFromExtension = true): string[] {
const matchedPredicates = new Set<string>();

console.log(shapes, subjectIds, objectIds, excludeFromExtension)

// If neither subjectIds nor objectIds is provided, return all predicates
if (!subjectIds && !objectIds) {
shapes.forEach((shape) => {
matchedPredicates.add(shape.predicate);
if (shape.exclude_from_extensions !== excludeFromExtension) {
matchedPredicates.add(shape.predicate);
}
});
return [...matchedPredicates];
}
Expand All @@ -36,7 +40,7 @@ export class DataUtils {
const subjectMatch = !subjectIds || subjectIds.length === 0 || subjectIds.includes(shape.subject);
const objectMatch = !objectIds || objectIds.length === 0 || shape.object.some(objId => objectIds.includes(objId));

if (subjectMatch && objectMatch) {
if (subjectMatch && objectMatch && shape.exclude_from_extensions !== excludeFromExtension) {
matchedPredicates.add(shape.predicate);
}
});
Expand Down
7 changes: 7 additions & 0 deletions src/@noctua.form/data/config/entity-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export const ObsoleteTerm = {
categoryType: 'is_obsolete',
} as GoCategory;

export const GPProteinContainingComplex = {
id: ActivityNodeType.GoProteinContainingComplex,
category: 'GO:0032991',
categoryType: 'isa_closure',
suffix: `OR NOT idspace:"GO"`,
} as GoCategory;

export const GoProteinContainingComplex = {
id: ActivityNodeType.GoProteinContainingComplex,
category: 'GO:0032991',
Expand Down
2 changes: 1 addition & 1 deletion src/@noctua.form/data/config/model-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const simpleAnnotonDescription: ActivityDescription = {
gp: <ActivityNodeDisplay>{
id: 'gp',
type: ActivityNodeType.GoMolecularEntity,
category: [EntityDefinition.GoMolecularEntity, EntityDefinition.GoProteinContainingComplex],
category: [EntityDefinition.GoMolecularEntity, EntityDefinition.GPProteinContainingComplex],
label: 'Gene Product',
displaySection: noctuaFormConfig.displaySection.gp,
displayGroup: noctuaFormConfig.displayGroup.gp,
Expand Down
1 change: 0 additions & 1 deletion src/@noctua.form/data/config/shape-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const getShexJson = (subjectIds: string[], excludeFromExtensions = true)
subjectIds.forEach((subjectId: string) => {
const subjectShapes = DataUtils.getSubjectShapes(shapes, subjectId, excludeFromExtensions);
if (subjectShapes) {
const predicates = DataUtils.getPredicates(shapes);
const entities = DataUtils.getRangeLabels(subjectShapes, lookupTable)

pred.push(...entities)
Expand Down
77 changes: 77 additions & 0 deletions src/@noctua.form/data/gp-to-term.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,83 @@
"GO:0032991"
],
"predicate": "BFO:0000050"
},
{
"subject": "GO:0032991",
"object": [
"GO:0003674"
],
"predicate": "RO:0002327"
},
{
"subject": "GO:0032991",
"object": [
"GO:0003674"
],
"predicate": "RO:0002326"
},
{
"subject": "GO:0032991",
"object": [
"GO:0008150"
],
"predicate": "RO:0002331"
},
{
"subject": "GO:0032991",
"object": [
"GO:0008150"
],
"predicate": "RO:0004034"
},
{
"subject": "GO:0032991",
"object": [
"GO:0008150"
],
"predicate": "RO:0004032"
},
{
"subject": "GO:0032991",
"object": [
"GO:0008150"
],
"predicate": "RO:0004033"
},
{
"subject": "GO:0032991",
"object": [
"GO:0008150"
],
"predicate": "RO:0004034"
},
{
"subject": "GO:0032991",
"object": [
"GO:0008150"
],
"predicate": "RO:0004035"
},
{
"subject": "GO:0032991",
"object": [
"GO:0005575"
],
"predicate": "RO:0002432"
},
{
"subject": "GO:0032991",
"object": [
"GO:0005575"
],
"predicate": "RO:0001025"
},
{
"subject": "GO:0032991",
"object": [
"GO:0032991"
],
"predicate": "BFO:0000050"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class NoctuaFormConfigService {
constructor(private noctuaUserService: NoctuaUserService) {
this.onSetupReady = new BehaviorSubject(null);
this.termLookupTable = DataUtils.genTermLookupTable();
this.shapePredicates = DataUtils.getPredicates(shexJson.goshapes);
this.shapePredicates = DataUtils.getPredicates(shexJson.goshapes, null, null, false);
}

get edges() {
Expand Down Expand Up @@ -445,6 +445,8 @@ export class NoctuaFormConfigService {
const predicates = DataUtils.getPredicates(
gpToTerm ? gpToTermJson.goshapes : shexJson.goshapes, subjectIds, objectIds);


console.log('predicates', predicates)
return predicates.map((predicate) => {
return this.findEdge(predicate);
});
Expand Down
2 changes: 1 addition & 1 deletion workbenches/noctua-standard-annotations/public/inject.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@
</div>
</noctua-splash-screen>
<noctua-root></noctua-root>
<script src="runtime.38b1f495cb4cd82a.js" type="module"></script><script src="polyfills.a39db01cea6f891e.js" type="module"></script><script src="scripts.c2b224063cd8b44d.js" defer></script><script src="main.b6beb68e913c1597.js" type="module"></script>
<script src="runtime.38b1f495cb4cd82a.js" type="module"></script><script src="polyfills.a39db01cea6f891e.js" type="module"></script><script src="scripts.c2b224063cd8b44d.js" defer></script><script src="main.90e4a99ea0d23aff.js" type="module"></script>

</body></html>

Large diffs are not rendered by default.

0 comments on commit 73c6dce

Please sign in to comment.