GMOD / Apollo3

JBrowse 2 plugin for editing annotations on an Apollo server
Apache License 2.0
6 stars 4 forks source link

Add ability to get parent ID in feature from features endpoint #357

Open garrettjstevens opened 4 months ago

garrettjstevens commented 4 months ago

From Havana, when they process the changes, they need the parent ID of a changed feature. This could possibly be added in packages/apollo-common/src/FeatureChange.ts.

@shashankbrgowda, could you expand a bit more on the use case for this?

shashankbrgowda commented 4 months ago

We need to add parent id attribute when we process the change (Coordinate change / Attribute change etc.) or retain the "Parent" field in the attributes which is present in gff, so that when we get feature its already available.

1   ensembl_havana  exon    177280412   177282422   .   +   .   Parent=transcript:ENST00000361539;Name=ENSE00001166070;constitutive=0;ensembl_end_phase=-1;ensembl_phase=2;exon_id=ENSE00001166070;rank=8;version=9
garrettjstevens commented 4 months ago

We're going to go the route of obtaining the parent ID from the endpoint call instead.

In packages/apollo-collaboration-server/src/features/features.controller.ts @Get(':featureid') endpoint, add the ability to have a URL parameter that requests that the parent ID be returned as well (e.g. /features/624ab4c0f8ac0187ed22b563?parentId=true).

In packages/apollo-collaboration-server/src/features/features.service.ts, first the parent feature is queried from the database and then if the requested feature is a child feature, it returns that sub-document of the parent feature. We will add an option if parentId is true and the requests feature is a child feature, then the parent ID is added to childFeature.attributes before returning it.