001package org.biopax.paxtools.examples; 002 003import org.biopax.paxtools.model.Model; 004import org.biopax.paxtools.model.level3.*; 005import org.biopax.paxtools.model.level3.Process; 006 007 008/** 009 * This example shows how to list all components of a pathway. 010 * 011 * 012 */ 013public class PathwayComponentLister 014{ 015 public static void printPathwayComponents(Model model) 016 { 017 String prefix = ""; 018 for (Pathway pathway : model.getObjects(Pathway.class)) 019 { 020 printPathway(pathway, prefix); 021 } 022 } 023 024 private static void printPathway(Pathway pathway, String prefix) 025 { 026 System.out.println(prefix+"Pathway:"+pathway); 027 prefix=prefix+"\t"; 028 for (Process process : pathway.getPathwayComponent()) 029 { 030 if(process instanceof Pathway) 031 { 032 printPathway((Pathway) process,prefix); 033 } 034 else System.out.println(prefix + process); 035 } 036 } 037}