Skip to content

Commit f36f82c

Browse files
committed
SCOP hack to force loading of MMTF
1 parent 28815db commit f36f82c

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

  • biojava-structure/src/main/java/org/biojava/nbio/structure/align/util

biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AtomCache.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ public Structure getStructureForDomain(ScopDomain domain, ScopDatabase scopDatab
524524
public Structure getStructureForDomain(ScopDomain domain, ScopDatabase scopDatabase, boolean strictLigandHandling)
525525
throws IOException, StructureException {
526526
String pdbId = domain.getPdbId();
527-
Structure fullStructure = getStructureForPdbId(pdbId);
527+
// SMB 1/26/21 - forcing loading MMTF here - TODO why doesn't mmCIF/CIF/BCIF parsing work here?
528+
Structure fullStructure = getStructureForPdbIdByMmtf(pdbId);
528529
Structure structure = domain.reduce(fullStructure);
529530

530531
// TODO It would be better to move all of this into the reduce method,
@@ -800,6 +801,33 @@ public Structure getStructureForPdbId(String pdbId) throws IOException, Structur
800801
}
801802
}
802803

804+
/**
805+
* SCOP parsing depends on MMTF, this a dedicated method to allow for that.
806+
* @param pdbId what to load
807+
* @return a Structure object
808+
* @throws IOException
809+
* @throws StructureException
810+
*/
811+
private Structure getStructureForPdbIdByMmtf(String pdbId) throws IOException, StructureException {
812+
if (pdbId == null)
813+
return null;
814+
if (pdbId.length() != 4) {
815+
throw new StructureException("Unrecognized PDB ID: " + pdbId);
816+
}
817+
while (checkLoading(pdbId)) {
818+
// waiting for loading to be finished...
819+
820+
try {
821+
Thread.sleep(100);
822+
} catch (InterruptedException e) {
823+
logger.error(e.getMessage());
824+
}
825+
}
826+
827+
logger.debug("loading from mmtf");
828+
return loadStructureFromMmtfByPdbId(pdbId);
829+
}
830+
803831
/**
804832
* Load a {@link Structure} from MMTF either from the local file system.
805833
* @param pdbId the input PDB id

0 commit comments

Comments
 (0)