protvista-uniprot 4.5.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "protvista-uniprot",
3
3
  "description": "ProtVista tool for the UniProt website",
4
- "version": "4.5.0",
4
+ "version": "4.5.1",
5
5
  "files": [
6
6
  "dist",
7
7
  "src"
@@ -6,12 +6,8 @@ type AlphafoldConfidencePayload = {
6
6
  confidenceCategory: Array<string>;
7
7
  };
8
8
 
9
- const getConfidenceURLFromPayload = (data: AlphaFoldPayload) => {
10
- const cifURL = data?.[0]?.cifUrl;
11
- return cifURL?.length
12
- ? cifURL.replace('-model', '-confidence').replace('.cif', '.json')
13
- : null;
14
- };
9
+ const getConfidenceURLFromPayload = (af: AlphaFoldPayload[number]) =>
10
+ af.cifUrl?.replace('-model', '-confidence').replace('.cif', '.json');
15
11
 
16
12
  const loadConfidence = async (
17
13
  url: string
@@ -34,16 +30,22 @@ const transformData = async (
34
30
  data: AlphaFoldPayload,
35
31
  protein: PartialProtein
36
32
  ) => {
37
- const confidenceUrl = getConfidenceURLFromPayload(data);
38
- if (!confidenceUrl) {
39
- return;
40
- }
41
33
  const alphaFoldSequenceMatch = data?.filter(
42
34
  ({ sequence }) => protein.sequence.sequence === sequence
43
35
  );
44
- if (alphaFoldSequenceMatch.length) {
36
+ if (alphaFoldSequenceMatch.length === 1) {
37
+ const confidenceUrl = getConfidenceURLFromPayload(
38
+ alphaFoldSequenceMatch[0]
39
+ );
40
+ if (!confidenceUrl) {
41
+ return;
42
+ }
45
43
  const confidenceData = await loadConfidence(confidenceUrl);
46
44
  return confidenceData?.confidenceCategory.join('');
45
+ } else if (alphaFoldSequenceMatch.length > 1) {
46
+ console.warn(
47
+ `Found more than one matches (${alphaFoldSequenceMatch.length}) for AlphaFold confidence adapter against protein sequence: ${protein.sequence}`
48
+ );
47
49
  }
48
50
  };
49
51