Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rcsb provider fixes #1043

Merged
merged 2 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/datasource/pdbe-datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class PDBeDatasource extends Datasource {

getExt (src: string) {
const ext = getFileInfo(src).ext
return ext ? ext : 'mmtf'
return ext ? ext : 'bcif'
}
}

Expand Down
34 changes: 14 additions & 20 deletions src/datasource/rcsb-datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
*/

import { Log, DatasourceRegistry } from '../globals'
import { getProtocol } from '../utils'
import { getFileInfo } from '../loader/loader-utils'
import Datasource from './datasource'

const baseUrl = '//files.rcsb.org/download/'
const mmtfBaseUrl = '//mmtf.rcsb.org/v1.0/'
const mmtfFullUrl = mmtfBaseUrl + 'full/'
const mmtfReducedUrl = mmtfBaseUrl + 'reduced/'
const bcifBaseUrl = '//models.rcsb.org/'
const protocol = 'https:'

class RcsbDatasource extends Datasource {
getUrl (src: string) {
Expand All @@ -22,35 +19,32 @@ class RcsbDatasource extends Datasource {
// XXXX defaults to XXXX.cif
const info = getFileInfo(src)
const pdbid = info.name.indexOf('_') > -1 ? info.name : info.name.substring(0, 4) // Allow extended pdb codes and alphafold codes
let url
if ([ 'pdb', 'cif' ].includes(info.ext) &&
(info.compressed === false || info.compressed === 'gz')
) {
url = baseUrl + info.path
} else if (info.ext === 'mmtf') {
Log.warn('MMTF files distribution is discontinued by RCSB PDB as of July 2, 2024.\n Consider using bcif format instead. See https://www.rcsb.org/news/65a1af31c76ca3abcc925d0c for the deprecation notice')
return protocol + baseUrl + info.path
}

if (info.ext === 'mmtf') {
Log.warn('MMTF files distribution has been discontinued by RCSB PDB as of July 2024.\n Defaulting to bcif format instead. See https://www.rcsb.org/news/65a1af31c76ca3abcc925d0c for the deprecation notice')
if (info.base.endsWith('.bb')) {
url = mmtfReducedUrl + pdbid
} else {
url = mmtfFullUrl + pdbid
Log.warn('Backbone only files are not available from RCSB PDB anymore.')
}
} else if (info.ext === 'bcif' &&
(info.compressed === false || info.compressed === 'gz')
) {
url = bcifBaseUrl + info.path
} else if (!info.ext) {
info.ext = ''
}

if (!info.ext) {
Log.warn('mmCif files available from RCSB PDB lack connectivity information.\n Consider using PDBe as the data provider for using "Updated mmCif files" that contain residues connectivity records.')
url = bcifBaseUrl + pdbid + '.bcif.gz'
} else {
Log.warn('unsupported ext', info.ext)
url = bcifBaseUrl + pdbid + '.bcif.gz'
}
return getProtocol() + url

return protocol + bcifBaseUrl + pdbid + '.bcif.gz'
}

getExt (src: string) {
const ext = getFileInfo(src).ext
return ext ? ext : 'mmtf'
return ext ? ext : 'bcif'
}
}

Expand Down
Loading