public Model filter ( Model model ) { if ( model == null || model . getLevel ( ) != BioPAXLevel . L2 ) return model ; // nothing to do preparePep2PEIDMap ( model ) ; final Model newModel = factory . createModel ( ) ; newModel . getNameSpacePrefixMap ( ) . putAll ( model . getNameSpacePrefixMap ( ) ) ; newModel . setXmlBase ( model . getXmlBase ( ) ) ; // facilitate the conversion normalize ( model ) ; // First, map classes (and only set ID) if possible (pre-processing) for ( BioPAXElement bpe : model . getObjects ( ) ) { Level3Element l3element = mapClass ( bpe ) ; if ( l3element != null ) { newModel . add ( l3element ) ; } else { log . debug ( "Skipping " + bpe + " " + bpe . getModelInterface ( ) . getSimpleName ( ) ) ; } } /* process each L2 element (mapping properties), * except for pEPs and oCVs that must be processed as values * (anyway, we do not want dangling elements) */ for ( BioPAXElement e : model . getObjects ( ) ) { if ( e instanceof physicalEntityParticipant || e instanceof openControlledVocabulary ) { continue ; } // map properties traverse ( ( Level2Element ) e , newModel ) ; } log . info ( "Done: new L3 model contains " + newModel . getObjects ( ) . size ( ) + " BioPAX individuals." ) ; // fix new model (e.g., add PathwayStep's processes to the pathway components ;)) normalize ( newModel ) ; return newModel ; }
Converts a BioPAX Model Level 1 or 2 to the Level 3 .