public static List < Monomer > getAllMonomers ( MonomerNotation not , int position ) throws HELM2HandledException , MonomerException , NotationException , ChemistryException , CTKException , MonomerLoadingException { List < Monomer > monomers = new ArrayList < Monomer > ( ) ; MonomerFactory monomerFactory = MonomerFactory . getInstance ( ) ; MonomerStore monomerStore = monomerFactory . getMonomerStore ( ) ; if ( not instanceof MonomerNotationUnitRNA ) { monomers . addAll ( getMonomersRNA ( ( MonomerNotationUnitRNA ) not , monomerStore , position ) ) ; } else if ( not instanceof MonomerNotationUnit ) { String id = not . getUnit ( ) ; // if (id.startsWith("[") && id.endsWith("]")) { // id = id.substring(1, id.length() - 1); // } monomers . add ( MethodsMonomerUtils . getMonomer ( not . getType ( ) , id , "" ) ) ; } else if ( not instanceof MonomerNotationGroup ) { for ( MonomerNotationGroupElement groupElement : ( ( MonomerNotationGroup ) not ) . getListOfElements ( ) ) { String id = groupElement . getMonomerNotation ( ) . getUnit ( ) ; /* * if (id.startsWith("[") && id.endsWith("]")) { id = * id.substring(1, id.length() - 1); } */ monomers . add ( MethodsMonomerUtils . getMonomer ( not . getType ( ) , id , "" ) ) ; } } else if ( not instanceof MonomerNotationList ) { for ( MonomerNotation listElement : ( ( MonomerNotationList ) not ) . getListofMonomerUnits ( ) ) { if ( listElement instanceof MonomerNotationUnitRNA ) { monomers . addAll ( getMonomersRNA ( ( ( MonomerNotationUnitRNA ) listElement ) , monomerStore , position ) ) ; } else { String id = listElement . getUnit ( ) ; /* * if (id.startsWith("[") && id.endsWith("]")) { id = * id.substring(1, id.length() - 1); } */ monomers . add ( MethodsMonomerUtils . getMonomer ( not . getType ( ) , id , "" ) ) ; } } } return monomers ; }
method to get for one MonomerNotation all valid contained monomers