-
Notifications
You must be signed in to change notification settings - Fork 170
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 #1040 from papillot/1015-Binary-Cif-support
1015 binary cif support
- Loading branch information
Showing
21 changed files
with
6,795 additions
and
15,945 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,58 @@ | ||
/** | ||
* @file PDB Europe Datasource | ||
* @author Paul Pillot <[email protected]> | ||
* @private | ||
*/ | ||
|
||
import { Log, DatasourceRegistry } from '../globals' | ||
import { getFileInfo } from '../loader/loader-utils' | ||
import Datasource from './datasource' | ||
|
||
const baseUrl = '//www.ebi.ac.uk/pdbe/entry-files/download/' | ||
|
||
// Examples: | ||
//https://www.ebi.ac.uk/pdbe/entry-files/download/5z6y_updated.cif | ||
//https://www.ebi.ac.uk/pdbe/entry-files/download/pdb5z6y.ent | ||
//https://www.ebi.ac.uk/pdbe/entry-files/download/5z6y.bcif | ||
|
||
class PDBeDatasource extends Datasource { | ||
getUrl (src: string) { | ||
// valid path are | ||
// XXXX.pdb, XXXX.ent, XXXX.cif, XXXX.bcif | ||
// XXXX defaults to XXXX.bcif | ||
const info = getFileInfo(src) | ||
let pdbid = info.name.indexOf('_') > -1 ? info.name : info.name.substring(0, 4) // Allow extended pdb codes | ||
let url | ||
switch (info.ext) { | ||
case 'cif': | ||
url = baseUrl + pdbid + '_updated.cif' // "Updated mmcif" files contain connectivity | ||
break | ||
case 'pdb': | ||
case 'ent': | ||
if (!pdbid.startsWith('pdb')) { | ||
pdbid = 'pdb' + pdbid | ||
} | ||
url = baseUrl + pdbid + '.ent' | ||
break | ||
case 'bcif': | ||
url = baseUrl + info.path | ||
break | ||
case '': | ||
url = baseUrl + pdbid + '.bcif' | ||
break | ||
default: | ||
Log.warn('unsupported ext', info.ext) | ||
url = baseUrl + pdbid + '.bcif' | ||
} | ||
return 'https://' + url | ||
} | ||
|
||
getExt (src: string) { | ||
const ext = getFileInfo(src).ext | ||
return ext ? ext : 'mmtf' | ||
} | ||
} | ||
|
||
DatasourceRegistry.add('pdbe', new PDBeDatasource()) | ||
|
||
export default PDBeDatasource |
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
Oops, something went wrong.