private void indexDomains ( ) throws IOException { domainsFileLock . writeLock ( ) . lock ( ) ; logger . trace ( "LOCK writelock" ) ; try { if ( allDomains == null ) { ensureDomainsFileInstalled ( ) ; } // Leave enough space for all PDBs as of 2015 domainMap = new HashMap < String , List < EcodDomain > > ( ( int ) ( 150000 / .85 ) , .85f ) ; // Index with domainMap for ( EcodDomain d : allDomains ) { // Get the PDB ID, either directly or from the domain ID String pdbId = d . getPdbId ( ) ; if ( pdbId == null ) { String ecodId = d . getDomainId ( ) ; if ( ecodId != null && ! ecodId . isEmpty ( ) ) { Matcher match = ECOD_RE . matcher ( ecodId ) ; pdbId = match . group ( 1 ) ; } } // Add current domain to the map List < EcodDomain > currDomains ; if ( domainMap . containsKey ( pdbId ) ) { currDomains = domainMap . get ( pdbId ) ; } else { currDomains = new LinkedList < EcodDomain > ( ) ; domainMap . put ( pdbId , currDomains ) ; } currDomains . add ( d ) ; } } finally { logger . trace ( "UNLOCK writelock" ) ; domainsFileLock . writeLock ( ) . unlock ( ) ; } }
Populates domainMap from allDomains