diff --git a/CHANGELOG.md b/CHANGELOG.md index afddcd195..1b497209b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ [Semantic Versioning](https://semver.org/) +## [6.0.1] - 2023-11-27 +### Improvement +- `MultipleEntryPropertyCollector` includes polymer entity prd ids + ## [6.0.0] - 2023-11-22 ### Breaking changes - Types are not anymore exposed from `build/src` diff --git a/package.json b/package.json index 94165e30f..51b05bea2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rcsb/rcsb-saguaro-app", - "version": "6.0.0", + "version": "6.0.1", "description": "RCSB 1D Saguaro Web App", "main": "build/app.js", "files": [ diff --git a/src/RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector.ts b/src/RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector.ts index 5fea24b97..2283769c3 100644 --- a/src/RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector.ts +++ b/src/RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector.ts @@ -1,11 +1,15 @@ import {rcsbClient, RcsbClient} from "../../RcsbGraphQL/RcsbClient"; -import {CoreEntry, QueryEntriesArgs} from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Yosemite/GqlTypes"; +import { + CoreEntry, + CorePolymerEntity, + QueryEntriesArgs +} from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Yosemite/GqlTypes"; import {StructureDeterminationMethodology} from "@rcsb/rcsb-api-tools/build/RcsbDw/Types/DwEnums"; import {Assertions} from "../../RcsbUtils/Helpers/Assertions"; import assertDefined = Assertions.assertDefined; import assertElementListDefined = Assertions.assertElementListDefined; -export interface EntryPropertyIntreface { +export interface EntryPropertyInterface { rcsbId: string; entryId: string; experimentalMethod: string; @@ -13,22 +17,23 @@ export interface EntryPropertyIntreface { name: string; taxNames: Array; entryMolecularWeight?: number; - description:Array; + description: Array; entityToInstance: Map>; structureDeterminationMethodology: StructureDeterminationMethodology; nonPolymerEntityToInstance: Map>; instanceToOperator: Map>>; + entityToPrd: Map; } export class MultipleEntryPropertyCollector { private readonly rcsbFvQuery: RcsbClient = rcsbClient; - public async collect(requestConfig: QueryEntriesArgs): Promise> { + public async collect(requestConfig: QueryEntriesArgs): Promise> { const result: Array = await this.rcsbFvQuery.requestMultipleEntriesProperties(requestConfig); return result.map(r=>MultipleEntryPropertyCollector.getEntryProperties(r)); } - private static getEntryProperties(r:CoreEntry): EntryPropertyIntreface{ + private static getEntryProperties(r:CoreEntry): EntryPropertyInterface{ return { rcsbId: r.rcsb_id, entryId: r.rcsb_id, @@ -43,7 +48,8 @@ export class MultipleEntryPropertyCollector { structureDeterminationMethodology: r.rcsb_entry_info.structure_determination_methodology as StructureDeterminationMethodology, nonPolymerEntityToInstance: r.nonpolymer_entities?.map(pe=>([pe?.rcsb_id, pe?.nonpolymer_entity_instances?.map(pei=>pei?.rcsb_id)] as [string,string[]])) .reduce((r:Map,x:[string, string[]])=>r.set(x[0],x[1]),new Map()) ?? new Map(), - instanceToOperator: MultipleEntryPropertyCollector.instanceToOperator(r) + instanceToOperator: MultipleEntryPropertyCollector.instanceToOperator(r), + entityToPrd: r.polymer_entities?.filter((pe): pe is CorePolymerEntity => typeof pe != "undefined").map( pe=> [pe?.rcsb_id ?? "", pe?.entity_poly?.rcsb_prd_id ?? ""]).reduce((map, pair)=>map.set(pair[0],pair[1]), new Map()) ?? new Map() }; } diff --git a/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PlainObservedAlignmentTrackFactory.ts b/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PlainObservedAlignmentTrackFactory.ts index a6690d96b..eba503ffa 100644 --- a/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PlainObservedAlignmentTrackFactory.ts +++ b/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PlainObservedAlignmentTrackFactory.ts @@ -18,7 +18,7 @@ import {range} from "lodash"; import {PlainAlignmentTrackFactory} from "./PlainAlignmentTrackFactory"; import {TrackUtils} from "./Helper/TrackUtils"; import {rcsbRequestCtxManager} from "../../../../RcsbRequest/RcsbRequestContextManager"; -import {EntryPropertyIntreface} from "../../../../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; +import {EntryPropertyInterface} from "../../../../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; import {Assertions} from "../../../../RcsbUtils/Helpers/Assertions"; import assertDefined = Assertions.assertDefined; import {TagDelimiter} from "@rcsb/rcsb-api-tools/build/RcsbUtils/TagDelimiter"; @@ -50,7 +50,7 @@ export class PlainObservedAlignmentTrackFactory implements TrackFactoryInterface return uor.target_id.split(TagDelimiter.instance)[0] })); //TODO define a Translator class for multiple entry entry data - const entryProperties: EntryPropertyIntreface[] = (await Promise.all(Operator.arrayChunk(entryIds, 100).map(ids => rcsbRequestCtxManager.getEntryProperties(ids)))).flat(); + const entryProperties: EntryPropertyInterface[] = (await Promise.all(Operator.arrayChunk(entryIds, 100).map(ids => rcsbRequestCtxManager.getEntryProperties(ids)))).flat(); entryProperties.forEach(ep=>{ ep.entityToInstance.forEach((instanceList,entityId)=>{ this.entityInstanceNumberMap.set(entityId, instanceList.length); diff --git a/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PositionalScoreAlignmentTrackFactory.ts b/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PositionalScoreAlignmentTrackFactory.ts index 41855cc8f..7e99bced8 100644 --- a/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PositionalScoreAlignmentTrackFactory.ts +++ b/src/RcsbFvWeb/RcsbFvFactories/RcsbFvTrackFactory/TrackFactoryImpl/PositionalScoreAlignmentTrackFactory.ts @@ -20,7 +20,7 @@ import {range} from "lodash"; import {PlainAlignmentTrackFactory} from "./PlainAlignmentTrackFactory"; import {TrackUtils} from "./Helper/TrackUtils"; import {rcsbRequestCtxManager} from "../../../../RcsbRequest/RcsbRequestContextManager"; -import {EntryPropertyIntreface} from "../../../../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; +import {EntryPropertyInterface} from "../../../../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; import {Assertions} from "../../../../RcsbUtils/Helpers/Assertions"; import assertDefined = Assertions.assertDefined; import {TagDelimiter} from "@rcsb/rcsb-api-tools/build/RcsbUtils/TagDelimiter"; @@ -65,7 +65,7 @@ export class PositionalScoreAlignmentTrackFactory implements TrackFactoryInterfa return uor.target_id.split(TagDelimiter.instance)[0]; })); //TODO define a Translator class for multiple entry entry data - const entryProperties: EntryPropertyIntreface[] = (await Promise.all(Operator.arrayChunk(entryIds, 100).map(ids => rcsbRequestCtxManager.getEntryProperties(ids)))).flat(); + const entryProperties: EntryPropertyInterface[] = (await Promise.all(Operator.arrayChunk(entryIds, 100).map(ids => rcsbRequestCtxManager.getEntryProperties(ids)))).flat(); entryProperties.forEach(ep=>{ ep.entityToInstance.forEach((instanceList,entityId)=>{ instanceList.forEach(instanceId=>{ diff --git a/src/RcsbGroupWeb/RcsbGroupView/RcsbGroupMembers/GroupMembersGrid.tsx b/src/RcsbGroupWeb/RcsbGroupView/RcsbGroupMembers/GroupMembersGrid.tsx index d25d5a7de..4cdbdf3b7 100644 --- a/src/RcsbGroupWeb/RcsbGroupView/RcsbGroupMembers/GroupMembersGrid.tsx +++ b/src/RcsbGroupWeb/RcsbGroupView/RcsbGroupMembers/GroupMembersGrid.tsx @@ -9,7 +9,7 @@ import {SearchQueryTools as SQT} from "../../../RcsbSeacrh/SearchQueryTools"; import {RcsbSearchMetadata} from "@rcsb/rcsb-api-tools/build/RcsbSearch/Types/SearchMetadata"; import {ReturnType, SortDirection} from "@rcsb/rcsb-api-tools/build/RcsbSearch/Types/SearchEnums"; import { - EntryPropertyIntreface + EntryPropertyInterface } from "../../../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; import {GroupProvenanceId} from "@rcsb/rcsb-api-tools/build/RcsbDw/Types/DwEnums"; import {rcsbRequestCtxManager} from "../../../RcsbRequest/RcsbRequestContextManager"; @@ -135,9 +135,9 @@ async function searchRequest(groupProvenanceId: GroupProvenanceId, groupId: stri }); } -function parseItems(groupProvenanceId: GroupProvenanceId, propsList:Array|Array): Array{ +function parseItems(groupProvenanceId: GroupProvenanceId, propsList:Array|Array): Array{ return groupProvenanceId === GroupProvenanceId.ProvenanceMatchingDepositGroupId ? - (propsList as Array).map((o)=>({...o, molecularWeight:o.entryMolecularWeight})) + (propsList as Array).map((o)=>({...o, molecularWeight:o.entryMolecularWeight})) : (propsList as Array).map((o)=>(o.instances)).flat().map((o)=>({...o, molecularWeight: o.entityMolecularWeight})); } \ No newline at end of file diff --git a/src/RcsbQueries/Yosemite/QueryMultipleEntriesProperties.graphql b/src/RcsbQueries/Yosemite/QueryMultipleEntriesProperties.graphql index fc32e2591..f2533d2b6 100644 --- a/src/RcsbQueries/Yosemite/QueryMultipleEntriesProperties.graphql +++ b/src/RcsbQueries/Yosemite/QueryMultipleEntriesProperties.graphql @@ -16,6 +16,9 @@ query multiple_entries_properties($entry_ids: [String!]!){ } rcsb_id } + entity_poly { + rcsb_prd_id + } } nonpolymer_entities { rcsb_id diff --git a/src/RcsbRequest/RcsbRequestContextManager.ts b/src/RcsbRequest/RcsbRequestContextManager.ts index 21cccec1f..69549fead 100644 --- a/src/RcsbRequest/RcsbRequestContextManager.ts +++ b/src/RcsbRequest/RcsbRequestContextManager.ts @@ -16,7 +16,7 @@ import { } from "@rcsb/rcsb-api-tools/build/RcsbGraphQL/Types/Yosemite/GqlTypes"; import {GroupMemberCollector} from "../RcsbCollectTools/DataCollectors/GroupMemberCollector"; import { - EntryPropertyIntreface, + EntryPropertyInterface, MultipleEntryPropertyCollector } from "../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; import {Operator} from "../RcsbUtils/Helpers/Operator"; @@ -61,7 +61,7 @@ class RcsbRequestContextManager { private readonly searchRequestMap: Map> = new Map>(); private readonly interfaceToInstanceMap: Map> = new Map>(); private readonly assemblyInterfacesMap: Map> = new Map>(); - private readonly entryPropertyMap: Map> = new Map>(); + private readonly entryPropertyMap: Map> = new Map>(); private readonly entityPropertyMap: Map> = new Map>(); private readonly instanceSequenceMap: Map> = new Map>(); @@ -87,8 +87,8 @@ class RcsbRequestContextManager { ) } - public async getEntryProperties(entryIds:string|Array): Promise> { - return RRT.getMultipleObjectProperties<"entry_ids",EntryPropertyIntreface>( + public async getEntryProperties(entryIds:string|Array): Promise> { + return RRT.getMultipleObjectProperties<"entry_ids",EntryPropertyInterface>( entryIds, this.entryPropertyMap, this.multipleEntryPropertyCollector, @@ -142,7 +142,7 @@ class RcsbRequestContextManager { this.groupPropertyMap, async ()=>{ const result:Array = await this.groupMemberCollector.collect(groupQuery); - const entriesProperties: Array = await this.multipleEntryPropertyCollector.collect({entry_ids:Operator.uniqueValues(result.map(r=>r.entryId))}) + const entriesProperties: Array = await this.multipleEntryPropertyCollector.collect({entry_ids:Operator.uniqueValues(result.map(r=>r.entryId))}) return new GroupPropertiesProvider({entryProperties: entriesProperties}); } ); diff --git a/src/RcsbUtils/Groups/GroupPropertiesProvider.ts b/src/RcsbUtils/Groups/GroupPropertiesProvider.ts index 3c2ccd224..91f75352d 100644 --- a/src/RcsbUtils/Groups/GroupPropertiesProvider.ts +++ b/src/RcsbUtils/Groups/GroupPropertiesProvider.ts @@ -1,7 +1,7 @@ -import {EntryPropertyIntreface} from "../../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; +import {EntryPropertyInterface} from "../../RcsbCollectTools/DataCollectors/MultipleEntryPropertyCollector"; export interface GroupPropertiesProviderInterface{ - entryProperties: Array; + entryProperties: Array; } interface ItemPropertyInterface { @@ -13,7 +13,7 @@ export type GroupPropertyType = "experimental_method" | "resolution"; export class GroupPropertiesProvider { - private readonly entryProperties: Array; + private readonly entryProperties: Array; constructor(properties: GroupPropertiesProviderInterface) { this.entryProperties = properties.entryProperties;