idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
141,300 | 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 | 560 | 14 |
141,301 | public static List < Monomer > getAllMonomersOnlyBase ( MonomerNotation not ) throws HELM2HandledException , MonomerException , NotationException , ChemistryException , CTKException , MonomerLoadingException { LOG . debug ( "Get base for " + not ) ; List < Monomer > monomers = new ArrayList < Monomer > ( ) ; MonomerFactory monomerFactory = MonomerFactory . getInstance ( ) ; MonomerStore monomerStore = monomerFactory . getMonomerStore ( ) ; LOG . debug ( "Which MonomerNotationType " + not . getClass ( ) ) ; if ( not instanceof MonomerNotationUnitRNA ) { LOG . debug ( "MonomerNotationUnitRNA" ) ; monomers . addAll ( getMonomersRNAOnlyBase ( ( MonomerNotationUnitRNA ) not , monomerStore ) ) ; } 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 ) { LOG . debug ( "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 ) { LOG . debug ( "MonomerNotationList" ) ; for ( MonomerNotation listElement : ( ( MonomerNotationList ) not ) . getListofMonomerUnits ( ) ) { if ( listElement instanceof MonomerNotationUnitRNA ) { monomers . addAll ( getMonomersRNAOnlyBase ( ( ( MonomerNotationUnitRNA ) listElement ) , monomerStore ) ) ; } 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 . But only the Base | 637 | 19 |
141,302 | private static void checkAttachmentPoint ( Monomer mon , String str ) throws AttachmentException { if ( ! ( mon . getAttachmentListString ( ) . contains ( str ) ) ) { if ( ! ( str . equals ( "?" ) || str . equals ( "pair" ) ) && ! mon . getAlternateId ( ) . equals ( "?" ) ) { LOG . info ( "Attachment point for source is not there" ) ; throw new AttachmentException ( "Attachment point for source is not there: " + str ) ; } } } | method to check the attachment point s existence | 120 | 8 |
141,303 | private static boolean checkSingleAttachment ( List < Monomer > monomers , String rGroup , HELM2Notation helm2notation , ConnectionNotation not , InterConnections interconnection , String id ) throws AttachmentException { for ( Monomer monomer : monomers ) { /* Are the attachment points there */ checkAttachmentPoint ( monomer , rGroup ) ; /* is the attachment point already occupied by another monomer? */ String detail = not . getSourceUnit ( ) + "$" + not . getrGroupSource ( ) ; /* Is the attachment point already occupied by another monomer */ /* Intra connections */ if ( helm2notation . getSimplePolymer ( id ) . getMapIntraConnection ( ) . containsKey ( detail ) ) { throw new AttachmentException ( "Attachment point is already occupied" ) ; } /* Inter connections */ detail = id + "$" + detail ; /* check */ if ( interconnection . hasKey ( detail ) ) { throw new AttachmentException ( "Attachment point is already occupied" ) ; } } return true ; } | method to check for one attachment point the validation | 227 | 9 |
141,304 | private static List < Monomer > getMonomersRNA ( MonomerNotationUnitRNA rna , MonomerStore monomerStore , int position ) throws HELM2HandledException { try { List < Monomer > monomers = new ArrayList < Monomer > ( ) ; for ( int index = 0 ; index < rna . getContents ( ) . size ( ) ; index ++ ) { String id = rna . getContents ( ) . get ( index ) . getUnit ( ) ; if ( rna . getContents ( ) . get ( index ) . getUnit ( ) . startsWith ( "[" ) && rna . getContents ( ) . get ( index ) . getUnit ( ) . endsWith ( "]" ) ) { id = id . substring ( 1 , id . length ( ) - 1 ) ; } /* Special case */ if ( rna . getContents ( ) . size ( ) == 1 && position == 0 ) { monomers . add ( MethodsMonomerUtils . getMonomer ( rna . getType ( ) , id , "P" ) ) ; } else { monomers . add ( MethodsMonomerUtils . getMonomer ( rna . getType ( ) , id , rna . getInformation ( ) . get ( index ) ) ) ; } } return monomers ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new HELM2HandledException ( e . getMessage ( ) ) ; } } | method to get all monomers for MonomerNotationUnitRNA | 322 | 13 |
141,305 | private static List < Monomer > getMonomersRNAOnlyBase ( MonomerNotationUnitRNA rna , MonomerStore monomerStore ) throws HELM2HandledException { try { List < Monomer > monomers = new ArrayList < Monomer > ( ) ; for ( MonomerNotationUnit unit : rna . getContents ( ) ) { String id = unit . getUnit ( ) . replace ( "[" , "" ) ; id = id . replace ( "]" , "" ) ; Monomer mon = MethodsMonomerUtils . getMonomer ( rna . getType ( ) , id , "" ) ; if ( mon . getMonomerType ( ) . equals ( Monomer . BRANCH_MOMONER_TYPE ) ) { monomers . add ( mon ) ; } } return monomers ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new HELM2HandledException ( e . getMessage ( ) ) ; } } | method to get only the nucleotide base for one MonomerNotationUnitRNA | 215 | 16 |
141,306 | private static void initComplementMap ( ) { complementMap = new HashMap < String , String > ( ) ; complementMap . put ( "A" , "U" ) ; complementMap . put ( "G" , "C" ) ; complementMap . put ( "C" , "G" ) ; complementMap . put ( "U" , "A" ) ; complementMap . put ( "T" , "A" ) ; complementMap . put ( "X" , "X" ) ; } | initialize Map to get the complement of each nucleotide | 109 | 11 |
141,307 | public static boolean areAntiparallel ( PolymerNotation polymerOne , PolymerNotation polymerTwo ) throws RNAUtilsException , HELM2HandledException , ChemistryException , NucleotideLoadingException { checkRNA ( polymerOne ) ; checkRNA ( polymerTwo ) ; PolymerNotation antiparallel = getAntiparallel ( polymerOne ) ; String sequenceOne = FastaFormat . generateFastaFromRNA ( MethodsMonomerUtils . getListOfHandledMonomers ( antiparallel . getListMonomers ( ) ) ) ; String sequenceTwo = FastaFormat . generateFastaFromRNA ( MethodsMonomerUtils . getListOfHandledMonomers ( polymerTwo . getListMonomers ( ) ) ) ; return sequenceOne . equals ( sequenceTwo ) ; } | method to check if two given polymers are complement to each other | 175 | 13 |
141,308 | public static String getMaxMatchFragment ( String seq1 , String seq2 ) throws NotationException { return getMaxMatchFragment ( seq1 , seq2 , MINUMUM_MATCH_FRAGMENT_LENGTH ) ; } | method to get the largest matched fragment between two sequences replace T with U before Match | 51 | 16 |
141,309 | public static String getMaxMatchFragment ( String seq1 , String seq2 , int minLength ) throws NotationException { if ( null == seq1 || null == seq2 ) { throw new NotationException ( "Both sequences must not be null " ) ; } if ( ! seq1 . equals ( seq1 . toUpperCase ( ) ) || ! seq2 . equals ( seq2 . toUpperCase ( ) ) ) { throw new NotationException ( "Both sequences must be natural nucleotide sequence in upper case " ) ; } String longSeq , shortSeq ; if ( seq1 . length ( ) > seq2 . length ( ) ) { longSeq = seq1 ; shortSeq = seq2 ; } else { longSeq = seq2 ; shortSeq = seq1 ; } // replace T with U longSeq = longSeq . replaceAll ( "T" , "U" ) ; shortSeq = shortSeq . replaceAll ( "T" , "U" ) ; int min = MINUMUM_MATCH_FRAGMENT_LENGTH ; if ( minLength > min ) { min = minLength ; } for ( int len = shortSeq . length ( ) ; len > min ; len -- ) { for ( int i = 0 ; i <= shortSeq . length ( ) - len ; i ++ ) { String tmp = shortSeq . substring ( i , i + len ) ; if ( longSeq . contains ( tmp ) ) { return tmp ; } } } return "" ; } | This method returns the largest matched fragment between two sequences replace T with U before match | 332 | 16 |
141,310 | public static void removeLastP ( PolymerNotation polymer ) throws RNAUtilsException , NotationException , HELM2HandledException { checkRNA ( polymer ) ; /* Get last monomerNotation */ MonomerNotation lastObject = polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( polymer . getPolymerElements ( ) . getListOfElements ( ) . size ( ) - 1 ) ; /* What happens to HELM2 features */ if ( lastObject instanceof MonomerNotationGroup || lastObject instanceof MonomerNotationList ) { throw new HELM2HandledException ( "HELM2 features are involved" ) ; } if ( hasPhosphat ( ( MonomerNotationUnitRNA ) lastObject ) ) { MonomerNotation lastObjectwithoutPhosphat = new MonomerNotationUnitRNA ( lastObject . getUnit ( ) . substring ( 0 , lastObject . getUnit ( ) . length ( ) - 1 ) , "RNA" ) ; ChangeObjects . changeMonomerNotation ( polymer . getPolymerElements ( ) . getListOfElements ( ) . size ( ) - 1 , polymer , lastObjectwithoutPhosphat ) ; LOG . info ( "Last phosphate was removed from the last nucleotide" ) ; } } | method to remove the phosphate of the last nucleotide | 285 | 10 |
141,311 | public static void addLastP ( PolymerNotation polymer ) throws RNAUtilsException , NotationException , HELM2HandledException { checkRNA ( polymer ) ; /* Get last monomerNotation */ MonomerNotation lastObject = polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( polymer . getPolymerElements ( ) . getListOfElements ( ) . size ( ) - 1 ) ; /* What happens to HELM2 features */ if ( lastObject instanceof MonomerNotationGroup || lastObject instanceof MonomerNotationList ) { throw new HELM2HandledException ( "HELM2 features are involved" ) ; } if ( ! ( hasPhosphat ( ( MonomerNotationUnitRNA ) lastObject ) ) ) { MonomerNotation lastObjectwithPhosphat = new MonomerNotationUnitRNA ( lastObject . getUnit ( ) + "P" , "RNA" ) ; ChangeObjects . changeMonomerNotation ( polymer . getPolymerElements ( ) . getListOfElements ( ) . size ( ) - 1 , polymer , lastObjectwithPhosphat ) ; LOG . info ( "Phosphate was added to the last nucleotide" ) ; } } | method to add a phosphate to the last polymer s nucleotide | 273 | 12 |
141,312 | public static PolymerNotation getInverse ( PolymerNotation polymer ) throws RNAUtilsException , org . helm . notation2 . exception . NotationException , ChemistryException , NucleotideLoadingException { checkRNA ( polymer ) ; PolymerNotation inverse ; try { inverse = SequenceConverter . readRNA ( generateInverse ( polymer ) . toString ( ) ) . getListOfPolymers ( ) . get ( 0 ) ; inverse = new PolymerNotation ( inverse . getPolymerID ( ) , inverse . getPolymerElements ( ) , "Inverse to " + polymer . getPolymerID ( ) . getId ( ) ) ; return inverse ; } catch ( NotationException | FastaFormatException | HELM2HandledException e ) { e . printStackTrace ( ) ; throw new RNAUtilsException ( "The inverse strand can not be built" ) ; } } | method to get the polymer with the inverse sequence of the current polymer | 195 | 13 |
141,313 | public static PolymerNotation getReverseComplement ( PolymerNotation polymer ) throws RNAUtilsException , org . helm . notation2 . exception . NotationException , ChemistryException , NucleotideLoadingException { checkRNA ( polymer ) ; PolymerNotation complementReversePolymer ; try { complementReversePolymer = SequenceConverter . readRNA ( generateReverseComplement ( polymer ) . toString ( ) ) . getListOfPolymers ( ) . get ( 0 ) ; complementReversePolymer = new PolymerNotation ( complementReversePolymer . getPolymerID ( ) , complementReversePolymer . getPolymerElements ( ) , "ReverseComplement to " + polymer . getPolymerID ( ) . getId ( ) ) ; return complementReversePolymer ; } catch ( NotationException | FastaFormatException | HELM2HandledException e ) { e . printStackTrace ( ) ; throw new RNAUtilsException ( "Complement polymer can not be built" ) ; } } | method to get the polymer with the reverse complement sequence of the current polymer | 234 | 14 |
141,314 | private static StringBuilder generateInverse ( PolymerNotation polymer ) throws HELM2HandledException , RNAUtilsException , org . helm . notation2 . exception . NotationException , ChemistryException { initComplementMap ( ) ; String sequence = getNaturalAnalogSequence ( polymer ) ; StringBuilder sb = new StringBuilder ( sequence ) ; return sb . reverse ( ) ; } | method to generate the inverse sequence of the given polymer | 84 | 10 |
141,315 | public static boolean hasNucleotideModification ( PolymerNotation polymer ) throws NotationException { for ( MonomerNotation current : polymer . getPolymerElements ( ) . getListOfElements ( ) ) { if ( hasModification ( current ) ) { return true ; } } return false ; } | method to check if the given PolymerNotation has a nucleotide Modification | 67 | 16 |
141,316 | private static boolean hasModification ( MonomerNotation monomerNotation ) throws NotationException { if ( monomerNotation instanceof MonomerNotationUnitRNA ) { if ( hasModification ( ( MonomerNotationUnitRNA ) monomerNotation ) ) { return true ; } } else if ( monomerNotation instanceof MonomerNotationGroup ) { for ( MonomerNotationGroupElement element : ( ( MonomerNotationGroup ) monomerNotation ) . getListOfElements ( ) ) { if ( hasModification ( element . getMonomerNotation ( ) ) ) { return true ; } } } else if ( monomerNotation instanceof MonomerNotationList ) { for ( MonomerNotation element : ( ( MonomerNotationList ) monomerNotation ) . getListofMonomerUnits ( ) ) { if ( hasModification ( element ) ) { return true ; } } } else { throw new NotationException ( "Unknown MonomerNotation Type " + monomerNotation . getClass ( ) ) ; } return false ; } | method to check if the MonomerNotation contains a modification | 236 | 12 |
141,317 | private static boolean hasModification ( MonomerNotationUnitRNA monomerNotation ) { if ( monomerNotation . getUnit ( ) . contains ( "[" ) || monomerNotation . getUnit ( ) . contains ( "(X)" ) || monomerNotation . getUnit ( ) . endsWith ( ")" ) ) { return true ; } return false ; } | method to check if the MonomerNotationUnitRNA contains modification | 80 | 13 |
141,318 | public static List < ConnectionNotation > hybridizeAntiparallel ( PolymerNotation one , PolymerNotation two ) throws RNAUtilsException , NotationException , HELM2HandledException , ChemistryException , NucleotideLoadingException { checkRNA ( one ) ; checkRNA ( two ) ; List < ConnectionNotation > connections = new ArrayList < ConnectionNotation > ( ) ; ConnectionNotation connection ; /* Length of the two rnas have to be the same */ if ( areAntiparallel ( one , two ) ) { for ( int i = 0 ; i < PolymerUtils . getTotalMonomerCount ( one ) ; i ++ ) { int backValue = PolymerUtils . getTotalMonomerCount ( one ) - i ; int firstValue = i + 1 ; String details = firstValue + ":pair-" + backValue + ":pair" ; connection = new ConnectionNotation ( one . getPolymerID ( ) , two . getPolymerID ( ) , details ) ; connections . add ( connection ) ; } return connections ; } else { throw new RNAUtilsException ( "The given RNAs are not antiparallel to each other" ) ; } } | method to hybridize two PolymerNotations together if they are antiparallel | 259 | 16 |
141,319 | public static String getSequence ( PolymerNotation one ) throws RNAUtilsException , HELM2HandledException , ChemistryException { checkRNA ( one ) ; List < Nucleotide > nucleotideList = getNucleotideList ( one ) ; StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < nucleotideList . size ( ) ; i ++ ) { sb . append ( nucleotideList . get ( i ) . getNaturalAnalog ( ) ) ; } return sb . toString ( ) ; } | method to get the rna sequence of the given PolymerNotation | 119 | 14 |
141,320 | public static String getModifiedNucleotideSequence ( PolymerNotation polymer ) throws RNAUtilsException , HELM2HandledException , ChemistryException { checkRNA ( polymer ) ; List < Nucleotide > nucleotides = getNucleotideList ( polymer ) ; StringBuilder sb = new StringBuilder ( ) ; for ( Nucleotide nucleotide : nucleotides ) { sb . append ( nucleotide . getSymbol ( ) ) ; } return sb . toString ( ) ; } | method to get the modifiedNucleotideSequence of the given PolymerNotation | 109 | 17 |
141,321 | public static String getNucleotideSequence ( PolymerNotation polymer ) throws NotationException , RNAUtilsException , HELM2HandledException , NucleotideLoadingException , ChemistryException { List < Nucleotide > nucleotides = getNucleotideList ( polymer ) ; StringBuffer sb = new StringBuffer ( ) ; int count = 0 ; Map < String , String > reverseNucMap = NucleotideFactory . getInstance ( ) . getReverseNucleotideTemplateMap ( ) ; for ( Nucleotide nuc : nucleotides ) { String nucleotide = nuc . getNotation ( ) ; String nucleoside = nuc . getNucleosideNotation ( ) ; String linker = nuc . getLinkerNotation ( ) ; // it is ok for the first nucleotide not to have a nucleoside if ( count == 0 && nucleoside . length ( ) == 0 ) { sb . append ( nuc . getPhosphateMonomer ( ) . getAlternateId ( ) ) ; count ++ ; continue ; } // it is ok for the last nucleotide not to have a linker if ( count == nucleotides . size ( ) - 1 && linker . length ( ) == 0 ) { nucleotide = nucleotide + Monomer . ID_P ; } if ( reverseNucMap . containsKey ( nucleotide ) ) { sb . append ( reverseNucMap . get ( nucleotide ) ) ; } else { throw new NotationException ( "Unknown nucleotide found for " + nucleotide + " : missing nucleotide template" ) ; } count ++ ; } return sb . toString ( ) ; } | method to get the nucleotide sequence for the polymer | 363 | 10 |
141,322 | public static List < Nucleotide > getNucleotideList ( PolymerNotation polymer ) throws RNAUtilsException , HELM2HandledException , ChemistryException { checkRNA ( polymer ) ; List < Nucleotide > nucleotides = new ArrayList < Nucleotide > ( ) ; /* check for HELM2Elements */ List < MonomerNotation > monomerNotations = polymer . getPolymerElements ( ) . getListOfElements ( ) ; for ( int i = 0 ; i < monomerNotations . size ( ) ; i ++ ) { MonomerNotation monomerNotation = monomerNotations . get ( i ) ; if ( ( ! ( monomerNotation instanceof MonomerNotationUnitRNA ) ) || Integer . parseInt ( monomerNotation . getCount ( ) ) != 1 ) { LOG . info ( "MonomerNotation contains HELM2 Elements " + monomerNotation ) ; throw new HELM2HandledException ( "HELM2 Elements are involved" ) ; } try { boolean last = false ; if ( i == monomerNotations . size ( ) - 1 ) { last = true ; } nucleotides . add ( NucleotideParser . convertToNucleotide ( monomerNotation . getUnit ( ) , last ) ) ; } catch ( MonomerException | NucleotideLoadingException | NotationException | org . helm . notation2 . exception . NotationException e ) { e . printStackTrace ( ) ; throw new RNAUtilsException ( "Nucleotide can not be read " + e . getMessage ( ) ) ; } } return nucleotides ; } | method to get all nucleotides for one polymer | 359 | 10 |
141,323 | public static String getTrimmedNucleotideSequence ( PolymerNotation polymer ) throws RNAUtilsException , HELM2HandledException , ChemistryException { checkRNA ( polymer ) ; List < Nucleotide > list = getNucleotideList ( polymer ) ; int start = 0 ; Nucleotide na = list . get ( start ) ; while ( null == na . getBaseMonomer ( ) ) { start ++ ; na = list . get ( start ) ; } int end = list . size ( ) - 1 ; na = list . get ( end ) ; while ( null == na . getBaseMonomer ( ) ) { end -- ; na = list . get ( end ) ; } StringBuffer sb = new StringBuffer ( ) ; for ( int i = start ; i <= end ; i ++ ) { sb . append ( list . get ( i ) . getNaturalAnalog ( ) ) ; } return sb . toString ( ) ; } | method to get the trimmed nucleotide sequence | 208 | 8 |
141,324 | public static JKExceptionHandlerFactory getInstance ( ) { if ( JKExceptionHandlerFactory . instance == null ) { JKExceptionHandlerFactory . instance = new JKExceptionHandlerFactory ( ) ; } return JKExceptionHandlerFactory . instance ; } | Gets the single instance of ExceptionHandlerFactory . | 53 | 10 |
141,325 | public void setHandler ( final Class < ? extends Throwable > clas , final JKExceptionHandler handler ) { this . handlers . put ( clas , handler ) ; } | Sets the handler . | 37 | 5 |
141,326 | public void registerHanders ( String packageString ) { List < String > list = AnnotationDetector . scanAsList ( ExceptionHandler . class , packageString ) ; for ( String handler : list ) { // System.out.println(handler); JKExceptionHandler < ? extends Throwable > newInstance = JKObjectUtil . newInstance ( handler ) ; Class < ? extends Throwable > clas = JKObjectUtil . getGenericParamter ( handler ) ; setHandler ( clas , newInstance ) ; } } | Register handers . | 113 | 4 |
141,327 | public boolean unmodifiedWithoutPhosphate ( ) { if ( getNotation ( ) == null ) { return true ; } else { // System.out.println("Contains [ " + getNotation().contains("[") + // "\tContainsX " + getNotation().contains("[")); if ( getNotation ( ) . contains ( "[" ) || getNotation ( ) . contains ( "X" ) ) { return false ; } else { return true ; } } } | Returns true if the nucleotide is unmodified except for a missing phosphate group . If the nucleotide notation is empty it returns true . | 108 | 27 |
141,328 | public Monomer getBaseMonomer ( MonomerStore monomerStore ) { String baseSymbol = getBaseSymbol ( ) ; if ( baseSymbol != null && ! baseSymbol . equalsIgnoreCase ( "" ) ) { try { Map < String , Monomer > monomers = monomerStore . getMonomers ( Monomer . NUCLIEC_ACID_POLYMER_TYPE ) ; Monomer m = monomers . get ( baseSymbol ) ; return m ; } catch ( Exception ex ) { LOG . info ( "Unable to get base monomer for " + baseSymbol ) ; return null ; } } else { return null ; } } | get the base monomer the return value could be null if this nucleotide does not have a base | 147 | 20 |
141,329 | public Monomer getSugarMonomer ( MonomerStore monomerStore ) { String sugarSymbol = getSugarSymbol ( ) ; if ( sugarSymbol != null && ! sugarSymbol . equalsIgnoreCase ( "" ) ) { try { Map < String , Monomer > monomers = monomerStore . getMonomers ( Monomer . NUCLIEC_ACID_POLYMER_TYPE ) ; Monomer m = monomers . get ( sugarSymbol ) ; return m ; } catch ( Exception ex ) { LOG . info ( "Unable to get sugar monomer for " + sugarSymbol ) ; return null ; } } else { return null ; } } | get the sugar monomer the return value could be null if the nucleotide does not has a sugar | 149 | 20 |
141,330 | public String getLinkerNotation ( ) { String pSymbol = getPhosphateSymbol ( ) ; String result = null ; if ( null == pSymbol || pSymbol . length ( ) == 0 ) { result = "" ; } else { if ( pSymbol . length ( ) > 1 ) result = "[" + pSymbol + "]" ; else result = pSymbol ; } return result ; } | This method returns the HELM notation for nucleotide linker | 91 | 12 |
141,331 | public String getNucleosideNotation ( ) { int linkerLen = getLinkerNotation ( ) . length ( ) ; return notation . substring ( 0 , notation . length ( ) - linkerLen ) ; } | This method returns the HELM notation for nucleoside | 49 | 11 |
141,332 | public void addMonomer ( Monomer monomer , boolean dbChanged ) throws IOException , MonomerException { Map < String , Monomer > monomerMap = monomerDB . get ( monomer . getPolymerType ( ) ) ; String polymerType = monomer . getPolymerType ( ) ; String alternateId = monomer . getAlternateId ( ) ; String smilesString = monomer . getCanSMILES ( ) ; try { smilesString = SMILES . getUniqueExtendedSMILES ( smilesString ) ; } catch ( Exception e ) { smilesString = monomer . getCanSMILES ( ) ; } boolean hasSmilesString = ( smilesString != null && smilesString . length ( ) > 0 ) ; if ( null == monomerMap ) { monomerMap = new TreeMap < String , Monomer > ( String . CASE_INSENSITIVE_ORDER ) ; monomerDB . put ( polymerType , monomerMap ) ; } Monomer copyMonomer = DeepCopy . copy ( monomer ) ; // ensure the canonical SMILES is indexed in the monomer store if ( hasSmilesString ) { copyMonomer . setCanSMILES ( smilesString ) ; } boolean alreadyAdded = false ; alreadyAdded = monomerMap . containsKey ( alternateId ) ; if ( ! alreadyAdded ) { monomerMap . put ( alternateId , copyMonomer ) ; boolean alreadyInSMILESMap = hasSmilesString && ( smilesMonomerDB . containsKey ( smilesString ) ) ; if ( ! alreadyInSMILESMap ) { smilesMonomerDB . put ( smilesString , copyMonomer ) ; } } if ( dbChanged ) { MonomerFactory . setDBChanged ( true ) ; } } | Adds a monomer to the store and optionally sets the dbChanged flag | 384 | 14 |
141,333 | public boolean hasMonomer ( String polymerType , String alternateId ) { return ( ( monomerDB . get ( polymerType ) != null ) && getMonomer ( polymerType , alternateId ) != null ) ; } | Checks if a specific monomer exists in the store | 48 | 11 |
141,334 | public Monomer getMonomer ( String polymerType , String alternateId ) { Map < String , Monomer > map1 = monomerDB . get ( polymerType ) ; //alternateId = alternateId.toUpperCase(); return monomerDB . get ( polymerType ) . get ( alternateId ) ; } | Returns the monomer specified by polymerType and alternatId | 68 | 12 |
141,335 | public synchronized void addNewMonomer ( Monomer monomer ) throws IOException , MonomerException { monomer . setNewMonomer ( true ) ; addMonomer ( monomer , true ) ; } | Adds a monomer to the store and makes it a temporary new monomer | 46 | 15 |
141,336 | public List < Monomer > getAllMonomersList ( ) { List < Monomer > monomers = new ArrayList < Monomer > ( ) ; for ( String polymerType : getPolymerTypeSet ( ) ) { Map < String , Monomer > map = getMonomers ( polymerType ) ; monomers . addAll ( map . values ( ) ) ; } return monomers ; } | This method returns all monomers of the store as list sorted by polymer type | 85 | 15 |
141,337 | public final static void addAnnotation ( final AnnotationNotation notation , final int position , final HELM2Notation helm2notation ) { helm2notation . getListOfAnnotations ( ) . add ( position , notation ) ; } | method to add an annotation at a specific position of the HELM2Notation | 50 | 16 |
141,338 | public final static void changeAnnotation ( final AnnotationNotation notation , final int position , final HELM2Notation helm2notation ) { helm2notation . getListOfAnnotations ( ) . set ( position , notation ) ; } | method to change an annotation at the position of the HELM2Notation | 50 | 15 |
141,339 | public final static void addConnection ( final ConnectionNotation notation , final int position , final HELM2Notation helm2notation ) { helm2notation . getListOfConnections ( ) . add ( position , notation ) ; } | method to add a new connection at the position of the HELM2Notation | 48 | 16 |
141,340 | public final static void changeConnection ( final int position , final ConnectionNotation notation , final HELM2Notation helm2notation ) { helm2notation . getListOfConnections ( ) . set ( position , notation ) ; } | method to change a connection at the position of the HELM2Notation | 48 | 15 |
141,341 | public final static void addAnnotationToConnection ( final int position , final String annotation , final HELM2Notation helm2notation ) { helm2notation . getListOfConnections ( ) . get ( position ) . setAnnotation ( annotation ) ; } | method to add an annotation to a connection of the HELM2Notation | 54 | 15 |
141,342 | public final static void addGroup ( final GroupingNotation notation , final int position , final HELM2Notation helm2notation ) { helm2notation . getListOfGroupings ( ) . add ( position , notation ) ; } | method to add a group to the grouping section of the HELM2Notation | 49 | 16 |
141,343 | public final static void changeGroup ( final GroupingNotation notation , final int position , final HELM2Notation helm2notation ) { helm2notation . getListOfGroupings ( ) . set ( position , notation ) ; } | method to change a group of the HELM2Notation | 49 | 12 |
141,344 | public final static PolymerNotation addAnnotationToPolymer ( final PolymerNotation polymer , final String annotation ) { if ( polymer . getAnnotation ( ) != null ) { return new PolymerNotation ( polymer . getPolymerID ( ) , polymer . getPolymerElements ( ) , polymer . getAnnotation ( ) + " | " + annotation ) ; } return new PolymerNotation ( polymer . getPolymerID ( ) , polymer . getPolymerElements ( ) , annotation ) ; } | method to add an annotation to a PolymerNotation | 111 | 11 |
141,345 | public final static PolymerNotation removeAnnotationOfPolmyer ( PolymerNotation polymer ) { return new PolymerNotation ( polymer . getPolymerID ( ) , polymer . getPolymerElements ( ) , null ) ; } | method to remove a current annotation of a PolymerNotation | 52 | 12 |
141,346 | public final static PolymerNotation addMonomerNotation ( int position , PolymerNotation polymer , MonomerNotation monomerNotation ) { polymer . getPolymerElements ( ) . getListOfElements ( ) . add ( position , monomerNotation ) ; return polymer ; } | method to add a new MonomerNotation to a PolymerNotation | 65 | 15 |
141,347 | public final static void changeMonomerNotation ( int position , PolymerNotation polymer , MonomerNotation not ) { polymer . getPolymerElements ( ) . getListOfElements ( ) . set ( position , not ) ; } | method to change the MonomerNotation on the specific position | 53 | 12 |
141,348 | public final static void deleteMonomerNotation ( int position , PolymerNotation polymer ) throws NotationException { MonomerNotation monomerNotation = polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( position ) ; if ( polymer . getPolymerElements ( ) . getListOfElements ( ) . size ( ) == 1 ) { throw new NotationException ( monomerNotation . toString ( ) + " can't be removed. Polymer has to have at least one Monomer Notation" ) ; } polymer . getPolymerElements ( ) . getListOfElements ( ) . remove ( monomerNotation ) ; } | method to delete a MonomerNotation at a specific position of the PolymerNotation | 149 | 18 |
141,349 | public final static void addAnnotationToMonomerNotation ( PolymerNotation polymer , int position , String annotation ) { polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( position ) . setAnnotation ( annotation ) ; } | method to add an annotation to a MonomerNotation | 58 | 11 |
141,350 | public final static void addCountToMonomerNotation ( PolymerNotation polymer , int position , String count ) { polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( position ) . setCount ( count ) ; } | method to set the count of a MonomerNotation | 56 | 11 |
141,351 | public final static void deleteAnnotationFromMonomerNotation ( PolymerNotation polymer , int position ) { polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( position ) . setAnnotation ( null ) ; } | method to delete the annotation of a MonomerNotation | 55 | 11 |
141,352 | public final static void changePolymerNotation ( int position , PolymerNotation polymer , HELM2Notation helm2notation ) { helm2notation . getListOfPolymers ( ) . set ( position , polymer ) ; } | method to change the PolymerNotation at a specific position of the HELM2Notation | 49 | 19 |
141,353 | public final static void addPolymerNotation ( int position , PolymerNotation polymer , HELM2Notation helm2notation ) { helm2notation . getListOfPolymers ( ) . add ( position , polymer ) ; } | method to add a PolymerNotation at a specific position of the HELM2Notation | 49 | 19 |
141,354 | public final static void replaceMonomer ( HELM2Notation helm2notation , String polymerType , String existingMonomerID , String newMonomerID ) throws NotationException , MonomerException , ChemistryException , CTKException , IOException , JDOMException { validateMonomerReplacement ( polymerType , existingMonomerID , newMonomerID ) ; /* * if(newMonomerID.length()> 1){ if( !( newMonomerID.startsWith("[") && * newMonomerID.endsWith("]"))){ newMonomerID = "[" + newMonomerID + * "]"; } } */ for ( int i = 0 ; i < helm2notation . getListOfPolymers ( ) . size ( ) ; i ++ ) { if ( helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerID ( ) . getType ( ) . equals ( polymerType ) ) { for ( int j = 0 ; j < helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . size ( ) ; j ++ ) { MonomerNotation monomerNotation = replaceMonomerNotation ( helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . get ( j ) , existingMonomerID , newMonomerID ) ; if ( monomerNotation != null ) { helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . set ( j , monomerNotation ) ; } } } } } | method to replace the MonomerID with the new MonomerID for a given polymer type | 391 | 18 |
141,355 | public final static MonomerNotation replaceMonomerNotation ( MonomerNotation monomerNotation , String existingMonomerID , String newMonomerID ) throws NotationException , ChemistryException , CTKException , MonomerLoadingException { /* Nucleotide */ if ( monomerNotation instanceof MonomerNotationUnitRNA ) { List < String > result = generateIDForNucleotide ( ( ( MonomerNotationUnitRNA ) monomerNotation ) , existingMonomerID , newMonomerID ) ; if ( result . get ( 1 ) != null ) { MonomerNotationUnitRNA newObject = new MonomerNotationUnitRNA ( result . get ( 0 ) , monomerNotation . getType ( ) ) ; newObject . setCount ( monomerNotation . getCount ( ) ) ; if ( monomerNotation . isAnnotationTrue ( ) ) { newObject . setAnnotation ( monomerNotation . getAnnotation ( ) ) ; } return newObject ; } } else if ( monomerNotation instanceof MonomerNotationUnit ) { /* Simple MonomerNotationUnit */ if ( monomerNotation . getUnit ( ) . equals ( existingMonomerID ) ) { return produceMonomerNotationUnitWithOtherID ( monomerNotation , newMonomerID ) ; } } else if ( monomerNotation instanceof MonomerNotationList ) { /* MonomerNotationList */ monomerNotation = replaceMonomerNotationList ( ( ( MonomerNotationList ) monomerNotation ) , existingMonomerID , newMonomerID ) ; if ( monomerNotation != null ) { return monomerNotation ; } } else if ( monomerNotation instanceof MonomerNotationGroup ) { /* MonomerNotatationGroup */ monomerNotation = replaceMonomerNotationGroup ( ( ( MonomerNotationGroup ) monomerNotation ) , existingMonomerID , newMonomerID ) ; if ( monomerNotation != null ) { return monomerNotation ; } } else { throw new NotationException ( "Unknown MonomerNotation Type " + monomerNotation . getClass ( ) ) ; } return null ; } | method to replace the MonomerNotation having the MonomerID with the new MonomerID | 489 | 19 |
141,356 | public final static MonomerNotationGroup replaceMonomerNotationGroup ( MonomerNotationGroup monomerNotation , String existingMonomerID , String newMonomerID ) throws NotationException { MonomerNotationGroup newObject = null ; boolean hasChanged = false ; StringBuilder sb = new StringBuilder ( ) ; String id = "" ; for ( MonomerNotationGroupElement object : monomerNotation . getListOfElements ( ) ) { if ( object . getMonomerNotation ( ) . getUnit ( ) . equals ( existingMonomerID ) ) { hasChanged = true ; id = generateGroupElement ( newMonomerID , object . getValue ( ) ) ; } else { id = generateGroupElement ( object . getMonomerNotation ( ) . getUnit ( ) , object . getValue ( ) ) ; } if ( monomerNotation instanceof MonomerNotationGroupOr ) { sb . append ( id + "," ) ; } else { sb . append ( id + "+" ) ; } } if ( hasChanged ) { sb . setLength ( sb . length ( ) - 1 ) ; if ( monomerNotation instanceof MonomerNotationGroupOr ) { newObject = new MonomerNotationGroupOr ( sb . toString ( ) , monomerNotation . getType ( ) ) ; } else { newObject = new MonomerNotationGroupMixture ( sb . toString ( ) , monomerNotation . getType ( ) ) ; } } return newObject ; } | method to replace the MonomerNotationGroup having the MonomerID with the new MonomerID | 340 | 20 |
141,357 | public final static MonomerNotationUnit produceMonomerNotationUnitWithOtherID ( MonomerNotation monomerNotation , String newID ) throws NotationException { MonomerNotationUnit result = new MonomerNotationUnit ( newID , monomerNotation . getType ( ) ) ; if ( monomerNotation . isAnnotationTrue ( ) ) { result . setAnnotation ( monomerNotation . getAnnotation ( ) ) ; } result . setCount ( monomerNotation . getCount ( ) ) ; return result ; } | method to replace the MonomerNotationUnit having the MonomerID with the new MonomerID | 119 | 20 |
141,358 | public final static MonomerNotationList replaceMonomerNotationList ( MonomerNotationList object , String existingMonomerID , String newMonomerID ) throws NotationException , ChemistryException , CTKException , MonomerLoadingException { MonomerNotationList newObject = null ; boolean hasChanged = false ; StringBuilder sb = new StringBuilder ( ) ; String id = "" ; for ( MonomerNotation element : object . getListofMonomerUnits ( ) ) { if ( element instanceof MonomerNotationUnitRNA ) { List < String > result = generateIDForNucleotide ( ( ( MonomerNotationUnitRNA ) element ) , existingMonomerID , newMonomerID ) ; id = result . get ( 0 ) ; if ( result . get ( 1 ) != null ) { hasChanged = true ; } } else { if ( element . getUnit ( ) . equals ( existingMonomerID ) ) { hasChanged = true ; id = generateIDMonomerNotation ( newMonomerID , element . getCount ( ) , element . getAnnotation ( ) ) ; } else { id = generateIDMonomerNotation ( element . getUnit ( ) , element . getCount ( ) , element . getAnnotation ( ) ) ; } } sb . append ( id + "." ) ; } if ( hasChanged ) { sb . setLength ( sb . length ( ) - 1 ) ; newObject = new MonomerNotationList ( sb . toString ( ) , object . getType ( ) ) ; newObject . setCount ( object . getCount ( ) ) ; if ( object . isAnnotationTrue ( ) ) { newObject . setAnnotation ( object . getAnnotation ( ) ) ; } } return newObject ; } | method to replace the MonomerNotationList having the MonomerID with the new MonomerID | 392 | 20 |
141,359 | private final static String generateIDMonomerNotation ( String id , String count , String annotation ) { if ( id . length ( ) > 1 ) { id = "[" + id + "]" ; } String result = id ; try { if ( ! ( Integer . parseInt ( count ) == 1 ) ) { result += "'" + count + "'" ; } } catch ( NumberFormatException e ) { result += "'" + count + "'" ; } if ( annotation != null ) { result += "\"" + annotation + "\"" ; } return result ; } | method to generate the MonomerNotation in String format | 122 | 11 |
141,360 | private final static String generateIDRNA ( String id , String count , String annotation ) throws MonomerLoadingException , ChemistryException , CTKException { String result = id ; if ( result . startsWith ( "[" ) && result . endsWith ( "]" ) ) { result = id . substring ( 1 , id . length ( ) - 1 ) ; } if ( MonomerFactory . getInstance ( ) . getMonomerStore ( ) . getMonomer ( "RNA" , result ) . getMonomerType ( ) . equals ( Monomer . BRANCH_MOMONER_TYPE ) ) { if ( id . length ( ) > 1 ) { result = "[" + id + "]" ; } result = "(" + result + ")" ; } else { if ( id . length ( ) > 1 ) { result = "[" + id + "]" ; } } try { if ( ! ( Integer . parseInt ( count ) == 1 ) ) { result += "'" + count + "'" ; } } catch ( NumberFormatException e ) { result += "'" + count + "'" ; } if ( annotation != null ) { result += "\"" + annotation + "\"" ; } return result ; } | method to generate the MonomerNotation for a RNA | 263 | 11 |
141,361 | private final static List < String > generateIDForNucleotide ( MonomerNotationUnitRNA object , String existingMonomerID , String newMonomerID ) throws MonomerLoadingException , ChemistryException , CTKException { List < String > result = new ArrayList < String > ( ) ; String hasChanged = null ; StringBuilder sb = new StringBuilder ( ) ; String id = "" ; for ( MonomerNotation element : object . getContents ( ) ) { if ( element . getUnit ( ) . equals ( existingMonomerID ) ) { hasChanged = "" ; id = generateIDRNA ( newMonomerID , element . getCount ( ) , element . getAnnotation ( ) ) ; } else { id = generateIDRNA ( element . getUnit ( ) , element . getCount ( ) , element . getAnnotation ( ) ) ; } sb . append ( id ) ; } try { if ( ! ( Integer . parseInt ( object . getCount ( ) ) == 1 ) ) { sb . append ( "'" + object . getCount ( ) + "'" ) ; } } catch ( NumberFormatException e ) { sb . append ( "'" + object . getCount ( ) + "'" ) ; } if ( object . getAnnotation ( ) != null ) { sb . append ( "\"" + object . getAnnotation ( ) + "\"" ) ; } result . add ( sb . toString ( ) ) ; result . add ( hasChanged ) ; return result ; } | method to replace the MonomerNotationUnitRNA having the MonomerID with the new MonomerID | 329 | 21 |
141,362 | private static String generateGroupElement ( String id , List < Double > list ) { StringBuilder sb = new StringBuilder ( ) ; if ( list . size ( ) == 1 ) { if ( list . get ( 0 ) == - 1.0 ) { sb . append ( id + ":" ) ; sb . append ( "?" + "-" ) ; } else if ( list . get ( 0 ) == 1.0 ) { sb . append ( id + ":" ) ; } else { sb . append ( id + ":" + list . get ( 0 ) + "-" ) ; } } else { sb . append ( id + ":" ) ; for ( Double item : list ) { sb . append ( item + "-" ) ; } } sb . setLength ( sb . length ( ) - 1 ) ; return sb . toString ( ) ; } | method to generate the MonomerNotationGroupElement in String format | 190 | 13 |
141,363 | public static final void replaceSMILESWithTemporaryIds ( HELM2Notation helm2notation ) throws NotationException , HELM2HandledException , ChemistryException , CTKException , MonomerLoadingException , JDOMException { for ( int i = 0 ; i < helm2notation . getListOfPolymers ( ) . size ( ) ; i ++ ) { /* First save intern smiles to the MonomerFactory */ MethodsMonomerUtils . getListOfHandledMonomers ( helm2notation . getListOfPolymers ( ) . get ( i ) . getListMonomers ( ) ) ; for ( int j = 0 ; j < helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . size ( ) ; j ++ ) { MonomerNotation monomerNotation = replaceSMILESWithTemporaryIdsMonomerNotation ( helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . get ( j ) ) ; if ( monomerNotation != null ) { helm2notation . getListOfPolymers ( ) . get ( i ) . getPolymerElements ( ) . getListOfElements ( ) . set ( j , monomerNotation ) ; } } } } | This function replaces smiles in complex notation with temporary ids | 303 | 11 |
141,364 | public static void hybridize ( HELM2Notation helm2notation ) throws NotationException , RNAUtilsException , HELM2HandledException , org . helm . notation2 . exception . NotationException , ChemistryException { if ( HELM2NotationUtils . getAllBasePairConnections ( helm2notation . getListOfConnections ( ) ) . isEmpty ( ) && HELM2NotationUtils . getRNAPolymers ( helm2notation . getListOfPolymers ( ) ) . size ( ) == 2 ) { List < ConnectionNotation > connections = RNAUtils . hybridize ( HELM2NotationUtils . getRNAPolymers ( helm2notation . getListOfPolymers ( ) ) . get ( 0 ) , HELM2NotationUtils . getRNAPolymers ( helm2notation . getListOfPolymers ( ) ) . get ( 1 ) ) ; for ( ConnectionNotation connection : connections ) { addConnection ( connection , helm2notation . getListOfConnections ( ) . size ( ) , helm2notation ) ; } } } | this method will automatically add base pair info into notation only if it contains two RNA polymer notations and there is no base pairing info | 237 | 26 |
141,365 | public void setApplicationMap ( final Map < String , Object > applicationMap ) { JKThreadLocal . setValue ( JKContextConstants . APPLICATION_MAP , applicationMap ) ; } | Sets the application map . | 41 | 6 |
141,366 | public void setRequestMap ( final Map < String , Object > requestMap ) { JKThreadLocal . setValue ( JKContextConstants . HTTP_REQUEST_MAP , requestMap ) ; } | Sets the request map . | 43 | 6 |
141,367 | public void setSessionMap ( final Map < String , Object > sessionMap ) { JKThreadLocal . setValue ( JKContextConstants . HTTP_SESSION_MAP , sessionMap ) ; } | Sets the session map . | 43 | 6 |
141,368 | private static String compress ( String str ) throws EncoderException { ByteArrayOutputStream rstBao = null ; GZIPOutputStream zos = null ; try { rstBao = new ByteArrayOutputStream ( ) ; zos = new GZIPOutputStream ( rstBao ) ; zos . write ( str . getBytes ( ) ) ; IOUtils . closeQuietly ( zos ) ; byte [ ] bytes = rstBao . toByteArray ( ) ; return Base64 . encodeBase64String ( bytes ) ; } catch ( Exception e ) { throw new EncoderException ( "Molfile could not be compressed. " + str ) ; } finally { IOUtils . closeQuietly ( zos ) ; } } | method to compress the given molfile in a gezipped Base64 string | 166 | 16 |
141,369 | private static String decompress ( String str ) throws EncoderException { /* First base64 decode the string */ byte [ ] bytes = Base64 . decodeBase64 ( str ) ; GZIPInputStream zi = null ; try { zi = new GZIPInputStream ( new ByteArrayInputStream ( bytes ) ) ; InputStreamReader reader = new InputStreamReader ( zi ) ; BufferedReader in = new BufferedReader ( reader ) ; StringBuilder sb = new StringBuilder ( ) ; String read ; while ( ( read = in . readLine ( ) ) != null ) { sb . append ( read + "\n" ) ; } String molfile = sb . toString ( ) ; reader . close ( ) ; in . close ( ) ; zi . close ( ) ; return molfile ; } catch ( IOException e ) { throw new EncoderException ( "Molfile could not be decompressed. " + str ) ; } finally { IOUtils . closeQuietly ( zi ) ; } } | method to decompress the given molfile input | 224 | 10 |
141,370 | public MemoryFileAttributes addDir ( EightyPath dir , Principals principals ) { if ( content . get ( dir ) . isPresent ( ) ) { throw new IllegalArgumentException ( "path exists already" ) ; } if ( ! dir . isAbsolute ( ) || dir . getParent ( ) == null ) { throw new IllegalArgumentException ( "path not absolute or without parent" ) ; } PathContent parentContent = content . getOrThrow ( childGetParent ( dir ) , ( ) -> new IllegalArgumentException ( "parent does not exist" ) ) ; content . put ( dir , PathContent . newDir ( principals ) ) ; parentContent . kids . add ( dir ) ; parentContent . attis . setLastModifiedTime ( ) ; parentContent . attis . setLastAccessTime ( ) ; return parentContent . attis ; } | todo default to root ? | 184 | 6 |
141,371 | public static Map < String , Attachment > loadAttachments ( InputStream in ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; TypeReference < TreeMap < String , Attachment > > typeRef = new TypeReference < TreeMap < String , Attachment > > ( ) { } ; TreeMap < String , Attachment > attachments ; try { attachments = mapper . readValue ( in , typeRef ) ; LOG . info ( "Attachments could be loaded" ) ; for ( Map . Entry < String , Attachment > entry : attachments . entrySet ( ) ) { Attachment currentAttachment = entry . getValue ( ) ; if ( ! validateAttachment ( currentAttachment ) ) { throw new IOException ( "Attachment is not valid: " + currentAttachment . getAlternateId ( ) ) ; } } return attachments ; } catch ( IOException e ) { throw new IOException ( "Attachments in the given file can not be loaded." ) ; } } | reads the attachments from the given inputstream and returns the attachment db | 213 | 13 |
141,372 | public static boolean validateAttachment ( Attachment currentAttachment ) { try { currentAttachment . getId ( ) ; if ( currentAttachment . getAlternateId ( ) == "null" || currentAttachment . getAlternateId ( ) . isEmpty ( ) ) { return false ; } if ( currentAttachment . getCapGroupName ( ) == "null" || currentAttachment . getCapGroupName ( ) . isEmpty ( ) ) { return false ; } if ( currentAttachment . getCapGroupSMILES ( ) == "null" || currentAttachment . getCapGroupSMILES ( ) . isEmpty ( ) ) { return false ; } if ( currentAttachment . getLabel ( ) . equals ( "null" ) || currentAttachment . getLabel ( ) . equals ( " " ) ) { return false ; } } catch ( Exception e ) { return false ; } return true ; } | validates the current attachment | 196 | 5 |
141,373 | public static void checkAllowedPrivilige ( final JKPrivilige privilige ) { logger . debug ( "checkAllowedPrivilige() : " , privilige ) ; final JKAuthorizer auth = getAuthorizer ( ) ; auth . checkAllowed ( privilige ) ; } | Check allowed privilige . | 66 | 6 |
141,374 | public static boolean matchPassword ( String plain , JKUser user ) { JK . implementMe ( ) ; return JKSecurityUtil . encode ( plain ) . equals ( user . getPassword ( ) ) ; } | Match password . | 46 | 3 |
141,375 | public static JKPrivilige createPrivilige ( String name , JKPrivilige parent , int number ) { logger . trace ( "createPriviligeObject(): Id : " , ".name" , name , ", Parent:[" , parent , "] , " , number ) ; JKPrivilige p = new JKPrivilige ( name , parent , number ) ; p . setDesc ( p . getFullName ( ) ) ; return p ; } | Creates the privilige . | 101 | 7 |
141,376 | public static HELM2Notation readPeptide ( String notation ) throws FastaFormatException , NotationException , ChemistryException { HELM2Notation helm2notation = new HELM2Notation ( ) ; PolymerNotation polymer = new PolymerNotation ( "PEPTIDE1" ) ; helm2notation . addPolymer ( new PolymerNotation ( polymer . getPolymerID ( ) , FastaFormat . generateElementsOfPeptide ( notation , polymer . getPolymerID ( ) ) ) ) ; return helm2notation ; } | method to read a peptide sequence and generate a HELM2Notation object of it | 122 | 18 |
141,377 | public static String getPeptideSequenceFromNotation ( HELM2Notation helm2notation ) throws HELM2HandledException , PeptideUtilsException , org . helm . notation2 . exception . NotationException , ChemistryException { List < PolymerNotation > polymers = helm2notation . getListOfPolymers ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( PolymerNotation polymer : polymers ) { sb . append ( PeptideUtils . getSequence ( polymer ) + " " ) ; } sb . setLength ( sb . length ( ) - 1 ) ; return sb . toString ( ) ; } | method to get for all peptides the sequence | 147 | 9 |
141,378 | public static String getNucleotideNaturalAnalogSequenceFromNotation ( HELM2Notation helm2Notation ) throws NotationException , HELM2HandledException , ChemistryException { List < PolymerNotation > polymers = helm2Notation . getListOfPolymers ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( PolymerNotation polymer : polymers ) { try { sb . append ( RNAUtils . getNaturalAnalogSequence ( polymer ) + " " ) ; } catch ( RNAUtilsException e ) { e . printStackTrace ( ) ; throw new NotationException ( "Input complex notation contains non-nucleid acid polymer" ) ; } } sb . setLength ( sb . length ( ) - 1 ) ; return sb . toString ( ) ; } | method to generate for all rna polymers the natural analogue sequence | 180 | 13 |
141,379 | public static String getPeptideNaturalAnalogSequenceFromNotation ( HELM2Notation helm2Notation ) throws HELM2HandledException , PeptideUtilsException , NotationException , ChemistryException { List < PolymerNotation > polymers = helm2Notation . getListOfPolymers ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( PolymerNotation polymer : polymers ) { if ( ! ( polymer . getPolymerID ( ) instanceof PeptideEntity ) ) { throw new NotationException ( "Input complex notation contains non-peptide polymer(s)" ) ; } sb . append ( PeptideUtils . getNaturalAnalogueSequence ( polymer ) + " " ) ; } sb . setLength ( sb . length ( ) - 1 ) ; return sb . toString ( ) ; } | method to generate for all peptide polymers the natural analogue sequence | 190 | 13 |
141,380 | public static void setDefaultExecutor ( Executor executor ) { Class < ? > c = null ; Field field = null ; try { c = Class . forName ( "android.os.AsyncTask" ) ; field = c . getDeclaredField ( "sDefaultExecutor" ) ; field . setAccessible ( true ) ; field . set ( null , executor ) ; field . setAccessible ( false ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; Log . e ( "IllegalArgumentException" , e ) ; } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; Log . e ( "ClassNotFoundException" , e ) ; } catch ( NoSuchFieldException e ) { e . printStackTrace ( ) ; Log . e ( "NoSuchFieldException" , e ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; Log . e ( "IllegalAccessException" , e ) ; } } | set the default Executor | 225 | 5 |
141,381 | public static Executor getDefaultExecutor ( ) { Executor exec = null ; Class < ? > c = null ; Field field = null ; try { c = Class . forName ( "android.os.AsyncTask" ) ; field = c . getDeclaredField ( "sDefaultExecutor" ) ; field . setAccessible ( true ) ; exec = ( Executor ) field . get ( null ) ; field . setAccessible ( false ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; Log . e ( "IllegalArgumentException" , e ) ; } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; Log . e ( "ClassNotFoundException" , e ) ; } catch ( NoSuchFieldException e ) { e . printStackTrace ( ) ; Log . e ( "NoSuchFieldException" , e ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; Log . e ( "IllegalAccessException" , e ) ; } return exec ; } | get the default Executor | 234 | 5 |
141,382 | public static Nucleotide convertToNucleotide ( String id , boolean last ) throws MonomerException , org . helm . notation2 . exception . NotationException , ChemistryException , NucleotideLoadingException , NotationException { Map < String , String > reverseNucMap = NucleotideFactory . getInstance ( ) . getReverseNucleotideTemplateMap ( ) ; // last nucleotide will be handled differently String tmpNotation = id ; String symbol = null ; // if (i == (notations.length - 1) && notation.endsWith(")")) { if ( last && id . endsWith ( ")" ) ) { tmpNotation = id + "P" ; } if ( reverseNucMap . containsKey ( tmpNotation ) ) { symbol = reverseNucMap . get ( tmpNotation ) ; } else { char [ ] chars = id . toCharArray ( ) ; String base = null ; symbol = "X" ; // find base for ( int j = 0 ; j < chars . length ; j ++ ) { char letter = chars [ j ] ; // skip modifications if not in branch if ( letter == MODIFICATION_START_SYMBOL ) { int matchingPos = NucleotideParser . getMatchingBracketPosition ( chars , j , MODIFICATION_START_SYMBOL , MODIFICATION_END_SYMBOL ) ; j ++ ; if ( matchingPos == - 1 ) { throw new NotationException ( "Invalid Polymer Notation: Could not find matching bracket" ) ; } j = matchingPos ; } // base is always a branch monomer else if ( letter == BRANCH_START_SYMBOL ) { int matchingPos = NucleotideParser . getMatchingBracketPosition ( chars , j , BRANCH_START_SYMBOL , BRANCH_END_SYMBOL ) ; j ++ ; if ( matchingPos == - 1 ) { throw new NotationException ( "Invalid Polymer Notation: Could not find matching bracket" ) ; } base = id . substring ( j , matchingPos ) ; if ( base . length ( ) == 1 ) { symbol = base ; } else { Monomer monomer = MethodsMonomerUtils . getMonomer ( "RNA" , base , "" ) ; if ( null == monomer . getNaturalAnalog ( ) ) { symbol = "X" ; } else { symbol = monomer . getNaturalAnalog ( ) ; } } j = matchingPos ; } } } Nucleotide nuc = new Nucleotide ( symbol , id ) ; return nuc ; } | method to convert an string to an nucleotide | 562 | 9 |
141,383 | public static boolean validateSimpleNotationForRNA ( String polymerNotation ) throws org . helm . notation2 . parser . exceptionparser . NotationException { getMonomerIDListFromNucleotide ( polymerNotation ) ; return true ; } | validate RNA simple notation | 52 | 5 |
141,384 | @ Override public void dragged ( IEventMotion e ) { if ( paletteDiagram . getSelectedCommand ( ) == ECommands . SELECT . toString ( ) ) { if ( ! itWasDragging ) { itWasDragging = asmDiagramUml . tryToDragging ( e . getX ( ) , e . getY ( ) ) ; } else { asmDiagramUml . tryToDragging ( e . getX ( ) , e . getY ( ) ) ; } } } | Move an UML element or change path of a relation | 112 | 11 |
141,385 | public static HELM2Notation generatePeptidePolymersFromFASTAFormatHELM1 ( String fasta ) throws FastaFormatException , ChemistryException { helm2notation = new HELM2Notation ( ) ; if ( null == fasta ) { LOG . error ( "Peptide Sequence must be specified" ) ; throw new FastaFormatException ( "Peptide Sequence must be specified" ) ; } initMapAminoAcid ( ) ; StringBuilder elements = new StringBuilder ( ) ; int counter = 0 ; PolymerNotation polymer ; try { polymer = new PolymerNotation ( "PEPTIDE" + "1" ) ; } catch ( org . helm . notation2 . parser . exceptionparser . NotationException e ) { e . printStackTrace ( ) ; throw new FastaFormatException ( e . getMessage ( ) ) ; } String annotation = "" ; for ( String line : fasta . split ( "\n" ) ) { if ( line . startsWith ( ">" ) ) { counter ++ ; if ( counter > 1 ) { helm2notation . addPolymer ( new PolymerNotation ( polymer . getPolymerID ( ) , generateElementsOfPeptide ( elements . toString ( ) , polymer . getPolymerID ( ) ) , annotation ) ) ; elements = new StringBuilder ( ) ; try { polymer = new PolymerNotation ( "PEPTIDE" + counter ) ; } catch ( org . helm . notation2 . parser . exceptionparser . NotationException e ) { e . printStackTrace ( ) ; throw new FastaFormatException ( e . getMessage ( ) ) ; } } annotation = line . substring ( 1 ) ; } else { line = cleanup ( line ) ; elements . append ( line ) ; } } helm2notation . addPolymer ( new PolymerNotation ( polymer . getPolymerID ( ) , generateElementsOfPeptide ( elements . toString ( ) , polymer . getPolymerID ( ) ) , annotation ) ) ; return helm2notation ; } | method to read the information from a FastaFile - Format + generate peptide polymers be careful it produces only polymers in the HELM1 standard no ambiguity | 447 | 33 |
141,386 | private static void initMapNucleotides ( ) throws FastaFormatException { try { nucleotides = NucleotideFactory . getInstance ( ) . getNucleotideTemplates ( ) . get ( "HELM Notation" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; LOG . error ( "NucleotideFactory can not be initialized" ) ; throw new FastaFormatException ( e . getMessage ( ) ) ; } } | method to initialize map of existing nucleotides in the database | 103 | 12 |
141,387 | private static void initMapTransformNucleotides ( ) { transformNucleotides = new HashMap < String , String > ( ) ; for ( Map . Entry e : nucleotides . entrySet ( ) ) { transformNucleotides . put ( e . getValue ( ) . toString ( ) , e . getKey ( ) . toString ( ) ) ; } } | method to initialize map of transform nucleotides | 82 | 9 |
141,388 | private static void initMapNucleotidesNaturalAnalog ( ) throws FastaFormatException , ChemistryException { try { nucleotidesNaturalAnalog = MonomerFactory . getInstance ( ) . getMonomerDB ( ) . get ( "RNA" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; LOG . error ( "Nucleotides can not be initialized" ) ; throw new FastaFormatException ( e . getMessage ( ) ) ; } } | method to initialize map of existing nucleotides with the natural analog sequence in the database | 106 | 17 |
141,389 | private static void initMapAminoAcid ( ) throws FastaFormatException , ChemistryException { try { aminoacids = MonomerFactory . getInstance ( ) . getMonomerDB ( ) . get ( "PEPTIDE" ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; LOG . error ( "AminoAcids can not be initialized" ) ; throw new FastaFormatException ( e . getMessage ( ) ) ; } } | method to initialize map of existing amino acids in the database | 105 | 11 |
141,390 | protected static String generateFastaFromPeptide ( List < Monomer > monomers ) { StringBuilder fasta = new StringBuilder ( ) ; for ( Monomer monomer : monomers ) { fasta . append ( monomer . getNaturalAnalog ( ) ) ; } return fasta . toString ( ) ; } | method to generate Fasta for a list of peptide monomers | 69 | 13 |
141,391 | public static String generateFastaFromRNAPolymer ( List < PolymerNotation > polymers ) throws FastaFormatException , ChemistryException { StringBuilder fasta = new StringBuilder ( ) ; for ( PolymerNotation polymer : polymers ) { String header = polymer . getPolymerID ( ) . getId ( ) ; if ( polymer . getAnnotation ( ) != null ) { header = polymer . getAnnotation ( ) ; } fasta . append ( ">" + header + "\n" ) ; try { fasta . append ( generateFastaFromRNA ( MethodsMonomerUtils . getListOfHandledMonomers ( polymer . getListMonomers ( ) ) ) + "\n" ) ; } catch ( HELM2HandledException e ) { e . printStackTrace ( ) ; throw new FastaFormatException ( e . getMessage ( ) ) ; } } return fasta . toString ( ) ; } | method to generate Fasta for rna polymers | 204 | 10 |
141,392 | protected static String generateFastaFromRNA ( List < Monomer > monomers ) { StringBuilder fasta = new StringBuilder ( ) ; for ( Monomer monomer : monomers ) { if ( monomer . getMonomerType ( ) . equals ( Monomer . BRANCH_MOMONER_TYPE ) ) { fasta . append ( monomer . getNaturalAnalog ( ) ) ; } } return fasta . toString ( ) ; } | method to generate Fasta for a list of rna monomers | 99 | 13 |
141,393 | public static String generateFasta ( HELM2Notation helm2Notation2 ) throws FastaFormatException , ChemistryException { List < PolymerNotation > polymersPeptides = new ArrayList < PolymerNotation > ( ) ; List < PolymerNotation > polymerNucleotides = new ArrayList < PolymerNotation > ( ) ; StringBuilder fasta = new StringBuilder ( ) ; for ( PolymerNotation polymer : helm2Notation2 . getListOfPolymers ( ) ) { if ( polymer . getPolymerID ( ) instanceof RNAEntity ) { polymerNucleotides . add ( polymer ) ; } if ( polymer . getPolymerID ( ) instanceof PeptideEntity ) { polymersPeptides . add ( polymer ) ; } } fasta . append ( generateFastaFromPeptidePolymer ( polymersPeptides ) ) ; fasta . append ( generateFastaFromRNAPolymer ( polymerNucleotides ) ) ; return fasta . toString ( ) ; } | method to generate for the whole HELM2Notation fasta - files it contains fasta for all rna and peptides | 225 | 26 |
141,394 | public static HELM2Notation convertIntoAnalogSequence ( HELM2Notation helm2Notation ) throws FastaFormatException , AnalogSequenceException , ChemistryException , CTKException { initMapAminoAcid ( ) ; initMapNucleotides ( ) ; initMapNucleotidesNaturalAnalog ( ) ; initMapTransformNucleotides ( ) ; /* * transform/convert only the peptides + rnas into the analog sequence */ List < PolymerNotation > polymers = helm2Notation . getListOfPolymers ( ) ; for ( int i = 0 ; i < helm2Notation . getListOfPolymers ( ) . size ( ) ; i ++ ) { if ( helm2Notation . getListOfPolymers ( ) . get ( i ) . getPolymerID ( ) instanceof RNAEntity ) { helm2Notation . getListOfPolymers ( ) . set ( i , convertRNAIntoAnalogSequence ( polymers . get ( i ) ) ) ; } if ( helm2Notation . getListOfPolymers ( ) . get ( i ) . getPolymerID ( ) instanceof PeptideEntity ) { helm2Notation . getListOfPolymers ( ) . set ( i , convertPeptideIntoAnalogSequence ( polymers . get ( i ) ) ) ; } } return helm2Notation ; } | method to convert all Peptides and RNAs into the natural analogue sequence and generates HELM2Notation | 305 | 22 |
141,395 | private static PolymerNotation convertPeptideIntoAnalogSequence ( PolymerNotation polymer ) throws AnalogSequenceException { for ( int i = 0 ; i < polymer . getPolymerElements ( ) . getListOfElements ( ) . size ( ) ; i ++ ) { /* Change current MonomerNotation */ polymer . getPolymerElements ( ) . getListOfElements ( ) . set ( i , generateMonomerNotationPeptide ( polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( i ) ) ) ; } return polymer ; } | method to convert the sequence of a PolymerNotation into the natural analogue sequence | 134 | 16 |
141,396 | private static MonomerNotation generateMonomerNotationRNA ( MonomerNotation current ) throws AnalogSequenceException { MonomerNotation change = null ; try { /* simple MonomerNotationUnit */ if ( current instanceof MonomerNotationUnit ) { change = new MonomerNotationUnit ( changeIdForRNA ( current ) , current . getType ( ) ) ; } else if ( current instanceof MonomerNotationGroup ) { if ( current instanceof MonomerNotationGroupOr ) { StringBuilder sb = new StringBuilder ( ) ; for ( MonomerNotationGroupElement element : ( ( MonomerNotationGroup ) current ) . getListOfElements ( ) ) { sb . append ( changeIdForRNA ( element . getMonomerNotation ( ) ) + "," ) ; } sb . setLength ( sb . length ( ) - 1 ) ; change = new MonomerNotationGroupOr ( sb . toString ( ) , current . getType ( ) ) ; } else if ( current instanceof MonomerNotationGroupMixture ) { StringBuilder sb = new StringBuilder ( ) ; for ( MonomerNotationGroupElement element : ( ( MonomerNotationGroup ) current ) . getListOfElements ( ) ) { sb . append ( changeIdForRNA ( element . getMonomerNotation ( ) ) + "+" ) ; } sb . setLength ( sb . length ( ) - 1 ) ; change = new MonomerNotationGroupMixture ( sb . toString ( ) , current . getType ( ) ) ; } else { /* throw new exception */ throw new AnalogSequenceException ( "Unknown MonomerNotationGroup " + current . getClass ( ) ) ; } } else if ( current instanceof MonomerNotationList ) { StringBuilder sb = new StringBuilder ( ) ; for ( MonomerNotation element : ( ( MonomerNotationList ) current ) . getListofMonomerUnits ( ) ) { sb . append ( changeIdForRNA ( element ) + "." ) ; } sb . setLength ( sb . length ( ) - 1 ) ; change = new MonomerNotationList ( sb . toString ( ) , current . getType ( ) ) ; } else { /* throw new exception */ throw new AnalogSequenceException ( "Unknown MonomerNotation " + current . getClass ( ) ) ; } change . setCount ( current . getCount ( ) ) ; if ( current . getAnnotation ( ) != null ) { change . setAnnotation ( current . getAnnotation ( ) ) ; } return change ; } catch ( NotationException e ) { e . printStackTrace ( ) ; throw new AnalogSequenceException ( "Notation object can not be built" ) ; } } | method to change the MonomerNotation in its analogue | 608 | 11 |
141,397 | private static PolymerNotation convertRNAIntoAnalogSequence ( PolymerNotation polymer ) throws AnalogSequenceException { /* change only if it is possible */ for ( int i = 0 ; i < polymer . getPolymerElements ( ) . getListOfElements ( ) . size ( ) ; i ++ ) { polymer . getPolymerElements ( ) . getListOfElements ( ) . set ( i , generateMonomerNotationRNA ( polymer . getPolymerElements ( ) . getListOfElements ( ) . get ( i ) ) ) ; } return polymer ; } | method to generate the sequence of a rna PolymerNotation into its natural analogue sequence | 130 | 18 |
141,398 | private static String changeIdForRNA ( MonomerNotation monomerNotation ) { if ( monomerNotation instanceof MonomerNotationUnitRNA ) { StringBuilder changeid = new StringBuilder ( ) ; for ( MonomerNotation not : ( ( MonomerNotationUnitRNA ) monomerNotation ) . getContents ( ) ) { Monomer monomer = nucleotidesNaturalAnalog . get ( not . getUnit ( ) . replace ( "[" , "" ) . replace ( "]" , "" ) ) ; String id = monomer . getNaturalAnalog ( ) ; if ( monomer . getMonomerType ( ) . equals ( Monomer . BRANCH_MOMONER_TYPE ) ) { id = "(" + id + ")" ; } changeid . append ( id ) ; } return changeid . toString ( ) ; } else { Monomer monomer = nucleotidesNaturalAnalog . get ( monomerNotation . getUnit ( ) . replace ( "[" , "" ) . replace ( "]" , "" ) ) ; String id = monomer . getNaturalAnalog ( ) ; if ( monomer . getMonomerType ( ) . equals ( Monomer . BRANCH_MOMONER_TYPE ) ) { id = "(" + id + ")" ; } return id ; } } | method to get the natural analogue sequence of a MonomerNotation | 289 | 13 |
141,399 | private boolean checkHostPart ( final String label , final Problems problems , final String compName ) { boolean result = true ; if ( label . length ( ) > 63 ) { problems . add ( ValidationBundle . getMessage ( HostNameValidator . class , "LABEL_TOO_LONG" , label ) ) ; // NOI18N result = false ; } if ( label . length ( ) == 0 ) { problems . add ( ValidationBundle . getMessage ( HostNameValidator . class , "LABEL_EMPTY" , compName , label ) ) ; // NOI18N } if ( result ) { try { Integer . parseInt ( label ) ; problems . add ( ValidationBundle . getMessage ( HostNameValidator . class , "NUMBER_PART_IN_HOSTNAME" , label ) ) ; // NOI18N result = false ; } catch ( final NumberFormatException e ) { // do nothing } if ( result ) { if ( result ) { result = new EncodableInCharsetValidator ( ) . validate ( problems , compName , label ) ; if ( result ) { for ( final char c : label . toLowerCase ( ) . toCharArray ( ) ) { if ( c >= ' ' && c <= ' ' || c >= ' ' && c <= ' ' || c == ' ' ) { // NOI18N continue ; } problems . add ( ValidationBundle . getMessage ( HostNameValidator . class , "BAD_CHAR_IN_HOSTNAME" , new String ( new char [ ] { c } ) ) ) ; // NOI18N result = false ; } } } } } return result ; } | Check host part . | 366 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.