public static String getXHELM ( HELM2Notation helm2notation ) throws MonomerException , HELM1FormatException , IOException , JDOMException , NotationException , CTKException , ValidationException , ChemistryException { set = new HashSet < Monomer > ( ) ; Element root = new Element ( xHelmNotationExporter . XHELM_ELEMENT ) ; Document doc = new Document ( root ) ; Element helmElement = new Element ( xHelmNotationExporter . HELM_NOTATION_ELEMENT ) ; helmElement . setText ( HELM1Utils . getStandard ( helm2notation ) ) ; root . addContent ( helmElement ) ; Element monomerListElement = new Element ( xHelmNotationExporter . MONOMER_LIST_ELEMENT ) ; /* save all adhocMonomers in the set */ for ( MonomerNotation monomernotation : MethodsMonomerUtils . getListOfMonomerNotation ( helm2notation . getListOfPolymers ( ) ) ) { /* get all elements of an rna */ if ( monomernotation instanceof MonomerNotationUnitRNA ) { for ( MonomerNotationUnit unit : ( ( MonomerNotationUnitRNA ) monomernotation ) . getContents ( ) ) { addAdHocMonomer ( unit ) ; } } else { addAdHocMonomer ( monomernotation ) ; } } /* give adhoc monomer's information */ for ( Monomer distinctmonomer : set ) { Element monomerElement = MonomerParser . getMonomerElement ( distinctmonomer ) ; monomerListElement . getChildren ( ) . add ( monomerElement ) ; } root . addContent ( monomerListElement ) ; XMLOutputter xmlOutput = new XMLOutputter ( ) ; // display nice xmlOutput . setFormat ( Format . getPrettyFormat ( ) ) ; return xmlOutput . outputString ( doc ) ; }
method to get xhelm for the helm notation only if it was possible to convert the helm in the old format