-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from UCLOrengoGroup/48-get-protein-length-from…
…-alphafold-api 48 get protein length from alphafold api
- Loading branch information
Showing
5 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
frontend/src/components/AlphaFoldService/service.test.A0A6P4PER7.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"uniprot_entry": { | ||
"ac": "A0A6P4PER7", | ||
"id": "A0A6P4PER7_GOSAR", | ||
"uniprot_checksum": "E5BF4AF471D8B238", | ||
"sequence_length": 960, | ||
"segment_start": 1, | ||
"segment_end": 960 | ||
}, | ||
"structures": [ | ||
{ | ||
"summary": { | ||
"model_identifier": "AF-A0A6P4PER7-F1", | ||
"model_category": "AB-INITIO", | ||
"model_url": "https://alphafold.ebi.ac.uk/files/AF-A0A6P4PER7-F1-model_v4.cif", | ||
"model_format": "MMCIF", | ||
"model_type": null, | ||
"model_page_url": "https://alphafold.ebi.ac.uk/entry/A0A6P4PER7", | ||
"provider": "AlphaFold DB", | ||
"number_of_conformers": null, | ||
"ensemble_sample_url": null, | ||
"ensemble_sample_format": null, | ||
"created": "2022-06-01", | ||
"sequence_identity": 1, | ||
"uniprot_start": 1, | ||
"uniprot_end": 960, | ||
"coverage": 1, | ||
"experimental_method": null, | ||
"resolution": null, | ||
"confidence_type": "pLDDT", | ||
"confidence_version": null, | ||
"confidence_avg_local_score": 79.38, | ||
"oligomeric_state": null, | ||
"preferred_assembly_id": null, | ||
"entities": [ | ||
{ | ||
"entity_type": "POLYMER", | ||
"entity_poly_type": "POLYPEPTIDE(L)", | ||
"identifier": "A0A6P4PER7", | ||
"identifier_category": "UNIPROT", | ||
"description": "probable disease resistance protein At1g58602", | ||
"chain_ids": [ | ||
"A" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { expect, test } from 'vitest' | ||
|
||
import { convertWebToModel } from './service' | ||
|
||
import data_A0A6P4PER7 from './service.test.A0A6P4PER7.json' | ||
|
||
test('gets correct UniProt data from A0A6P4PER7', () => { | ||
expect(data_A0A6P4PER7.uniprot_entry.ac).toBe('A0A6P4PER7') | ||
|
||
const up_data = convertWebToModel(data_A0A6P4PER7) | ||
expect(up_data.ac).toBe('A0A6P4PER7') | ||
expect(up_data.id).toBe('A0A6P4PER7_GOSAR') | ||
expect(up_data.uniprot_checksum).toBe('E5BF4AF471D8B238') | ||
expect(up_data.sequence_length).toBe(960) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import axios from "axios"; | ||
|
||
import { UniprotEntry } from "../../client/models/UniprotEntry" | ||
|
||
const http = axios.create({ | ||
baseURL: "https://alphafold.ebi.ac.uk/api/uniprot/summary/", | ||
headers: { | ||
"Content-type": "application/json" | ||
} | ||
}); | ||
|
||
export const convertWebToModel = (data: any): UniprotEntry => { | ||
return data.uniprot_entry; | ||
} | ||
|
||
const get = (id: any): Promise<UniprotEntry> => { | ||
return http.get(`/${id}.json`) | ||
.then((response) => { | ||
// console.log("AlphaFold.API.response.data: ", response.data) | ||
return convertWebToModel(response.data); | ||
}); | ||
}; | ||
|
||
const AlphaFoldUniprotEntryDataService = { | ||
get, | ||
}; | ||
|
||
export default AlphaFoldUniprotEntryDataService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters