private ProtoNetwork stage4 ( final ProtoNetwork pn ) { beginStage ( PHASE3_STAGE4_HDR , "4" , NUM_PHASES ) ; if ( ! getPhaseConfiguration ( ) . getInjectOrthology ( ) ) { final StringBuilder bldr = new StringBuilder ( ) ; bldr . append ( ORTHO_INJECTION_DISABLED ) ; markEndStage ( bldr ) ; stageOutput ( bldr . toString ( ) ) ; return pn ; } // create output directory for orthologized proto network artifactPath = createDirectoryArtifact ( outputDirectory , DIR_ARTIFACT ) ; final Index index = ResourceIndex . INSTANCE . getIndex ( ) ; final Set < ResourceLocation > resources = index . getOrthologyResources ( ) ; if ( noItems ( resources ) ) { final StringBuilder bldr = new StringBuilder ( ) ; bldr . append ( "No orthology documents included." ) ; markEndStage ( bldr ) ; stageOutput ( bldr . toString ( ) ) ; return pn ; } // equivalence network first, before pruning Set < EquivalenceDataIndex > equivs ; try { equivs = p2 . stage2LoadNamespaceEquivalences ( ) ; } catch ( EquivalenceMapResolutionFailure e ) { stageError ( e . getUserFacingMessage ( ) ) ; equivs = emptySet ( ) ; } try { p2 . stage3EquivalenceParameters ( pn , equivs ) ; } catch ( IOException e ) { } final Iterator < ResourceLocation > it = resources . iterator ( ) ; final ResourceLocation first = it . next ( ) ; final ProtoNetwork orthoMerge = pruneResource ( pn , first ) ; while ( it . hasNext ( ) ) { final ResourceLocation resource = it . next ( ) ; final ProtoNetwork opn = pruneResource ( pn , resource ) ; try { p3 . merge ( orthoMerge , opn ) ; } catch ( ProtoNetworkError e ) { e . printStackTrace ( ) ; } } try { runPhaseThree ( orthoMerge ) ; } catch ( ProtoNetworkError e ) { stageError ( e . getUserFacingMessage ( ) ) ; bail ( ExitCode . GENERAL_FAILURE ) ; } try { p3 . merge ( pn , orthoMerge ) ; } catch ( ProtoNetworkError e ) { stageError ( e . getUserFacingMessage ( ) ) ; bail ( ExitCode . GENERAL_FAILURE ) ; } return pn ; }
Runs stage four injecting of homology knowledge .