public static List < String > getReplaces ( String newPdbId , boolean recurse ) { List < Map < String , String > > attrList = getStatusIdRecords ( new String [ ] { newPdbId } ) ; //Expect a single record if ( attrList == null || attrList . size ( ) != 1 ) { //TODO Is it possible to have multiple record per ID? // They seem to be combined into one record with space-delimited 'replaces' logger . error ( "Error getting Status for {} from the PDB website." , newPdbId ) ; return null ; } Map < String , String > attrs = attrList . get ( 0 ) ; //Check that the record matches pdbId String id = attrs . get ( "structureId" ) ; if ( id == null || ! id . equals ( newPdbId ) ) { logger . error ( "Results returned from the query don't match {}" , newPdbId ) ; return null ; } String replacedList = attrs . get ( "replaces" ) ; //space-delimited list if ( replacedList == null ) { // no replaces value; assume root return new ArrayList < String > ( ) ; } String [ ] directDescendents = replacedList . split ( "\\s" ) ; // Not the root! Return the replaced PDB. if ( recurse ) { // Note: Assumes a proper directed acyclic graph of revisions // Cycles will cause infinite loops. List < String > allDescendents = new LinkedList < String > ( ) ; for ( String replaced : directDescendents ) { List < String > roots = PDBStatus . getReplaces ( replaced , recurse ) ; mergeReversed ( allDescendents , roots ) ; } mergeReversed ( allDescendents , Arrays . asList ( directDescendents ) ) ; return allDescendents ; } else { return Arrays . asList ( directDescendents ) ; } }
Get the ID of the protein which was made obsolete by newPdbId .