Skip to content

Commit

Permalink
Merge pull request #15 from geneontology/issue-13-pcc
Browse files Browse the repository at this point in the history
Issue 13 pcc
  • Loading branch information
tmushayahama authored May 3, 2024
2 parents 826b786 + 73c6dce commit f2a33eb
Show file tree
Hide file tree
Showing 20 changed files with 1,281 additions and 59 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"
}
]
}
Loading

0 comments on commit f2a33eb

Please sign in to comment.