private static List < ConnectionNotation > hybridization ( PolymerNotation one , PolymerNotation two , String rnaDesignType ) throws NotationException , HELM2HandledException , RNAUtilsException , org . helm . notation2 . exception . NotationException , ChemistryException , NucleotideLoadingException { List < ConnectionNotation > connections = new ArrayList < ConnectionNotation > ( ) ; ConnectionNotation connection ; if ( one . getPolymerElements ( ) . getListOfElements ( ) != null && one . getPolymerElements ( ) . getListOfElements ( ) . size ( ) > 0 && two . getPolymerElements ( ) . getListOfElements ( ) != null && two . getPolymerElements ( ) . getListOfElements ( ) . size ( ) > 0 ) { String analogSeqSS = RNAUtils . getNaturalAnalogSequence ( one ) . replaceAll ( "T" , "U" ) ; String analogSeqAS = new StringBuilder ( RNAUtils . getNaturalAnalogSequence ( two ) . replaceAll ( "T" , "U" ) ) . toString ( ) ; if ( NucleotideParser . RNA_DESIGN_NONE . equalsIgnoreCase ( rnaDesignType ) ) { String normalCompAS = RNAUtils . getNaturalAnalogSequence ( RNAUtils . getComplement ( two ) ) . replace ( "T" , "U" ) ; String maxMatch = RNAUtils . getMaxMatchFragment ( analogSeqSS , new StringBuilder ( normalCompAS ) . reverse ( ) . toString ( ) ) ; if ( maxMatch . length ( ) > 0 ) { int ssStart = analogSeqSS . indexOf ( maxMatch ) ; int normalCompStart = new StringBuilder ( normalCompAS ) . reverse ( ) . toString ( ) . indexOf ( maxMatch ) ; int asStart = analogSeqAS . length ( ) - maxMatch . length ( ) - normalCompStart ; for ( int i = 0 ; i < maxMatch . length ( ) ; i ++ ) { int ssPos = ( i + ssStart ) * 3 + 2 ; int asPos = ( asStart + maxMatch . length ( ) - 1 - i ) * 3 + 2 ; String details = ssPos + ":pair-" + asPos + ":pair" ; connection = new ConnectionNotation ( one . getPolymerID ( ) , two . getPolymerID ( ) , details ) ; connections . add ( connection ) ; } } } else if ( NucleotideParser . RNA_DESIGN_TUSCHL_19_PLUS_2 . equalsIgnoreCase ( rnaDesignType ) ) { int matchLength = 19 ; connections = hybridizationWithLengthFromStart ( one , two , analogSeqSS , analogSeqAS , matchLength ) ; } else if ( NucleotideParser . RNA_DESIGN_DICER_27_R . equalsIgnoreCase ( rnaDesignType ) ) { int matchLength = 25 ; connections = hybridizationWithLengthFromStart ( one , two , analogSeqSS , analogSeqAS , matchLength ) ; } else if ( NucleotideParser . RNA_DESIGN_DICER_27_L . equalsIgnoreCase ( rnaDesignType ) ) { int matchLength = 25 ; connections = hybridizationWithLengthFromStart ( one , two , analogSeqSS , analogSeqAS , matchLength ) ; } else { new RNAUtilsException ( "RNA-Design-Type " + rnaDesignType + " is unknown" ) ; } } return connections ; }
method to generate a List of ConnectionNotation according to the given two polymerNotations and the rnaDesigntype