repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/Nucleotide.java
Nucleotide.unmodifiedWithoutPhosphate
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; } } }
java
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; } } }
[ "public", "boolean", "unmodifiedWithoutPhosphate", "(", ")", "{", "if", "(", "getNotation", "(", ")", "==", "null", ")", "{", "return", "true", ";", "}", "else", "{", "// System.out.println(\"Contains [ \" + getNotation().contains(\"[\") +", "// \"\\tContainsX \" + getNot...
Returns true if the nucleotide is unmodified except for a missing phosphate group. If the nucleotide notation is empty, it returns true. @return true or false
[ "Returns", "true", "if", "the", "nucleotide", "is", "unmodified", "except", "for", "a", "missing", "phosphate", "group", ".", "If", "the", "nucleotide", "notation", "is", "empty", "it", "returns", "true", "." ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Nucleotide.java#L121-L133
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/Nucleotide.java
Nucleotide.getBaseMonomer
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; } }
java
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; } }
[ "public", "Monomer", "getBaseMonomer", "(", "MonomerStore", "monomerStore", ")", "{", "String", "baseSymbol", "=", "getBaseSymbol", "(", ")", ";", "if", "(", "baseSymbol", "!=", "null", "&&", "!", "baseSymbol", ".", "equalsIgnoreCase", "(", "\"\"", ")", ")", ...
get the base monomer, the return value could be null if this nucleotide does not have a base @param monomerStore - store in which base monomer is located @return base monomer, could be null
[ "get", "the", "base", "monomer", "the", "return", "value", "could", "be", "null", "if", "this", "nucleotide", "does", "not", "have", "a", "base" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Nucleotide.java#L287-L304
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/Nucleotide.java
Nucleotide.getSugarMonomer
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; } }
java
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; } }
[ "public", "Monomer", "getSugarMonomer", "(", "MonomerStore", "monomerStore", ")", "{", "String", "sugarSymbol", "=", "getSugarSymbol", "(", ")", ";", "if", "(", "sugarSymbol", "!=", "null", "&&", "!", "sugarSymbol", ".", "equalsIgnoreCase", "(", "\"\"", ")", "...
get the sugar monomer, the return value could be null if the "nucleotide" does not has a sugar @param monomerStore - store in which sugar monomer is located @return sugar monomer
[ "get", "the", "sugar", "monomer", "the", "return", "value", "could", "be", "null", "if", "the", "nucleotide", "does", "not", "has", "a", "sugar" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Nucleotide.java#L329-L344
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/Nucleotide.java
Nucleotide.getLinkerNotation
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; }
java
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; }
[ "public", "String", "getLinkerNotation", "(", ")", "{", "String", "pSymbol", "=", "getPhosphateSymbol", "(", ")", ";", "String", "result", "=", "null", ";", "if", "(", "null", "==", "pSymbol", "||", "pSymbol", ".", "length", "(", ")", "==", "0", ")", "...
This method returns the HELM notation for nucleotide linker @return linker notation
[ "This", "method", "returns", "the", "HELM", "notation", "for", "nucleotide", "linker" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Nucleotide.java#L351-L363
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/Nucleotide.java
Nucleotide.getNucleosideNotation
public String getNucleosideNotation() { int linkerLen = getLinkerNotation().length(); return notation.substring(0, notation.length() - linkerLen); }
java
public String getNucleosideNotation() { int linkerLen = getLinkerNotation().length(); return notation.substring(0, notation.length() - linkerLen); }
[ "public", "String", "getNucleosideNotation", "(", ")", "{", "int", "linkerLen", "=", "getLinkerNotation", "(", ")", ".", "length", "(", ")", ";", "return", "notation", ".", "substring", "(", "0", ",", "notation", ".", "length", "(", ")", "-", "linkerLen", ...
This method returns the HELM notation for nucleoside @return nucleodie notation
[ "This", "method", "returns", "the", "HELM", "notation", "for", "nucleoside" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/Nucleotide.java#L370-L373
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerStore.java
MonomerStore.addMonomer
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); } }
java
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); } }
[ "public", "void", "addMonomer", "(", "Monomer", "monomer", ",", "boolean", "dbChanged", ")", "throws", "IOException", ",", "MonomerException", "{", "Map", "<", "String", ",", "Monomer", ">", "monomerMap", "=", "monomerDB", ".", "get", "(", "monomer", ".", "g...
Adds a monomer to the store and optionally sets the dbChanged flag @param monomer given monomer @param dbChanged if db was changed @throws IOException if the monomer store can not be saved @throws MonomerException if the monomer is not valid
[ "Adds", "a", "monomer", "to", "the", "store", "and", "optionally", "sets", "the", "dbChanged", "flag" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerStore.java#L87-L131
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerStore.java
MonomerStore.hasMonomer
public boolean hasMonomer(String polymerType, String alternateId) { return ((monomerDB.get(polymerType) != null) && getMonomer(polymerType, alternateId) != null); }
java
public boolean hasMonomer(String polymerType, String alternateId) { return ((monomerDB.get(polymerType) != null) && getMonomer(polymerType, alternateId) != null); }
[ "public", "boolean", "hasMonomer", "(", "String", "polymerType", ",", "String", "alternateId", ")", "{", "return", "(", "(", "monomerDB", ".", "get", "(", "polymerType", ")", "!=", "null", ")", "&&", "getMonomer", "(", "polymerType", ",", "alternateId", ")",...
Checks if a specific monomer exists in the store @param polymerType polymer type of monomer @param alternateId alternateId of monomer @return true if monomer exists, false if not
[ "Checks", "if", "a", "specific", "monomer", "exists", "in", "the", "store" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerStore.java#L140-L142
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerStore.java
MonomerStore.getMonomer
public Monomer getMonomer(String polymerType, String alternateId) { Map<String, Monomer> map1 = monomerDB.get(polymerType); //alternateId = alternateId.toUpperCase(); return monomerDB.get(polymerType).get(alternateId); }
java
public Monomer getMonomer(String polymerType, String alternateId) { Map<String, Monomer> map1 = monomerDB.get(polymerType); //alternateId = alternateId.toUpperCase(); return monomerDB.get(polymerType).get(alternateId); }
[ "public", "Monomer", "getMonomer", "(", "String", "polymerType", ",", "String", "alternateId", ")", "{", "Map", "<", "String", ",", "Monomer", ">", "map1", "=", "monomerDB", ".", "get", "(", "polymerType", ")", ";", "//alternateId = alternateId.toUpperCase();\r", ...
Returns the monomer specified by polymerType and alternatId @param polymerType polymer type of monomer @param alternateId alternateId of monomer @return the matching monomer
[ "Returns", "the", "monomer", "specified", "by", "polymerType", "and", "alternatId" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerStore.java#L151-L155
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerStore.java
MonomerStore.addNewMonomer
public synchronized void addNewMonomer(Monomer monomer) throws IOException, MonomerException { monomer.setNewMonomer(true); addMonomer(monomer, true); }
java
public synchronized void addNewMonomer(Monomer monomer) throws IOException, MonomerException { monomer.setNewMonomer(true); addMonomer(monomer, true); }
[ "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 @param monomer given monomer @throws IOException if the monomer can not be saved @throws MonomerException if the monomer is not valid
[ "Adds", "a", "monomer", "to", "the", "store", "and", "makes", "it", "a", "temporary", "new", "monomer" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerStore.java#L184-L188
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerStore.java
MonomerStore.getAllMonomersList
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; }
java
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; }
[ "public", "List", "<", "Monomer", ">", "getAllMonomersList", "(", ")", "{", "List", "<", "Monomer", ">", "monomers", "=", "new", "ArrayList", "<", "Monomer", ">", "(", ")", ";", "for", "(", "String", "polymerType", ":", "getPolymerTypeSet", "(", ")", ")"...
This method returns all monomers of the store as list sorted by polymer type @return all monomers of store as {@code List<{@link Monomer}>}
[ "This", "method", "returns", "all", "monomers", "of", "the", "store", "as", "list", "sorted", "by", "polymer", "type" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerStore.java#L236-L244
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addAnnotation
public final static void addAnnotation(final AnnotationNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfAnnotations().add(position, notation); }
java
public final static void addAnnotation(final AnnotationNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfAnnotations().add(position, notation); }
[ "public", "final", "static", "void", "addAnnotation", "(", "final", "AnnotationNotation", "notation", ",", "final", "int", "position", ",", "final", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfAnnotations", "(", ")", ".", "add", "("...
method to add an annotation at a specific position of the HELM2Notation @param notation new annotation @param position position of the new annotation @param helm2notation input HELM2Notation
[ "method", "to", "add", "an", "annotation", "at", "a", "specific", "position", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L73-L76
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.changeAnnotation
public final static void changeAnnotation(final AnnotationNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfAnnotations().set(position, notation); }
java
public final static void changeAnnotation(final AnnotationNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfAnnotations().set(position, notation); }
[ "public", "final", "static", "void", "changeAnnotation", "(", "final", "AnnotationNotation", "notation", ",", "final", "int", "position", ",", "final", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfAnnotations", "(", ")", ".", "set", ...
method to change an annotation at the position of the HELM2Notation @param notation new changed annotation @param position position of the changed annotation @param helm2notation input HELM2Notation
[ "method", "to", "change", "an", "annotation", "at", "the", "position", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L88-L91
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addConnection
public final static void addConnection(final ConnectionNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfConnections().add(position, notation); }
java
public final static void addConnection(final ConnectionNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfConnections().add(position, notation); }
[ "public", "final", "static", "void", "addConnection", "(", "final", "ConnectionNotation", "notation", ",", "final", "int", "position", ",", "final", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfConnections", "(", ")", ".", "add", "("...
method to add a new connection at the position of the HELM2Notation @param notation new ConnectionNotation @param position position of the new ConnectionNotation @param helm2notation input HELM2Notation
[ "method", "to", "add", "a", "new", "connection", "at", "the", "position", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L126-L129
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.changeConnection
public final static void changeConnection(final int position, final ConnectionNotation notation, final HELM2Notation helm2notation) { helm2notation.getListOfConnections().set(position, notation); }
java
public final static void changeConnection(final int position, final ConnectionNotation notation, final HELM2Notation helm2notation) { helm2notation.getListOfConnections().set(position, notation); }
[ "public", "final", "static", "void", "changeConnection", "(", "final", "int", "position", ",", "final", "ConnectionNotation", "notation", ",", "final", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfConnections", "(", ")", ".", "set", ...
method to change a connection at the position of the HELM2Notation @param position position of the changed Connection @param notation to be changed ConnectionNotation @param helm2notation input HELM2Notation
[ "method", "to", "change", "a", "connection", "at", "the", "position", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L141-L144
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addAnnotationToConnection
public final static void addAnnotationToConnection(final int position, final String annotation, final HELM2Notation helm2notation) { helm2notation.getListOfConnections().get(position).setAnnotation(annotation); }
java
public final static void addAnnotationToConnection(final int position, final String annotation, final HELM2Notation helm2notation) { helm2notation.getListOfConnections().get(position).setAnnotation(annotation); }
[ "public", "final", "static", "void", "addAnnotationToConnection", "(", "final", "int", "position", ",", "final", "String", "annotation", ",", "final", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfConnections", "(", ")", ".", "get", "...
method to add an annotation to a connection of the HELM2Notation @param position position of the connection @param annotation new annotation @param helm2notation input HELM2Notation
[ "method", "to", "add", "an", "annotation", "to", "a", "connection", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L169-L172
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addGroup
public final static void addGroup(final GroupingNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfGroupings().add(position, notation); }
java
public final static void addGroup(final GroupingNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfGroupings().add(position, notation); }
[ "public", "final", "static", "void", "addGroup", "(", "final", "GroupingNotation", "notation", ",", "final", "int", "position", ",", "final", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfGroupings", "(", ")", ".", "add", "(", "posi...
method to add a group to the grouping section of the HELM2Notation @param notation new group @param position position of the new group @param helm2notation input HELM2Notation
[ "method", "to", "add", "a", "group", "to", "the", "grouping", "section", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L194-L197
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.changeGroup
public final static void changeGroup(final GroupingNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfGroupings().set(position, notation); }
java
public final static void changeGroup(final GroupingNotation notation, final int position, final HELM2Notation helm2notation) { helm2notation.getListOfGroupings().set(position, notation); }
[ "public", "final", "static", "void", "changeGroup", "(", "final", "GroupingNotation", "notation", ",", "final", "int", "position", ",", "final", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfGroupings", "(", ")", ".", "set", "(", "p...
method to change a group of the HELM2Notation @param notation new group @param position position of the to be changed group @param helm2notation input HELM2Notation
[ "method", "to", "change", "a", "group", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L209-L212
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addAnnotationToPolymer
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); }
java
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); }
[ "public", "final", "static", "PolymerNotation", "addAnnotationToPolymer", "(", "final", "PolymerNotation", "polymer", ",", "final", "String", "annotation", ")", "{", "if", "(", "polymer", ".", "getAnnotation", "(", ")", "!=", "null", ")", "{", "return", "new", ...
method to add an annotation to a PolymerNotation @param polymer PolymerNotation @param annotation new annotation @return PolymerNotation with the annotation
[ "method", "to", "add", "an", "annotation", "to", "a", "PolymerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L245-L251
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.removeAnnotationOfPolmyer
public final static PolymerNotation removeAnnotationOfPolmyer(PolymerNotation polymer) { return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), null); }
java
public final static PolymerNotation removeAnnotationOfPolmyer(PolymerNotation polymer) { return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), null); }
[ "public", "final", "static", "PolymerNotation", "removeAnnotationOfPolmyer", "(", "PolymerNotation", "polymer", ")", "{", "return", "new", "PolymerNotation", "(", "polymer", ".", "getPolymerID", "(", ")", ",", "polymer", ".", "getPolymerElements", "(", ")", ",", "...
method to remove a current annotation of a PolymerNotation @param polymer PolymerNotation @return PolymerNotation with no annotation
[ "method", "to", "remove", "a", "current", "annotation", "of", "a", "PolymerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L260-L262
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addMonomerNotation
public final static PolymerNotation addMonomerNotation(int position, PolymerNotation polymer, MonomerNotation monomerNotation) { polymer.getPolymerElements().getListOfElements().add(position, monomerNotation); return polymer; }
java
public final static PolymerNotation addMonomerNotation(int position, PolymerNotation polymer, MonomerNotation monomerNotation) { polymer.getPolymerElements().getListOfElements().add(position, monomerNotation); return polymer; }
[ "public", "final", "static", "PolymerNotation", "addMonomerNotation", "(", "int", "position", ",", "PolymerNotation", "polymer", ",", "MonomerNotation", "monomerNotation", ")", "{", "polymer", ".", "getPolymerElements", "(", ")", ".", "getListOfElements", "(", ")", ...
method to add a new MonomerNotation to a PolymerNotation @param position position of the new MonomerNotation @param polymer PolymerNotation @param monomerNotation new MonomerNotation @return PolymerNotation with the new MonomerNotation
[ "method", "to", "add", "a", "new", "MonomerNotation", "to", "a", "PolymerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L275-L279
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.changeMonomerNotation
public final static void changeMonomerNotation(int position, PolymerNotation polymer, MonomerNotation not) { polymer.getPolymerElements().getListOfElements().set(position, not); }
java
public final static void changeMonomerNotation(int position, PolymerNotation polymer, MonomerNotation not) { polymer.getPolymerElements().getListOfElements().set(position, not); }
[ "public", "final", "static", "void", "changeMonomerNotation", "(", "int", "position", ",", "PolymerNotation", "polymer", ",", "MonomerNotation", "not", ")", "{", "polymer", ".", "getPolymerElements", "(", ")", ".", "getListOfElements", "(", ")", ".", "set", "(",...
method to change the MonomerNotation on the specific position @param position position of the changed MonomerNotation @param polymer PolymerNotation @param not changed MonomerNotation
[ "method", "to", "change", "the", "MonomerNotation", "on", "the", "specific", "position" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L291-L293
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.deleteMonomerNotation
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); }
java
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); }
[ "public", "final", "static", "void", "deleteMonomerNotation", "(", "int", "position", ",", "PolymerNotation", "polymer", ")", "throws", "NotationException", "{", "MonomerNotation", "monomerNotation", "=", "polymer", ".", "getPolymerElements", "(", ")", ".", "getListOf...
method to delete a MonomerNotation at a specific position of the PolymerNotation @param position position of the to be deleted MonomerNotation @param polymer PolymerNotation @throws NotationException if the generated PolymerNotation has no elements after deleting the MonomerNotation
[ "method", "to", "delete", "a", "MonomerNotation", "at", "a", "specific", "position", "of", "the", "PolymerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L307-L314
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addAnnotationToMonomerNotation
public final static void addAnnotationToMonomerNotation(PolymerNotation polymer, int position, String annotation) { polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(annotation); }
java
public final static void addAnnotationToMonomerNotation(PolymerNotation polymer, int position, String annotation) { polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(annotation); }
[ "public", "final", "static", "void", "addAnnotationToMonomerNotation", "(", "PolymerNotation", "polymer", ",", "int", "position", ",", "String", "annotation", ")", "{", "polymer", ".", "getPolymerElements", "(", ")", ".", "getListOfElements", "(", ")", ".", "get",...
method to add an annotation to a MonomerNotation @param polymer PolymerNotation @param position position of the monomerNotation @param annotation new annotation
[ "method", "to", "add", "an", "annotation", "to", "a", "MonomerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L326-L328
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addCountToMonomerNotation
public final static void addCountToMonomerNotation(PolymerNotation polymer, int position, String count) { polymer.getPolymerElements().getListOfElements().get(position).setCount(count); }
java
public final static void addCountToMonomerNotation(PolymerNotation polymer, int position, String count) { polymer.getPolymerElements().getListOfElements().get(position).setCount(count); }
[ "public", "final", "static", "void", "addCountToMonomerNotation", "(", "PolymerNotation", "polymer", ",", "int", "position", ",", "String", "count", ")", "{", "polymer", ".", "getPolymerElements", "(", ")", ".", "getListOfElements", "(", ")", ".", "get", "(", ...
method to set the count of a MonomerNotation @param polymer PolymerNotation @param position position of the MonomerNotation @param count new count of the MonomerNotation
[ "method", "to", "set", "the", "count", "of", "a", "MonomerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L340-L342
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.deleteAnnotationFromMonomerNotation
public final static void deleteAnnotationFromMonomerNotation(PolymerNotation polymer, int position) { polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(null); }
java
public final static void deleteAnnotationFromMonomerNotation(PolymerNotation polymer, int position) { polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(null); }
[ "public", "final", "static", "void", "deleteAnnotationFromMonomerNotation", "(", "PolymerNotation", "polymer", ",", "int", "position", ")", "{", "polymer", ".", "getPolymerElements", "(", ")", ".", "getListOfElements", "(", ")", ".", "get", "(", "position", ")", ...
method to delete the annotation of a MonomerNotation @param polymer PolymerNotation @param position position of the MonomerNotation
[ "method", "to", "delete", "the", "annotation", "of", "a", "MonomerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L352-L354
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.changePolymerNotation
public final static void changePolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().set(position, polymer); }
java
public final static void changePolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().set(position, polymer); }
[ "public", "final", "static", "void", "changePolymerNotation", "(", "int", "position", ",", "PolymerNotation", "polymer", ",", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfPolymers", "(", ")", ".", "set", "(", "position", ",", "polyme...
method to change the PolymerNotation at a specific position of the HELM2Notation @param position position of the PolymerNotation @param polymer new PolymerNotation @param helm2notation input HELM2Notation
[ "method", "to", "change", "the", "PolymerNotation", "at", "a", "specific", "position", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L380-L382
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addPolymerNotation
public final static void addPolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().add(position, polymer); }
java
public final static void addPolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().add(position, polymer); }
[ "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 @param position position of the PolymerNotation @param polymer new PolymerNotation @param helm2notation input HELM2Notation
[ "method", "to", "add", "a", "PolymerNotation", "at", "a", "specific", "position", "of", "the", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L410-L412
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.replaceMonomer
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); } } } } }
java
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); } } } } }
[ "public", "final", "static", "void", "replaceMonomer", "(", "HELM2Notation", "helm2notation", ",", "String", "polymerType", ",", "String", "existingMonomerID", ",", "String", "newMonomerID", ")", "throws", "NotationException", ",", "MonomerException", ",", "ChemistryExc...
method to replace the MonomerID with the new MonomerID for a given polymer type @param helm2notation HELM2Notation @param polymerType String of the polymer type @param existingMonomerID old MonomerID @param newMonomerID new MonomerID @throws NotationException if notation was not valid @throws MonomerException if monomer is not valid @throws ChemistryException if chemistry engine could not be initialized @throws CTKException general ChemToolKit exception passed to HELMToolKit @throws IOException IO error @throws JDOMException jdome error
[ "method", "to", "replace", "the", "MonomerID", "with", "the", "new", "MonomerID", "for", "a", "given", "polymer", "type" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L438-L461
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.replaceMonomerNotation
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; }
java
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; }
[ "public", "final", "static", "MonomerNotation", "replaceMonomerNotation", "(", "MonomerNotation", "monomerNotation", ",", "String", "existingMonomerID", ",", "String", "newMonomerID", ")", "throws", "NotationException", ",", "ChemistryException", ",", "CTKException", ",", ...
method to replace the MonomerNotation having the MonomerID with the new MonomerID @param monomerNotation given monomer notation @param existingMonomerID existing monomer id @param newMonomerID new monomer id @return MonomerNotation, if it had the old MonomerID, null otherwise @throws NotationException if new monomer id is not valid @throws ChemistryException if chemistry engine can not be initialized @throws CTKException if it contains an invalid smiles @throws MonomerLoadingException if monomers can not be loaded
[ "method", "to", "replace", "the", "MonomerNotation", "having", "the", "MonomerID", "with", "the", "new", "MonomerID" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L483-L523
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.replaceMonomerNotationGroup
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; }
java
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; }
[ "public", "final", "static", "MonomerNotationGroup", "replaceMonomerNotationGroup", "(", "MonomerNotationGroup", "monomerNotation", ",", "String", "existingMonomerID", ",", "String", "newMonomerID", ")", "throws", "NotationException", "{", "MonomerNotationGroup", "newObject", ...
method to replace the MonomerNotationGroup having the MonomerID with the new MonomerID @param monomerNotation the to replace monomernotationgroup @param existingMonomerID the to replace existing monomer id of the monomernotationgroup @param newMonomerID the new monomerid @return MonomerNotationGroup, if it had the old MonomerID, null otherwise @throws NotationException if the new monomer id is not valid
[ "method", "to", "replace", "the", "MonomerNotationGroup", "having", "the", "MonomerID", "with", "the", "new", "MonomerID" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L539-L568
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.produceMonomerNotationUnitWithOtherID
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; }
java
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; }
[ "public", "final", "static", "MonomerNotationUnit", "produceMonomerNotationUnitWithOtherID", "(", "MonomerNotation", "monomerNotation", ",", "String", "newID", ")", "throws", "NotationException", "{", "MonomerNotationUnit", "result", "=", "new", "MonomerNotationUnit", "(", ...
method to replace the MonomerNotationUnit having the MonomerID with the new MonomerID @param monomerNotation given monomer notation @param newID new monomer id @return MonomerNotationUnit @throws NotationException if new id is not valid
[ "method", "to", "replace", "the", "MonomerNotationUnit", "having", "the", "MonomerID", "with", "the", "new", "MonomerID" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L582-L590
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.replaceMonomerNotationList
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; }
java
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; }
[ "public", "final", "static", "MonomerNotationList", "replaceMonomerNotationList", "(", "MonomerNotationList", "object", ",", "String", "existingMonomerID", ",", "String", "newMonomerID", ")", "throws", "NotationException", ",", "ChemistryException", ",", "CTKException", ","...
method to replace the MonomerNotationList having the MonomerID with the new MonomerID @param object MonomerNotationList to change @param existingMonomerID monomer to change @param newMonomerID new monomer @return MonomerNotationList, if it had the old MonomerID, null otherwise @throws NotationException if notation is not valid @throws ChemistryException if chemistry could not be initialized @throws CTKException general ChemToolKit exception passed to HELMToolKit @throws MonomerLoadingException could not load monomers from source
[ "method", "to", "replace", "the", "MonomerNotationList", "having", "the", "MonomerID", "with", "the", "new", "MonomerID" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L612-L650
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.generateIDMonomerNotation
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; }
java
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; }
[ "private", "final", "static", "String", "generateIDMonomerNotation", "(", "String", "id", ",", "String", "count", ",", "String", "annotation", ")", "{", "if", "(", "id", ".", "length", "(", ")", ">", "1", ")", "{", "id", "=", "\"[\"", "+", "id", "+", ...
method to generate the MonomerNotation in String format @param id id of the MonomerNotation @param count Count of the MonomerNotation @param annotation Annotation of the MonomerNotation @return MonomerNotation in String format
[ "method", "to", "generate", "the", "MonomerNotation", "in", "String", "format" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L663-L679
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.generateIDRNA
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; }
java
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; }
[ "private", "final", "static", "String", "generateIDRNA", "(", "String", "id", ",", "String", "count", ",", "String", "annotation", ")", "throws", "MonomerLoadingException", ",", "ChemistryException", ",", "CTKException", "{", "String", "result", "=", "id", ";", ...
method to generate the MonomerNotation for a RNA @param id id of the MonomerNotation @param count Count of the MonomerNotation @param annotation Annotation of the MonomerNotation @return MonomerNotation in String format @throws MonomerLoadingException @throws ChemistryException @throws CTKException
[ "method", "to", "generate", "the", "MonomerNotation", "for", "a", "RNA" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L695-L724
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.generateIDForNucleotide
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; }
java
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; }
[ "private", "final", "static", "List", "<", "String", ">", "generateIDForNucleotide", "(", "MonomerNotationUnitRNA", "object", ",", "String", "existingMonomerID", ",", "String", "newMonomerID", ")", "throws", "MonomerLoadingException", ",", "ChemistryException", ",", "CT...
method to replace the MonomerNotationUnitRNA having the MonomerID with the new MonomerID @param object MonomerNotationUnitRNA @param existingMonomerID @param newMonomerID @return List of MonomerNotationUnitRNA in String format and the information if the MonomerNotationUnitRNA has to be changed @throws MonomerLoadingException @throws ChemistryException @throws CTKException
[ "method", "to", "replace", "the", "MonomerNotationUnitRNA", "having", "the", "MonomerID", "with", "the", "new", "MonomerID" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L740-L768
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.generateGroupElement
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(); }
java
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(); }
[ "private", "static", "String", "generateGroupElement", "(", "String", "id", ",", "List", "<", "Double", ">", "list", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "list", ".", "size", "(", ")", "==", "1", ")", ...
method to generate the MonomerNotationGroupElement in String format @param id @param list @return MonomerNotationGroupElement in String format
[ "method", "to", "generate", "the", "MonomerNotationGroupElement", "in", "String", "format" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L777-L798
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.replaceSMILESWithTemporaryIds
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); } } } }
java
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); } } } }
[ "public", "static", "final", "void", "replaceSMILESWithTemporaryIds", "(", "HELM2Notation", "helm2notation", ")", "throws", "NotationException", ",", "HELM2HandledException", ",", "ChemistryException", ",", "CTKException", ",", "MonomerLoadingException", ",", "JDOMException",...
This function replaces smiles in complex notation with temporary ids @param helm2notation given helm2 notation @throws NotationException if notation is not valid @throws ChemistryException if chemistry engine can not be initialized @throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format @throws CTKException general ChemToolKit exception passed to HELMToolKit @throws MonomerLoadingException if monomers can not be loaded @throws JDOMException if smiles can not be replace with the temporary ids
[ "This", "function", "replaces", "smiles", "in", "complex", "notation", "with", "temporary", "ids" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L875-L892
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.hybridize
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); } } }
java
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); } } }
[ "public", "static", "void", "hybridize", "(", "HELM2Notation", "helm2notation", ")", "throws", "NotationException", ",", "RNAUtilsException", ",", "HELM2HandledException", ",", "org", ".", "helm", ".", "notation2", ".", "exception", ".", "NotationException", ",", "C...
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 @param helm2notation HELM2Notation object @throws NotationException if notation is not valid @throws RNAUtilsException if the polymer is not a RNA/DNA @throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format @throws org.helm.notation2.exception.NotationException if notation is not valid @throws ChemistryException if chemistry engine can not be initialized
[ "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" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L1122-L1133
train
kiswanij/jk-util
src/main/java/com/jk/util/context/JKAbstractContext.java
JKAbstractContext.setApplicationMap
public void setApplicationMap(final Map<String, Object> applicationMap) { JKThreadLocal.setValue(JKContextConstants.APPLICATION_MAP, applicationMap); }
java
public void setApplicationMap(final Map<String, Object> applicationMap) { JKThreadLocal.setValue(JKContextConstants.APPLICATION_MAP, applicationMap); }
[ "public", "void", "setApplicationMap", "(", "final", "Map", "<", "String", ",", "Object", ">", "applicationMap", ")", "{", "JKThreadLocal", ".", "setValue", "(", "JKContextConstants", ".", "APPLICATION_MAP", ",", "applicationMap", ")", ";", "}" ]
Sets the application map. @param applicationMap the application map
[ "Sets", "the", "application", "map", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/context/JKAbstractContext.java#L145-L147
train
kiswanij/jk-util
src/main/java/com/jk/util/context/JKAbstractContext.java
JKAbstractContext.setRequestMap
public void setRequestMap(final Map<String, Object> requestMap) { JKThreadLocal.setValue(JKContextConstants.HTTP_REQUEST_MAP, requestMap); }
java
public void setRequestMap(final Map<String, Object> requestMap) { JKThreadLocal.setValue(JKContextConstants.HTTP_REQUEST_MAP, requestMap); }
[ "public", "void", "setRequestMap", "(", "final", "Map", "<", "String", ",", "Object", ">", "requestMap", ")", "{", "JKThreadLocal", ".", "setValue", "(", "JKContextConstants", ".", "HTTP_REQUEST_MAP", ",", "requestMap", ")", ";", "}" ]
Sets the request map. @param requestMap the request map
[ "Sets", "the", "request", "map", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/context/JKAbstractContext.java#L181-L183
train
kiswanij/jk-util
src/main/java/com/jk/util/context/JKAbstractContext.java
JKAbstractContext.setSessionMap
public void setSessionMap(final Map<String, Object> sessionMap) { JKThreadLocal.setValue(JKContextConstants.HTTP_SESSION_MAP, sessionMap); }
java
public void setSessionMap(final Map<String, Object> sessionMap) { JKThreadLocal.setValue(JKContextConstants.HTTP_SESSION_MAP, sessionMap); }
[ "public", "void", "setSessionMap", "(", "final", "Map", "<", "String", ",", "Object", ">", "sessionMap", ")", "{", "JKThreadLocal", ".", "setValue", "(", "JKContextConstants", ".", "HTTP_SESSION_MAP", ",", "sessionMap", ")", ";", "}" ]
Sets the session map. @param sessionMap the session map
[ "Sets", "the", "session", "map", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/context/JKAbstractContext.java#L199-L201
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/MolfileEncoder.java
MolfileEncoder.compress
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); } }
java
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); } }
[ "private", "static", "String", "compress", "(", "String", "str", ")", "throws", "EncoderException", "{", "ByteArrayOutputStream", "rstBao", "=", "null", ";", "GZIPOutputStream", "zos", "=", "null", ";", "try", "{", "rstBao", "=", "new", "ByteArrayOutputStream", ...
method to compress the given molfile in a gezipped Base64 string @param str given molfile @throws EncoderException
[ "method", "to", "compress", "the", "given", "molfile", "in", "a", "gezipped", "Base64", "string" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MolfileEncoder.java#L72-L89
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/MolfileEncoder.java
MolfileEncoder.decompress
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); } }
java
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); } }
[ "private", "static", "String", "decompress", "(", "String", "str", ")", "throws", "EncoderException", "{", "/* First base64 decode the string */", "byte", "[", "]", "bytes", "=", "Base64", ".", "decodeBase64", "(", "str", ")", ";", "GZIPInputStream", "zi", "=", ...
method to decompress the given molfile input @param str the molefile input can be in base64 format or in the gzipped Base64 format @return molfile @throws EncoderException
[ "method", "to", "decompress", "the", "given", "molfile", "input" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/MolfileEncoder.java#L99-L125
train
openCage/memoryfs
src/main/java/de/pfabulist/lindwurm/memory/MemoryData.java
MemoryData.addDir
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; }
java
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; }
[ "public", "MemoryFileAttributes", "addDir", "(", "EightyPath", "dir", ",", "Principals", "principals", ")", "{", "if", "(", "content", ".", "get", "(", "dir", ")", ".", "isPresent", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"path...
todo default to root ?
[ "todo", "default", "to", "root", "?" ]
f47aaa88cd22e86ea3739430286351dc8d85641c
https://github.com/openCage/memoryfs/blob/f47aaa88cd22e86ea3739430286351dc8d85641c/src/main/java/de/pfabulist/lindwurm/memory/MemoryData.java#L125-L143
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/AttachmentLoader.java
AttachmentLoader.loadAttachments
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."); } }
java
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."); } }
[ "public", "static", "Map", "<", "String", ",", "Attachment", ">", "loadAttachments", "(", "InputStream", "in", ")", "throws", "IOException", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "TypeReference", "<", "TreeMap", "<", "String...
reads the attachments from the given inputstream and returns the attachment db @param in inputstream the given file containing all attachments @return attachment db @throws IOException if the attachments in the given file can not be loaded or an attachment is not valid
[ "reads", "the", "attachments", "from", "the", "given", "inputstream", "and", "returns", "the", "attachment", "db" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/AttachmentLoader.java#L63-L86
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/AttachmentLoader.java
AttachmentLoader.validateAttachment
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; }
java
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; }
[ "public", "static", "boolean", "validateAttachment", "(", "Attachment", "currentAttachment", ")", "{", "try", "{", "currentAttachment", ".", "getId", "(", ")", ";", "if", "(", "currentAttachment", ".", "getAlternateId", "(", ")", "==", "\"null\"", "||", "current...
validates the current attachment @param currentAttachment given attachment @return true, if the current attachment is valid, false otherwisesr
[ "validates", "the", "current", "attachment" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/AttachmentLoader.java#L93-L113
train
kiswanij/jk-util
src/main/java/com/jk/util/security/JKSecurityManager.java
JKSecurityManager.checkAllowedPrivilige
public static void checkAllowedPrivilige(final JKPrivilige privilige) { logger.debug("checkAllowedPrivilige() : ", privilige); final JKAuthorizer auth = getAuthorizer(); auth.checkAllowed(privilige); }
java
public static void checkAllowedPrivilige(final JKPrivilige privilige) { logger.debug("checkAllowedPrivilige() : ", privilige); final JKAuthorizer auth = getAuthorizer(); auth.checkAllowed(privilige); }
[ "public", "static", "void", "checkAllowedPrivilige", "(", "final", "JKPrivilige", "privilige", ")", "{", "logger", ".", "debug", "(", "\"checkAllowedPrivilige() : \"", ",", "privilige", ")", ";", "final", "JKAuthorizer", "auth", "=", "getAuthorizer", "(", ")", ";"...
Check allowed privilige. @param privilige the privilige @throws SecurityException the security exception
[ "Check", "allowed", "privilige", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/security/JKSecurityManager.java#L49-L53
train
kiswanij/jk-util
src/main/java/com/jk/util/security/JKSecurityManager.java
JKSecurityManager.matchPassword
public static boolean matchPassword(String plain, JKUser user) { JK.implementMe(); return JKSecurityUtil.encode(plain).equals(user.getPassword()); }
java
public static boolean matchPassword(String plain, JKUser user) { JK.implementMe(); return JKSecurityUtil.encode(plain).equals(user.getPassword()); }
[ "public", "static", "boolean", "matchPassword", "(", "String", "plain", ",", "JKUser", "user", ")", "{", "JK", ".", "implementMe", "(", ")", ";", "return", "JKSecurityUtil", ".", "encode", "(", "plain", ")", ".", "equals", "(", "user", ".", "getPassword", ...
Match password. @param plain the plain @param user the user @return true, if successful
[ "Match", "password", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/security/JKSecurityManager.java#L134-L137
train
kiswanij/jk-util
src/main/java/com/jk/util/security/JKSecurityManager.java
JKSecurityManager.createPrivilige
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; }
java
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; }
[ "public", "static", "JKPrivilige", "createPrivilige", "(", "String", "name", ",", "JKPrivilige", "parent", ",", "int", "number", ")", "{", "logger", ".", "trace", "(", "\"createPriviligeObject(): Id : \"", ",", "\".name\"", ",", "name", ",", "\", Parent:[\"", ",",...
Creates the privilige. @param name the name @param parent the parent @param number the number @return the JK privilige
[ "Creates", "the", "privilige", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/security/JKSecurityManager.java#L163-L168
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SequenceConverter.java
SequenceConverter.readPeptide
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; }
java
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; }
[ "public", "static", "HELM2Notation", "readPeptide", "(", "String", "notation", ")", "throws", "FastaFormatException", ",", "NotationException", ",", "ChemistryException", "{", "HELM2Notation", "helm2notation", "=", "new", "HELM2Notation", "(", ")", ";", "PolymerNotation...
method to read a peptide sequence and generate a HELM2Notation object of it @param notation peptide sequence @return HELM2Notation object @throws FastaFormatException if the peptide sequence is not in the right format @throws NotationException if the notation object can not be built @throws ChemistryException if chemistry engine can not be initialized
[ "method", "to", "read", "a", "peptide", "sequence", "and", "generate", "a", "HELM2Notation", "object", "of", "it" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SequenceConverter.java#L68-L75
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SequenceConverter.java
SequenceConverter.getPeptideSequenceFromNotation
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(); }
java
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(); }
[ "public", "static", "String", "getPeptideSequenceFromNotation", "(", "HELM2Notation", "helm2notation", ")", "throws", "HELM2HandledException", ",", "PeptideUtilsException", ",", "org", ".", "helm", ".", "notation2", ".", "exception", ".", "NotationException", ",", "Chem...
method to get for all peptides the sequence @param helm2notation HELM2Notation @return rna sequences divided by white space @throws HELM2HandledException if the polymer contains HELM2 features @throws PeptideUtilsException if the polymer is not a peptide @throws org.helm.notation2.exception.NotationException if notation is not valid @throws ChemistryException if the Chemistry Engine can not be initialized
[ "method", "to", "get", "for", "all", "peptides", "the", "sequence" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SequenceConverter.java#L149-L159
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SequenceConverter.java
SequenceConverter.getNucleotideNaturalAnalogSequenceFromNotation
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(); }
java
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(); }
[ "public", "static", "String", "getNucleotideNaturalAnalogSequenceFromNotation", "(", "HELM2Notation", "helm2Notation", ")", "throws", "NotationException", ",", "HELM2HandledException", ",", "ChemistryException", "{", "List", "<", "PolymerNotation", ">", "polymers", "=", "he...
method to generate for all rna polymers the natural analogue sequence @param helm2Notation input HELm2Notation @return natural analogue sequence(s) @throws NotationException if the input complex notation contains non-nucleid acid polymer(s) @throws HELM2HandledException if the polymer(s) contain(s) HELM2 features @throws ChemistryException if the Chemistry Engine can not be initialized
[ "method", "to", "generate", "for", "all", "rna", "polymers", "the", "natural", "analogue", "sequence" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SequenceConverter.java#L175-L189
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SequenceConverter.java
SequenceConverter.getPeptideNaturalAnalogSequenceFromNotation
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(); }
java
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(); }
[ "public", "static", "String", "getPeptideNaturalAnalogSequenceFromNotation", "(", "HELM2Notation", "helm2Notation", ")", "throws", "HELM2HandledException", ",", "PeptideUtilsException", ",", "NotationException", ",", "ChemistryException", "{", "List", "<", "PolymerNotation", ...
method to generate for all peptide polymers the natural analogue sequence @param helm2Notation input HELM2Notation @return natural analogue sequence(s) @throws NotationException if the input complex notation contains non-peptide polymer(s) @throws HELM2HandledException if the polymer(s) contain(s) HELM2 features @throws PeptideUtilsException if the polymer is not a peptide @throws ChemistryException if the Chemistry Engine can not be initialized
[ "method", "to", "generate", "for", "all", "peptide", "polymers", "the", "natural", "analogue", "sequence" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SequenceConverter.java#L206-L218
train
snowdream/android-multithread
lib/src/main/java/com/github/snowdream/android/util/concurrent/AsyncTask.java
AsyncTask.setDefaultExecutor
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); } }
java
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); } }
[ "public", "static", "void", "setDefaultExecutor", "(", "Executor", "executor", ")", "{", "Class", "<", "?", ">", "c", "=", "null", ";", "Field", "field", "=", "null", ";", "try", "{", "c", "=", "Class", ".", "forName", "(", "\"android.os.AsyncTask\"", ")...
set the default Executor @param executor
[ "set", "the", "default", "Executor" ]
02bb793979de29bf5266d5e85a552bce47899cd9
https://github.com/snowdream/android-multithread/blob/02bb793979de29bf5266d5e85a552bce47899cd9/lib/src/main/java/com/github/snowdream/android/util/concurrent/AsyncTask.java#L217-L239
train
snowdream/android-multithread
lib/src/main/java/com/github/snowdream/android/util/concurrent/AsyncTask.java
AsyncTask.getDefaultExecutor
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; }
java
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; }
[ "public", "static", "Executor", "getDefaultExecutor", "(", ")", "{", "Executor", "exec", "=", "null", ";", "Class", "<", "?", ">", "c", "=", "null", ";", "Field", "field", "=", "null", ";", "try", "{", "c", "=", "Class", ".", "forName", "(", "\"andro...
get the default Executor @return the default Executor
[ "get", "the", "default", "Executor" ]
02bb793979de29bf5266d5e85a552bce47899cd9
https://github.com/snowdream/android-multithread/blob/02bb793979de29bf5266d5e85a552bce47899cd9/lib/src/main/java/com/github/snowdream/android/util/concurrent/AsyncTask.java#L246-L272
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/NucleotideParser.java
NucleotideParser.convertToNucleotide
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; }
java
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; }
[ "public", "static", "Nucleotide", "convertToNucleotide", "(", "String", "id", ",", "boolean", "last", ")", "throws", "MonomerException", ",", "org", ".", "helm", ".", "notation2", ".", "exception", ".", "NotationException", ",", "ChemistryException", ",", "Nucleot...
method to convert an string to an nucleotide @param id given input string @param last if the nucleotide is the last element of an rna @return nucleotide @throws ChemistryException if the chemistry engine could not be initialized @throws org.helm.notation2.exception.NotationException if notation is not valid @throws MonomerException if the monomer is not valid @throws NucleotideLoadingException if nucleotides can not be loaded @throws org.helm.notation2.parser.exceptionparser.NotationException if the notation is not valid
[ "method", "to", "convert", "an", "string", "to", "an", "nucleotide" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/NucleotideParser.java#L273-L337
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/NucleotideParser.java
NucleotideParser.validateSimpleNotationForRNA
public static boolean validateSimpleNotationForRNA(String polymerNotation) throws org.helm.notation2.parser.exceptionparser.NotationException { getMonomerIDListFromNucleotide(polymerNotation); return true; }
java
public static boolean validateSimpleNotationForRNA(String polymerNotation) throws org.helm.notation2.parser.exceptionparser.NotationException { getMonomerIDListFromNucleotide(polymerNotation); return true; }
[ "public", "static", "boolean", "validateSimpleNotationForRNA", "(", "String", "polymerNotation", ")", "throws", "org", ".", "helm", ".", "notation2", ".", "parser", ".", "exceptionparser", ".", "NotationException", "{", "getMonomerIDListFromNucleotide", "(", "polymerNot...
validate RNA simple notation @param polymerNotation notation to be checked @return true if the polymyer notation is valid, otherwise throws an exception @throws org.helm.notation2.parser.exceptionparser.NotationException if notation is not valid
[ "validate", "RNA", "simple", "notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/NucleotideParser.java#L355-L358
train
demidenko05/beige-uml
beige-uml-base/src/main/java/org/beigesoft/uml/controller/AControllerDiagramUml.java
AControllerDiagramUml.dragged
@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()); } } }
java
@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()); } } }
[ "@", "Override", "public", "void", "dragged", "(", "IEventMotion", "e", ")", "{", "if", "(", "paletteDiagram", ".", "getSelectedCommand", "(", ")", "==", "ECommands", ".", "SELECT", ".", "toString", "(", ")", ")", "{", "if", "(", "!", "itWasDragging", ")...
Move an UML element or change path of a relation
[ "Move", "an", "UML", "element", "or", "change", "path", "of", "a", "relation" ]
65f6024fa944e10875d9a3be3e4a586bede39683
https://github.com/demidenko05/beige-uml/blob/65f6024fa944e10875d9a3be3e4a586bede39683/beige-uml-base/src/main/java/org/beigesoft/uml/controller/AControllerDiagramUml.java#L131-L141
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.generatePeptidePolymersFromFASTAFormatHELM1
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; }
java
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; }
[ "public", "static", "HELM2Notation", "generatePeptidePolymersFromFASTAFormatHELM1", "(", "String", "fasta", ")", "throws", "FastaFormatException", ",", "ChemistryException", "{", "helm2notation", "=", "new", "HELM2Notation", "(", ")", ";", "if", "(", "null", "==", "fa...
method to read the information from a FastaFile-Format + generate peptide polymers, be careful, it produces only polymers in the HELM1 standard, no ambiguity @param fasta FastaFile in string format @return HELM2Notation generated HELM2Notation @throws FastaFormatException if the input is not correct @throws ChemistryException if chemistry engine can not be initialized
[ "method", "to", "read", "the", "information", "from", "a", "FastaFile", "-", "Format", "+", "generate", "peptide", "polymers", "be", "careful", "it", "produces", "only", "polymers", "in", "the", "HELM1", "standard", "no", "ambiguity" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L105-L149
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.initMapNucleotides
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()); } }
java
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()); } }
[ "private", "static", "void", "initMapNucleotides", "(", ")", "throws", "FastaFormatException", "{", "try", "{", "nucleotides", "=", "NucleotideFactory", ".", "getInstance", "(", ")", ".", "getNucleotideTemplates", "(", ")", ".", "get", "(", "\"HELM Notation\"", ")...
method to initialize map of existing nucleotides in the database @throws FastaFormatException if the NucleotideFactory can not be initalialized
[ "method", "to", "initialize", "map", "of", "existing", "nucleotides", "in", "the", "database" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L229-L237
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.initMapTransformNucleotides
private static void initMapTransformNucleotides() { transformNucleotides = new HashMap<String, String>(); for (Map.Entry e : nucleotides.entrySet()) { transformNucleotides.put(e.getValue().toString(), e.getKey().toString()); } }
java
private static void initMapTransformNucleotides() { transformNucleotides = new HashMap<String, String>(); for (Map.Entry e : nucleotides.entrySet()) { transformNucleotides.put(e.getValue().toString(), e.getKey().toString()); } }
[ "private", "static", "void", "initMapTransformNucleotides", "(", ")", "{", "transformNucleotides", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "Map", ".", "Entry", "e", ":", "nucleotides", ".", "entrySet", "(", ")",...
method to initialize map of transform nucleotides
[ "method", "to", "initialize", "map", "of", "transform", "nucleotides" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L242-L247
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.initMapNucleotidesNaturalAnalog
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()); } }
java
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()); } }
[ "private", "static", "void", "initMapNucleotidesNaturalAnalog", "(", ")", "throws", "FastaFormatException", ",", "ChemistryException", "{", "try", "{", "nucleotidesNaturalAnalog", "=", "MonomerFactory", ".", "getInstance", "(", ")", ".", "getMonomerDB", "(", ")", ".",...
method to initialize map of existing nucleotides with the natural analog sequence in the database @throws FastaFormatException if the NucleotideFactory can not be initialized @throws ChemistryException if chemistry engine can not be initialized
[ "method", "to", "initialize", "map", "of", "existing", "nucleotides", "with", "the", "natural", "analog", "sequence", "in", "the", "database" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L258-L266
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.initMapAminoAcid
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()); } }
java
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()); } }
[ "private", "static", "void", "initMapAminoAcid", "(", ")", "throws", "FastaFormatException", ",", "ChemistryException", "{", "try", "{", "aminoacids", "=", "MonomerFactory", ".", "getInstance", "(", ")", ".", "getMonomerDB", "(", ")", ".", "get", "(", "\"PEPTIDE...
method to initialize map of existing amino acids in the database @throws FastaFormatException AminoAcids can not be initialized @throws ChemistryException if chemistry engine can not be initialized @throws CTKException general ChemToolKit exception passed to HELMToolKit
[ "method", "to", "initialize", "map", "of", "existing", "amino", "acids", "in", "the", "database" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L278-L286
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.generateFastaFromPeptide
protected static String generateFastaFromPeptide(List<Monomer> monomers) { StringBuilder fasta = new StringBuilder(); for (Monomer monomer : monomers) { fasta.append(monomer.getNaturalAnalog()); } return fasta.toString(); }
java
protected static String generateFastaFromPeptide(List<Monomer> monomers) { StringBuilder fasta = new StringBuilder(); for (Monomer monomer : monomers) { fasta.append(monomer.getNaturalAnalog()); } return fasta.toString(); }
[ "protected", "static", "String", "generateFastaFromPeptide", "(", "List", "<", "Monomer", ">", "monomers", ")", "{", "StringBuilder", "fasta", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Monomer", "monomer", ":", "monomers", ")", "{", "fasta", "...
method to generate Fasta for a list of peptide monomers @param monomers peptide monomers @return Fasta sequence
[ "method", "to", "generate", "Fasta", "for", "a", "list", "of", "peptide", "monomers" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L458-L464
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.generateFastaFromRNAPolymer
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(); }
java
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(); }
[ "public", "static", "String", "generateFastaFromRNAPolymer", "(", "List", "<", "PolymerNotation", ">", "polymers", ")", "throws", "FastaFormatException", ",", "ChemistryException", "{", "StringBuilder", "fasta", "=", "new", "StringBuilder", "(", ")", ";", "for", "("...
method to generate Fasta for rna polymers @param polymers list of rna PolymerNotation @return Fasta @throws FastaFormatException if the polymers can not be transformed into FASTA @throws ChemistryException if the Chemistry Engine can not be initialized
[ "method", "to", "generate", "Fasta", "for", "rna", "polymers" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L477-L497
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.generateFastaFromRNA
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(); }
java
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(); }
[ "protected", "static", "String", "generateFastaFromRNA", "(", "List", "<", "Monomer", ">", "monomers", ")", "{", "StringBuilder", "fasta", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Monomer", "monomer", ":", "monomers", ")", "{", "if", "(", "...
method to generate Fasta for a list of rna monomers @param monomers list of monomers @return sequence
[ "method", "to", "generate", "Fasta", "for", "a", "list", "of", "rna", "monomers" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L506-L515
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.generateFasta
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(); }
java
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(); }
[ "public", "static", "String", "generateFasta", "(", "HELM2Notation", "helm2Notation2", ")", "throws", "FastaFormatException", ",", "ChemistryException", "{", "List", "<", "PolymerNotation", ">", "polymersPeptides", "=", "new", "ArrayList", "<", "PolymerNotation", ">", ...
method to generate for the whole HELM2Notation fasta-files, it contains fasta for all rna and peptides @param helm2Notation2 HELM2Notation @return FASTA-File-Format @throws FastaFormatException if the HELM2Notation can not be transformed to FASTA @throws ChemistryException if the Chemistry Engine can not be initialized
[ "method", "to", "generate", "for", "the", "whole", "HELM2Notation", "fasta", "-", "files", "it", "contains", "fasta", "for", "all", "rna", "and", "peptides" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L529-L547
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.convertIntoAnalogSequence
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; }
java
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; }
[ "public", "static", "HELM2Notation", "convertIntoAnalogSequence", "(", "HELM2Notation", "helm2Notation", ")", "throws", "FastaFormatException", ",", "AnalogSequenceException", ",", "ChemistryException", ",", "CTKException", "{", "initMapAminoAcid", "(", ")", ";", "initMapNu...
method to convert all Peptides and RNAs into the natural analogue sequence and generates HELM2Notation @param helm2Notation {@link HELM2Notation} @return analog helm2notation @throws FastaFormatException if it can not be converted to analog sequence @throws AnalogSequenceException if the natural analogue sequence can not be produced @throws ChemistryException if chemistry engine can not be initialized @throws CTKException general ChemToolKit exception passed to HELMToolKit
[ "method", "to", "convert", "all", "Peptides", "and", "RNAs", "into", "the", "natural", "analogue", "sequence", "and", "generates", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L561-L581
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.convertPeptideIntoAnalogSequence
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; }
java
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; }
[ "private", "static", "PolymerNotation", "convertPeptideIntoAnalogSequence", "(", "PolymerNotation", "polymer", ")", "throws", "AnalogSequenceException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "polymer", ".", "getPolymerElements", "(", ")", ".", "get...
method to convert the sequence of a PolymerNotation into the natural analogue sequence @param polymer PolymerNotation @return PolymerNotation with the natural analogue sequence @throws AnalogSequenceException if the natural analog sequence can not be produced
[ "method", "to", "convert", "the", "sequence", "of", "a", "PolymerNotation", "into", "the", "natural", "analogue", "sequence" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L593-L603
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.generateMonomerNotationRNA
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"); } }
java
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"); } }
[ "private", "static", "MonomerNotation", "generateMonomerNotationRNA", "(", "MonomerNotation", "current", ")", "throws", "AnalogSequenceException", "{", "MonomerNotation", "change", "=", "null", ";", "try", "{", "/* simple MonomerNotationUnit */", "if", "(", "current", "in...
method to change the MonomerNotation in its analogue @param current MonomerNotation @return its analogue MonomerNotation @throws AnalogSequenceException if analog sequence can not be produced
[ "method", "to", "change", "the", "MonomerNotation", "in", "its", "analogue" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L687-L742
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.convertRNAIntoAnalogSequence
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; }
java
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; }
[ "private", "static", "PolymerNotation", "convertRNAIntoAnalogSequence", "(", "PolymerNotation", "polymer", ")", "throws", "AnalogSequenceException", "{", "/* change only if it is possible */", "for", "(", "int", "i", "=", "0", ";", "i", "<", "polymer", ".", "getPolymerE...
method to generate the sequence of a rna PolymerNotation into its natural analogue sequence @param polymer PolymerNotation @return PolymerNotation with its natural analogue sequence @throws AnalogSequenceException if the natural analogues MonomerNotations can not be built
[ "method", "to", "generate", "the", "sequence", "of", "a", "rna", "PolymerNotation", "into", "its", "natural", "analogue", "sequence" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L754-L764
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/FastaFormat.java
FastaFormat.changeIdForRNA
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; } }
java
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; } }
[ "private", "static", "String", "changeIdForRNA", "(", "MonomerNotation", "monomerNotation", ")", "{", "if", "(", "monomerNotation", "instanceof", "MonomerNotationUnitRNA", ")", "{", "StringBuilder", "changeid", "=", "new", "StringBuilder", "(", ")", ";", "for", "(",...
method to get the natural analogue sequence of a MonomerNotation @param monomerNotation MonomerNotation @return natural analogue sequence of MonomerNotation
[ "method", "to", "get", "the", "natural", "analogue", "sequence", "of", "a", "MonomerNotation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/FastaFormat.java#L773-L794
train
kiswanij/jk-util
src/main/java/com/jk/util/validation/builtin/HostNameValidator.java
HostNameValidator.checkHostPart
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 >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '-') { // NOI18N continue; } problems.add(ValidationBundle.getMessage(HostNameValidator.class, "BAD_CHAR_IN_HOSTNAME", new String(new char[] { c }))); // NOI18N result = false; } } } } } return result; }
java
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 >= 'a' && c <= 'z' || c >= '0' && c <= '9' || c == '-') { // NOI18N continue; } problems.add(ValidationBundle.getMessage(HostNameValidator.class, "BAD_CHAR_IN_HOSTNAME", new String(new char[] { c }))); // NOI18N result = false; } } } } } return result; }
[ "private", "boolean", "checkHostPart", "(", "final", "String", "label", ",", "final", "Problems", "problems", ",", "final", "String", "compName", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "label", ".", "length", "(", ")", ">", "63", ")"...
Check host part. @param label the label @param problems the problems @param compName the comp name @return true, if successful
[ "Check", "host", "part", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/builtin/HostNameValidator.java#L50-L83
train
kiswanij/jk-util
src/main/java/com/jk/util/MachineInfo.java
MachineInfo.getMacAddress
public static String getMacAddress() { try { List<String> macAddress = new ArrayList<String>(); Enumeration<NetworkInterface> enumNetWorkInterface = NetworkInterface.getNetworkInterfaces(); while (enumNetWorkInterface.hasMoreElements()) { NetworkInterface netWorkInterface = enumNetWorkInterface.nextElement(); byte[] hardwareAddress = netWorkInterface.getHardwareAddress(); if (hardwareAddress != null && netWorkInterface.isUp() && !netWorkInterface.isVirtual()) { String displayName = netWorkInterface.getDisplayName().toLowerCase(); if (!displayName.contains("virtual") && !displayName.contains("tunnel")) { String strMac = ""; for (int i = 0; i < hardwareAddress.length; i++) { strMac += String.format("%02X%s", hardwareAddress[i], (i < hardwareAddress.length - 1) ? "-" : ""); } if (strMac.trim().length() > 0) { macAddress.add(strMac); } } } } return macAddress.toString().replace(",", ";").replace("[", "").replace("]", ""); } catch (Exception e) { throw new JKException(e); } }
java
public static String getMacAddress() { try { List<String> macAddress = new ArrayList<String>(); Enumeration<NetworkInterface> enumNetWorkInterface = NetworkInterface.getNetworkInterfaces(); while (enumNetWorkInterface.hasMoreElements()) { NetworkInterface netWorkInterface = enumNetWorkInterface.nextElement(); byte[] hardwareAddress = netWorkInterface.getHardwareAddress(); if (hardwareAddress != null && netWorkInterface.isUp() && !netWorkInterface.isVirtual()) { String displayName = netWorkInterface.getDisplayName().toLowerCase(); if (!displayName.contains("virtual") && !displayName.contains("tunnel")) { String strMac = ""; for (int i = 0; i < hardwareAddress.length; i++) { strMac += String.format("%02X%s", hardwareAddress[i], (i < hardwareAddress.length - 1) ? "-" : ""); } if (strMac.trim().length() > 0) { macAddress.add(strMac); } } } } return macAddress.toString().replace(",", ";").replace("[", "").replace("]", ""); } catch (Exception e) { throw new JKException(e); } }
[ "public", "static", "String", "getMacAddress", "(", ")", "{", "try", "{", "List", "<", "String", ">", "macAddress", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "Enumeration", "<", "NetworkInterface", ">", "enumNetWorkInterface", "=", "Network...
Gets the physical active mac address. @return the mac address
[ "Gets", "the", "physical", "active", "mac", "address", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/MachineInfo.java#L106-L131
train
kiswanij/jk-util
src/main/java/com/jk/util/MachineInfo.java
MachineInfo.getSystemInfo
public static Properties getSystemInfo() { logger.debug("getSystemInfo()"); if (MachineInfo.systemInfo == null) { if (!JKIOUtil.isWindows()) { throw new IllegalStateException("this feature is only supported on windows"); } final byte[] sourceFileContents = JKIOUtil.readFileAsByteArray("/native/jk.dll"); if (sourceFileContents.length > 0) { logger.debug("dll found"); // copy the dll to the new exe file logger.debug("move to temp folder"); final File hardDiskReaderFile = JKIOUtil.writeDataToTempFile(sourceFileContents, ".exe"); // execute the file logger.debug("execute process"); final Process p = JKIOUtil.executeFile(hardDiskReaderFile.getAbsolutePath()); String input = new String(JKIOUtil.readStream(p.getInputStream())); input = input.replace(":", "="); logger.debug("input : ", input); final String lines[] = input.split(JK.NEW_LINE); MachineInfo.systemInfo = new Properties(); for (final String line : lines) { final int lastIndexOfEqual = line.lastIndexOf('='); if (lastIndexOfEqual != -1 && lastIndexOfEqual != line.length()) { String key = line.substring(0, lastIndexOfEqual).trim().toUpperCase(); key = key.replace("_", "");// remove old underscores key = key.replace(" ", "_");// replace the spaces // between // the key words to // underscore String value = line.substring(lastIndexOfEqual + 1).trim(); value = value.replace("[", ""); value = value.replace("]", ""); value = value.trim(); String oldValue = systemInfo.getProperty(key); if (oldValue == null) { systemInfo.setProperty(key, value); } else { if (!oldValue.contains(value)) { systemInfo.setProperty(key, oldValue.concat(";").concat(value)); } } } } logger.debug("destory process"); p.destroy(); logger.debug("delete file"); hardDiskReaderFile.delete(); } } return MachineInfo.systemInfo; }
java
public static Properties getSystemInfo() { logger.debug("getSystemInfo()"); if (MachineInfo.systemInfo == null) { if (!JKIOUtil.isWindows()) { throw new IllegalStateException("this feature is only supported on windows"); } final byte[] sourceFileContents = JKIOUtil.readFileAsByteArray("/native/jk.dll"); if (sourceFileContents.length > 0) { logger.debug("dll found"); // copy the dll to the new exe file logger.debug("move to temp folder"); final File hardDiskReaderFile = JKIOUtil.writeDataToTempFile(sourceFileContents, ".exe"); // execute the file logger.debug("execute process"); final Process p = JKIOUtil.executeFile(hardDiskReaderFile.getAbsolutePath()); String input = new String(JKIOUtil.readStream(p.getInputStream())); input = input.replace(":", "="); logger.debug("input : ", input); final String lines[] = input.split(JK.NEW_LINE); MachineInfo.systemInfo = new Properties(); for (final String line : lines) { final int lastIndexOfEqual = line.lastIndexOf('='); if (lastIndexOfEqual != -1 && lastIndexOfEqual != line.length()) { String key = line.substring(0, lastIndexOfEqual).trim().toUpperCase(); key = key.replace("_", "");// remove old underscores key = key.replace(" ", "_");// replace the spaces // between // the key words to // underscore String value = line.substring(lastIndexOfEqual + 1).trim(); value = value.replace("[", ""); value = value.replace("]", ""); value = value.trim(); String oldValue = systemInfo.getProperty(key); if (oldValue == null) { systemInfo.setProperty(key, value); } else { if (!oldValue.contains(value)) { systemInfo.setProperty(key, oldValue.concat(";").concat(value)); } } } } logger.debug("destory process"); p.destroy(); logger.debug("delete file"); hardDiskReaderFile.delete(); } } return MachineInfo.systemInfo; }
[ "public", "static", "Properties", "getSystemInfo", "(", ")", "{", "logger", ".", "debug", "(", "\"getSystemInfo()\"", ")", ";", "if", "(", "MachineInfo", ".", "systemInfo", "==", "null", ")", "{", "if", "(", "!", "JKIOUtil", ".", "isWindows", "(", ")", "...
Gets the system info. @return the system info
[ "Gets", "the", "system", "info", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/MachineInfo.java#L138-L188
train
kiswanij/jk-util
src/main/java/com/jk/util/JKDebugUtil.java
JKDebugUtil.getExceptionCallerClass
public static Class<?> getExceptionCallerClass(final Throwable t) { final StackTraceElement[] stackTrace = t.getStackTrace(); for (final StackTraceElement stackTraceElement : stackTrace) { logger.debug(stackTraceElement.getClassName().concat(".").concat(stackTraceElement.getMethodName())); } return null; }
java
public static Class<?> getExceptionCallerClass(final Throwable t) { final StackTraceElement[] stackTrace = t.getStackTrace(); for (final StackTraceElement stackTraceElement : stackTrace) { logger.debug(stackTraceElement.getClassName().concat(".").concat(stackTraceElement.getMethodName())); } return null; }
[ "public", "static", "Class", "<", "?", ">", "getExceptionCallerClass", "(", "final", "Throwable", "t", ")", "{", "final", "StackTraceElement", "[", "]", "stackTrace", "=", "t", ".", "getStackTrace", "(", ")", ";", "for", "(", "final", "StackTraceElement", "s...
Gets the exception caller class. @param t the t @return the exception caller class
[ "Gets", "the", "exception", "caller", "class", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDebugUtil.java#L41-L47
train
kiswanij/jk-util
src/main/java/com/jk/util/JKDebugUtil.java
JKDebugUtil.getMainClassName
public static String getMainClassName() { StackTraceElement trace[] = Thread.currentThread().getStackTrace(); if (trace.length > 0) { return trace[trace.length - 1].getClassName(); } return "Unknown"; }
java
public static String getMainClassName() { StackTraceElement trace[] = Thread.currentThread().getStackTrace(); if (trace.length > 0) { return trace[trace.length - 1].getClassName(); } return "Unknown"; }
[ "public", "static", "String", "getMainClassName", "(", ")", "{", "StackTraceElement", "trace", "[", "]", "=", "Thread", ".", "currentThread", "(", ")", ".", "getStackTrace", "(", ")", ";", "if", "(", "trace", ".", "length", ">", "0", ")", "{", "return", ...
Gets the main class name. @return the main class name
[ "Gets", "the", "main", "class", "name", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDebugUtil.java#L79-L85
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SiRNANotation.java
SiRNANotation.getSiRNANotation
public static HELM2Notation getSiRNANotation(String senseSeq, String antiSenseSeq) throws NotationException, FastaFormatException, HELM2HandledException, RNAUtilsException, org.helm.notation2.exception.NotationException, ChemistryException, CTKException, NucleotideLoadingException { return getSirnaNotation(senseSeq, antiSenseSeq, NucleotideParser.RNA_DESIGN_NONE); }
java
public static HELM2Notation getSiRNANotation(String senseSeq, String antiSenseSeq) throws NotationException, FastaFormatException, HELM2HandledException, RNAUtilsException, org.helm.notation2.exception.NotationException, ChemistryException, CTKException, NucleotideLoadingException { return getSirnaNotation(senseSeq, antiSenseSeq, NucleotideParser.RNA_DESIGN_NONE); }
[ "public", "static", "HELM2Notation", "getSiRNANotation", "(", "String", "senseSeq", ",", "String", "antiSenseSeq", ")", "throws", "NotationException", ",", "FastaFormatException", ",", "HELM2HandledException", ",", "RNAUtilsException", ",", "org", ".", "helm", ".", "n...
this method converts nucleotide sequences into HELM2Notation @param senseSeq 5-3 nucleotide sequence for default notation @param antiSenseSeq 3-5 nucleotide sequence for default notation @return HELM2Notation for siRNA @throws NotationException if notation is not valid @throws FastaFormatException if the fasta input is not valid @throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format @throws RNAUtilsException if the polymer is not a RNA/DNA @throws org.helm.notation2.exception.NotationException if notation is not valid @throws ChemistryException if the Chemistry Engine can not be initialized @throws CTKException general ChemToolKit exception passed to HELMToolKit @throws NucleotideLoadingException if nucleotides can not be loaded
[ "this", "method", "converts", "nucleotide", "sequences", "into", "HELM2Notation" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SiRNANotation.java#L88-L93
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SiRNANotation.java
SiRNANotation.getSirnaNotation
public static HELM2Notation getSirnaNotation(String senseSeq, String antiSenseSeq, String rnaDesignType) throws NotationException, FastaFormatException, HELM2HandledException, RNAUtilsException, org.helm.notation2.exception.NotationException, ChemistryException, CTKException, NucleotideLoadingException { HELM2Notation helm2notation = null; if (senseSeq != null && senseSeq.length() > 0) { helm2notation = SequenceConverter.readRNA(senseSeq); } if (antiSenseSeq != null && antiSenseSeq.length() > 0) { PolymerNotation antisense = new PolymerNotation("RNA2"); antisense = new PolymerNotation(antisense.getPolymerID(), FastaFormat.generateElementsforRNA(antiSenseSeq, antisense.getPolymerID())); helm2notation.addPolymer(antisense); } validateSiRNADesign(helm2notation.getListOfPolymers().get(0), helm2notation.getListOfPolymers().get(1), rnaDesignType); helm2notation.getListOfConnections().addAll(hybridization(helm2notation.getListOfPolymers().get(0), helm2notation.getListOfPolymers().get(1), rnaDesignType)); ChangeObjects.addAnnotation(new AnnotationNotation("RNA1{ss}|RNA2{as}"), 0, helm2notation); return helm2notation; }
java
public static HELM2Notation getSirnaNotation(String senseSeq, String antiSenseSeq, String rnaDesignType) throws NotationException, FastaFormatException, HELM2HandledException, RNAUtilsException, org.helm.notation2.exception.NotationException, ChemistryException, CTKException, NucleotideLoadingException { HELM2Notation helm2notation = null; if (senseSeq != null && senseSeq.length() > 0) { helm2notation = SequenceConverter.readRNA(senseSeq); } if (antiSenseSeq != null && antiSenseSeq.length() > 0) { PolymerNotation antisense = new PolymerNotation("RNA2"); antisense = new PolymerNotation(antisense.getPolymerID(), FastaFormat.generateElementsforRNA(antiSenseSeq, antisense.getPolymerID())); helm2notation.addPolymer(antisense); } validateSiRNADesign(helm2notation.getListOfPolymers().get(0), helm2notation.getListOfPolymers().get(1), rnaDesignType); helm2notation.getListOfConnections().addAll(hybridization(helm2notation.getListOfPolymers().get(0), helm2notation.getListOfPolymers().get(1), rnaDesignType)); ChangeObjects.addAnnotation(new AnnotationNotation("RNA1{ss}|RNA2{as}"), 0, helm2notation); return helm2notation; }
[ "public", "static", "HELM2Notation", "getSirnaNotation", "(", "String", "senseSeq", ",", "String", "antiSenseSeq", ",", "String", "rnaDesignType", ")", "throws", "NotationException", ",", "FastaFormatException", ",", "HELM2HandledException", ",", "RNAUtilsException", ",",...
this method converts nucleotide sequences into HELM notation based on design pattern @param senseSeq 5-3 nucleotide sequence @param antiSenseSeq 3-5 nucleotide sequence @param rnaDesignType given design pattern @return HELM2Notation for siRNA @throws NotationException if notation is not valid @throws FastaFormatException if the fasta input is not valid @throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format @throws RNAUtilsException if the polymer is not a RNA/DNA @throws org.helm.notation2.exception.NotationException if notation is not valid @throws ChemistryException if the Chemistry Engine can not be initialized @throws CTKException general ChemToolKit exception passed to HELMToolKit @throws NucleotideLoadingException if nucleotides can not be loaded
[ "this", "method", "converts", "nucleotide", "sequences", "into", "HELM", "notation", "based", "on", "design", "pattern" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SiRNANotation.java#L115-L136
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SiRNANotation.java
SiRNANotation.hybridization
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; }
java
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; }
[ "private", "static", "List", "<", "ConnectionNotation", ">", "hybridization", "(", "PolymerNotation", "one", ",", "PolymerNotation", "two", ",", "String", "rnaDesignType", ")", "throws", "NotationException", ",", "HELM2HandledException", ",", "RNAUtilsException", ",", ...
method to generate a List of ConnectionNotation according to the given two polymerNotations and the rnaDesigntype @param one PolymerNotation @param two PolymerNotation @param rnaDesignType @return List of ConnectionNotations @throws NotationException if notation is not valid @throws org.helm.notation2.exception.NotationException if notation is not valid @throws RNAUtilsException if the polymer is not a RNA/DNA @throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format @throws ChemistryException if the Chemistry Engine can not be initialized @throws NucleotideLoadingException
[ "method", "to", "generate", "a", "List", "of", "ConnectionNotation", "according", "to", "the", "given", "two", "polymerNotations", "and", "the", "rnaDesigntype" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SiRNANotation.java#L157-L201
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SiRNANotation.java
SiRNANotation.hybridizationWithLengthFromStart
private static List<ConnectionNotation> hybridizationWithLengthFromStart(PolymerNotation one, PolymerNotation two, String senseAnalogSeq, String antisenseAnalogSeq, int lengthFromStart) throws NotationException { List<ConnectionNotation> connections = new ArrayList<ConnectionNotation>(); ConnectionNotation connection; for (int i = 0; i < lengthFromStart; i++) { int ssPos = i * 3 + 2; int asPos = (lengthFromStart - 1 - i) * 3 + 2; String ssChar = String.valueOf(senseAnalogSeq.charAt(i)); String asChar = String.valueOf(antisenseAnalogSeq.charAt(lengthFromStart - 1 - i)); if (complementMap.get(ssChar).equalsIgnoreCase(asChar)) { String details = ssPos + ":pair-" + asPos + ":pair"; connection = new ConnectionNotation(one.getPolymerID(), two.getPolymerID(), details); connections.add(connection); } } return connections; }
java
private static List<ConnectionNotation> hybridizationWithLengthFromStart(PolymerNotation one, PolymerNotation two, String senseAnalogSeq, String antisenseAnalogSeq, int lengthFromStart) throws NotationException { List<ConnectionNotation> connections = new ArrayList<ConnectionNotation>(); ConnectionNotation connection; for (int i = 0; i < lengthFromStart; i++) { int ssPos = i * 3 + 2; int asPos = (lengthFromStart - 1 - i) * 3 + 2; String ssChar = String.valueOf(senseAnalogSeq.charAt(i)); String asChar = String.valueOf(antisenseAnalogSeq.charAt(lengthFromStart - 1 - i)); if (complementMap.get(ssChar).equalsIgnoreCase(asChar)) { String details = ssPos + ":pair-" + asPos + ":pair"; connection = new ConnectionNotation(one.getPolymerID(), two.getPolymerID(), details); connections.add(connection); } } return connections; }
[ "private", "static", "List", "<", "ConnectionNotation", ">", "hybridizationWithLengthFromStart", "(", "PolymerNotation", "one", ",", "PolymerNotation", "two", ",", "String", "senseAnalogSeq", ",", "String", "antisenseAnalogSeq", ",", "int", "lengthFromStart", ")", "thro...
method to generate a List of ConnectionNotations given the two PolymerNotations and the sequences and the start point @param one PolymerNotation @param two PolymerNotation @param senseAnalogSeq sense Sequence @param antisenseAnalogSeq antisense Sequence @param lengthFromStart start position @return List of ConnectionNotations @throws NotationException if notation is not valid
[ "method", "to", "generate", "a", "List", "of", "ConnectionNotations", "given", "the", "two", "PolymerNotations", "and", "the", "sequences", "and", "the", "start", "point" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SiRNANotation.java#L221-L238
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/SiRNANotation.java
SiRNANotation.validateSiRNADesign
private static boolean validateSiRNADesign(PolymerNotation one, PolymerNotation two, String rnaDesignType) throws RNAUtilsException, HELM2HandledException, NotationException, ChemistryException { if (NucleotideParser.RNA_DESIGN_NONE.equalsIgnoreCase(rnaDesignType)) { return true; } if (!NucleotideParser.SUPPORTED_DESIGN_LIST.contains(rnaDesignType)) { throw new NotationException("Unsupported RNA Design Type '" + rnaDesignType + "'"); } List<Nucleotide> senseNucList = RNAUtils.getNucleotideList(one); List<Nucleotide> antisenseNucList = RNAUtils.getNucleotideList(two); if (rnaDesignType.equals(NucleotideParser.RNA_DESIGN_TUSCHL_19_PLUS_2)) { if (senseNucList.size() != 21) { throw new NotationException("Sense strand for Tuschl 19+2 design must have 21 nucleotides"); } if (antisenseNucList.size() != 21) { throw new NotationException("Antisense strand for Tuschl 19+2 design must have 21 nucleotides"); } } else if (rnaDesignType.equals(NucleotideParser.RNA_DESIGN_DICER_27_R)) { if (senseNucList.size() != 25) { throw new NotationException("Sense strand for Dicer 27R design must have 25 nucleotides"); } if (antisenseNucList.size() != 27) { throw new NotationException("Antisense strand for Dicer 27R design must have 27 nucleotides"); } } else if (rnaDesignType.equals(NucleotideParser.RNA_DESIGN_DICER_27_L)) { if (senseNucList.size() != 27) { throw new NotationException("Sense strand for Dicer 27L design must have 27 nucleotides"); } if (antisenseNucList.size() != 25) { throw new NotationException("Antisense strand for Dicer 27L design must have 25 nucleotides"); } } return true; }
java
private static boolean validateSiRNADesign(PolymerNotation one, PolymerNotation two, String rnaDesignType) throws RNAUtilsException, HELM2HandledException, NotationException, ChemistryException { if (NucleotideParser.RNA_DESIGN_NONE.equalsIgnoreCase(rnaDesignType)) { return true; } if (!NucleotideParser.SUPPORTED_DESIGN_LIST.contains(rnaDesignType)) { throw new NotationException("Unsupported RNA Design Type '" + rnaDesignType + "'"); } List<Nucleotide> senseNucList = RNAUtils.getNucleotideList(one); List<Nucleotide> antisenseNucList = RNAUtils.getNucleotideList(two); if (rnaDesignType.equals(NucleotideParser.RNA_DESIGN_TUSCHL_19_PLUS_2)) { if (senseNucList.size() != 21) { throw new NotationException("Sense strand for Tuschl 19+2 design must have 21 nucleotides"); } if (antisenseNucList.size() != 21) { throw new NotationException("Antisense strand for Tuschl 19+2 design must have 21 nucleotides"); } } else if (rnaDesignType.equals(NucleotideParser.RNA_DESIGN_DICER_27_R)) { if (senseNucList.size() != 25) { throw new NotationException("Sense strand for Dicer 27R design must have 25 nucleotides"); } if (antisenseNucList.size() != 27) { throw new NotationException("Antisense strand for Dicer 27R design must have 27 nucleotides"); } } else if (rnaDesignType.equals(NucleotideParser.RNA_DESIGN_DICER_27_L)) { if (senseNucList.size() != 27) { throw new NotationException("Sense strand for Dicer 27L design must have 27 nucleotides"); } if (antisenseNucList.size() != 25) { throw new NotationException("Antisense strand for Dicer 27L design must have 25 nucleotides"); } } return true; }
[ "private", "static", "boolean", "validateSiRNADesign", "(", "PolymerNotation", "one", ",", "PolymerNotation", "two", ",", "String", "rnaDesignType", ")", "throws", "RNAUtilsException", ",", "HELM2HandledException", ",", "NotationException", ",", "ChemistryException", "{",...
validates the required siRNA @param senseSeq @param antiSenseSeq @param rnaDesignType @return true, if it is valid, throws an exception otherwise @throws HELM2HandledException if it contains HELM2 specific features, so that it can not be casted to HELM1 Format @throws RNAUtilsException if the polymer is not a RNA/DNA @throws NotationException if notation is not valid @throws ChemistryException if chemistry engine can not be initialized
[ "validates", "the", "required", "siRNA" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SiRNANotation.java#L252-L290
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.getMonomerDB
public synchronized Map<String, Map<String, Monomer>> getMonomerDB(boolean includeNewMonomers) { if (includeNewMonomers) { return monomerDB; } else { Map<String, Map<String, Monomer>> reducedMonomerDB = new TreeMap<String, Map<String, Monomer>>( String.CASE_INSENSITIVE_ORDER); for (String polymerType : monomerDB.keySet()) { Map<String, Monomer> monomerMap = monomerDB.get(polymerType); reducedMonomerDB.put(polymerType, excludeNewMonomers(monomerMap)); } return reducedMonomerDB; } }
java
public synchronized Map<String, Map<String, Monomer>> getMonomerDB(boolean includeNewMonomers) { if (includeNewMonomers) { return monomerDB; } else { Map<String, Map<String, Monomer>> reducedMonomerDB = new TreeMap<String, Map<String, Monomer>>( String.CASE_INSENSITIVE_ORDER); for (String polymerType : monomerDB.keySet()) { Map<String, Monomer> monomerMap = monomerDB.get(polymerType); reducedMonomerDB.put(polymerType, excludeNewMonomers(monomerMap)); } return reducedMonomerDB; } }
[ "public", "synchronized", "Map", "<", "String", ",", "Map", "<", "String", ",", "Monomer", ">", ">", "getMonomerDB", "(", "boolean", "includeNewMonomers", ")", "{", "if", "(", "includeNewMonomers", ")", "{", "return", "monomerDB", ";", "}", "else", "{", "M...
returns the monomer database including monomers that where temporary marked as new, else without those monomers @param includeNewMonomers if true, then the new monomers will be added to the monomer db @return Map as {@code Map<String, Map<String, Monomer>>}
[ "returns", "the", "monomer", "database", "including", "monomers", "that", "where", "temporary", "marked", "as", "new", "else", "without", "those", "monomers" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L149-L161
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.getInstance
public static MonomerFactory getInstance() throws MonomerLoadingException, ChemistryException { if (null == instance) { refreshMonomerCache(); } else if (MonomerStoreConfiguration.getInstance().isUseWebservice() && MonomerStoreConfiguration.getInstance().isUpdateAutomatic()) { refreshMonomerCache(); } return instance; }
java
public static MonomerFactory getInstance() throws MonomerLoadingException, ChemistryException { if (null == instance) { refreshMonomerCache(); } else if (MonomerStoreConfiguration.getInstance().isUseWebservice() && MonomerStoreConfiguration.getInstance().isUpdateAutomatic()) { refreshMonomerCache(); } return instance; }
[ "public", "static", "MonomerFactory", "getInstance", "(", ")", "throws", "MonomerLoadingException", ",", "ChemistryException", "{", "if", "(", "null", "==", "instance", ")", "{", "refreshMonomerCache", "(", ")", ";", "}", "else", "if", "(", "MonomerStoreConfigurat...
Initialize MonomerCache and returns the singleton Factory class @return MonomerFactory current monomerfactory @throws MonomerLoadingException if the monomer could not be loaded from the source @throws ChemistryException if the chemistry could not be initialized
[ "Initialize", "MonomerCache", "and", "returns", "the", "singleton", "Factory", "class" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L286-L296
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.addNewMonomer
public synchronized void addNewMonomer(Monomer monomer) throws IOException, MonomerException { monomer.setNewMonomer(true); addMonomer(monomerDB, smilesMonomerDB, monomer); dbChanged = true; }
java
public synchronized void addNewMonomer(Monomer monomer) throws IOException, MonomerException { monomer.setNewMonomer(true); addMonomer(monomerDB, smilesMonomerDB, monomer); dbChanged = true; }
[ "public", "synchronized", "void", "addNewMonomer", "(", "Monomer", "monomer", ")", "throws", "IOException", ",", "MonomerException", "{", "monomer", ".", "setNewMonomer", "(", "true", ")", ";", "addMonomer", "(", "monomerDB", ",", "smilesMonomerDB", ",", "monomer"...
To add new monomer into monomerCache @param monomer given Monomer @throws IOException if monomer store can not be read @throws MonomerException if monomer is not valid
[ "To", "add", "new", "monomer", "into", "monomerCache" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L360-L365
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.buildMonomerCacheFromXML
public MonomerCache buildMonomerCacheFromXML(String monomerDBXML) throws MonomerException, IOException, JDOMException, ChemistryException, CTKException { ByteArrayInputStream bais = new ByteArrayInputStream(monomerDBXML.getBytes()); return buildMonomerCacheFromXML(bais); }
java
public MonomerCache buildMonomerCacheFromXML(String monomerDBXML) throws MonomerException, IOException, JDOMException, ChemistryException, CTKException { ByteArrayInputStream bais = new ByteArrayInputStream(monomerDBXML.getBytes()); return buildMonomerCacheFromXML(bais); }
[ "public", "MonomerCache", "buildMonomerCacheFromXML", "(", "String", "monomerDBXML", ")", "throws", "MonomerException", ",", "IOException", ",", "JDOMException", ",", "ChemistryException", ",", "CTKException", "{", "ByteArrayInputStream", "bais", "=", "new", "ByteArrayInp...
Build an MonomerCache object with monomerDBXML String @param monomerDBXML monomer db in xml format as string @return MonomerCache @throws org.helm.notation2.exception.MonomerException if monomer is not valid @throws java.io.IOException if string can not be read @throws org.jdom2.JDOMException if xml file is not valid @throws ChemistryException if chemistry could not be initialized @throws CTKException general ChemToolKit exception passed to HELMToolKit
[ "Build", "an", "MonomerCache", "object", "with", "monomerDBXML", "String" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L407-L411
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.merge
public synchronized void merge(MonomerCache remoteMonomerCache) throws IOException, MonomerException { Map<Monomer, Monomer> conflicts = getConflictedMonomerMap(remoteMonomerCache); if (conflicts.size() > 0) { throw new MonomerException("Local new monomer and remote monomer database conflict found"); } else { Map<String, Map<String, Monomer>> monoDB = remoteMonomerCache.getMonomerDB(); Set<String> polymerTypeSet = monoDB.keySet(); for (Iterator i = polymerTypeSet.iterator(); i.hasNext();) { String polymerType = (String) i.next(); Map<String, Monomer> map = monoDB.get(polymerType); Set<String> monomerSet = map.keySet(); for (Iterator it = monomerSet.iterator(); it.hasNext();) { String id = (String) it.next(); Monomer m = map.get(id); addMonomer(monomerDB, smilesMonomerDB, m); } } } dbChanged = true; }
java
public synchronized void merge(MonomerCache remoteMonomerCache) throws IOException, MonomerException { Map<Monomer, Monomer> conflicts = getConflictedMonomerMap(remoteMonomerCache); if (conflicts.size() > 0) { throw new MonomerException("Local new monomer and remote monomer database conflict found"); } else { Map<String, Map<String, Monomer>> monoDB = remoteMonomerCache.getMonomerDB(); Set<String> polymerTypeSet = monoDB.keySet(); for (Iterator i = polymerTypeSet.iterator(); i.hasNext();) { String polymerType = (String) i.next(); Map<String, Monomer> map = monoDB.get(polymerType); Set<String> monomerSet = map.keySet(); for (Iterator it = monomerSet.iterator(); it.hasNext();) { String id = (String) it.next(); Monomer m = map.get(id); addMonomer(monomerDB, smilesMonomerDB, m); } } } dbChanged = true; }
[ "public", "synchronized", "void", "merge", "(", "MonomerCache", "remoteMonomerCache", ")", "throws", "IOException", ",", "MonomerException", "{", "Map", "<", "Monomer", ",", "Monomer", ">", "conflicts", "=", "getConflictedMonomerMap", "(", "remoteMonomerCache", ")", ...
merge remote monomerCache with local monomerCache, will throw exception if conflicts found. Client needs to resolve conflicts prior to calling merge @param remoteMonomerCache remote monomer cache @throws java.io.IOException if monomer store can not be read @throws org.helm.notation2.exception.MonomerException if monomer is not valid
[ "merge", "remote", "monomerCache", "with", "local", "monomerCache", "will", "throw", "exception", "if", "conflicts", "found", ".", "Client", "needs", "to", "resolve", "conflicts", "prior", "to", "calling", "merge" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L425-L446
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.setMonomerCache
public synchronized void setMonomerCache(MonomerCache remoteMonomerCache) throws IOException, MonomerException { monomerDB = remoteMonomerCache.getMonomerDB(); attachmentDB = remoteMonomerCache.getAttachmentDB(); smilesMonomerDB = remoteMonomerCache.getSmilesMonomerDB(); dbChanged = true; }
java
public synchronized void setMonomerCache(MonomerCache remoteMonomerCache) throws IOException, MonomerException { monomerDB = remoteMonomerCache.getMonomerDB(); attachmentDB = remoteMonomerCache.getAttachmentDB(); smilesMonomerDB = remoteMonomerCache.getSmilesMonomerDB(); dbChanged = true; }
[ "public", "synchronized", "void", "setMonomerCache", "(", "MonomerCache", "remoteMonomerCache", ")", "throws", "IOException", ",", "MonomerException", "{", "monomerDB", "=", "remoteMonomerCache", ".", "getMonomerDB", "(", ")", ";", "attachmentDB", "=", "remoteMonomerCac...
replace local cache with remote one completely, may cause loss of data @param remoteMonomerCache remote monomer cache @throws java.io.IOException if monomer store can not be read @throws org.helm.notation2.exception.MonomerException if monomer is not valid
[ "replace", "local", "cache", "with", "remote", "one", "completely", "may", "cause", "loss", "of", "data" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L458-L464
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.buildAttachmentDB
private static Map<String, Attachment> buildAttachmentDB() throws IOException { Map<String, Attachment> map = new TreeMap<String, Attachment>(String.CASE_INSENSITIVE_ORDER); if (MonomerStoreConfiguration.getInstance().isUseExternalAttachments()) { map = AttachmentLoader.loadAttachments( new FileInputStream(MonomerStoreConfiguration.getInstance().getExternalAttachmentsPath())); } else { InputStream in = MonomerFactory.class.getResourceAsStream(ATTACHMENTS_RESOURCE); map = AttachmentLoader.loadAttachments(in); } return map; }
java
private static Map<String, Attachment> buildAttachmentDB() throws IOException { Map<String, Attachment> map = new TreeMap<String, Attachment>(String.CASE_INSENSITIVE_ORDER); if (MonomerStoreConfiguration.getInstance().isUseExternalAttachments()) { map = AttachmentLoader.loadAttachments( new FileInputStream(MonomerStoreConfiguration.getInstance().getExternalAttachmentsPath())); } else { InputStream in = MonomerFactory.class.getResourceAsStream(ATTACHMENTS_RESOURCE); map = AttachmentLoader.loadAttachments(in); } return map; }
[ "private", "static", "Map", "<", "String", ",", "Attachment", ">", "buildAttachmentDB", "(", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Attachment", ">", "map", "=", "new", "TreeMap", "<", "String", ",", "Attachment", ">", "(", "String"...
builds attachment db from default file or external file @return attachment db @throws IOException if the given attachments can not be read or the file doesn't exist or the attachment is not valid
[ "builds", "attachment", "db", "from", "default", "file", "or", "external", "file" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L599-L614
train
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/MonomerFactory.java
MonomerFactory.saveMonomerCache
public void saveMonomerCache() throws IOException, MonomerException { File f = new File(NOTATION_DIRECTORY); if (!f.exists()) { f.mkdir(); } MonomerCache cache = new MonomerCache(); cache.setMonomerDB(getMonomerDB(false)); cache.setAttachmentDB(getAttachmentDB()); cache.setSmilesMonomerDB(getSmilesMonomerDB(false)); serializeMonomerCache(cache, MONOMER_CACHE_FILE_PATH); String monomerDbXML = buildMonomerDbXMLFromCache(cache); FileOutputStream fos = new FileOutputStream(MONOMER_DB_FILE_PATH); fos.write(monomerDbXML.getBytes()); fos.close(); }
java
public void saveMonomerCache() throws IOException, MonomerException { File f = new File(NOTATION_DIRECTORY); if (!f.exists()) { f.mkdir(); } MonomerCache cache = new MonomerCache(); cache.setMonomerDB(getMonomerDB(false)); cache.setAttachmentDB(getAttachmentDB()); cache.setSmilesMonomerDB(getSmilesMonomerDB(false)); serializeMonomerCache(cache, MONOMER_CACHE_FILE_PATH); String monomerDbXML = buildMonomerDbXMLFromCache(cache); FileOutputStream fos = new FileOutputStream(MONOMER_DB_FILE_PATH); fos.write(monomerDbXML.getBytes()); fos.close(); }
[ "public", "void", "saveMonomerCache", "(", ")", "throws", "IOException", ",", "MonomerException", "{", "File", "f", "=", "new", "File", "(", "NOTATION_DIRECTORY", ")", ";", "if", "(", "!", "f", ".", "exists", "(", ")", ")", "{", "f", ".", "mkdir", "(",...
save monomerCache to disk file @throws java.io.IOException if the monomer can not be saved to disk file @throws MonomerException if monomer is not valid
[ "save", "monomerCache", "to", "disk", "file" ]
ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/MonomerFactory.java#L763-L779
train
kiswanij/jk-util
src/main/java/com/jk/util/annotations/AnnotationDetector.java
AnnotationDetector.scan
public static void scan(final Class<? extends Annotation> clas, final String[] basePackage, final AnnotationHandler handler) { final ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false); scanner.setResourceLoader(new PathMatchingResourcePatternResolver(Thread.currentThread().getContextClassLoader())); scanner.addIncludeFilter(new AnnotationTypeFilter(clas)); for (final String pck : basePackage) { for (final BeanDefinition bd : scanner.findCandidateComponents(pck)) { handler.handleAnnotationFound(bd.getBeanClassName()); } } }
java
public static void scan(final Class<? extends Annotation> clas, final String[] basePackage, final AnnotationHandler handler) { final ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false); scanner.setResourceLoader(new PathMatchingResourcePatternResolver(Thread.currentThread().getContextClassLoader())); scanner.addIncludeFilter(new AnnotationTypeFilter(clas)); for (final String pck : basePackage) { for (final BeanDefinition bd : scanner.findCandidateComponents(pck)) { handler.handleAnnotationFound(bd.getBeanClassName()); } } }
[ "public", "static", "void", "scan", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clas", ",", "final", "String", "[", "]", "basePackage", ",", "final", "AnnotationHandler", "handler", ")", "{", "final", "ClassPathScanningCandidateComponentProvide...
Utility method to scan the given package and handler for the annotation of the given class. Its uses the Spring annotation detector @param clas the clas @param basePackage the base package @param handler the handler
[ "Utility", "method", "to", "scan", "the", "given", "package", "and", "handler", "for", "the", "annotation", "of", "the", "given", "class", ".", "Its", "uses", "the", "Spring", "annotation", "detector" ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/annotations/AnnotationDetector.java#L45-L54
train
kiswanij/jk-util
src/main/java/com/jk/util/annotations/AnnotationDetector.java
AnnotationDetector.scanAsList
public static List<String> scanAsList(final Class<? extends Annotation> clas, final String... basePackage) { final List<String> classes = new ArrayList<>(); scan(clas, basePackage, new AnnotationHandler() { @Override public void handleAnnotationFound(String className) { classes.add(className); } }); return classes; }
java
public static List<String> scanAsList(final Class<? extends Annotation> clas, final String... basePackage) { final List<String> classes = new ArrayList<>(); scan(clas, basePackage, new AnnotationHandler() { @Override public void handleAnnotationFound(String className) { classes.add(className); } }); return classes; }
[ "public", "static", "List", "<", "String", ">", "scanAsList", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clas", ",", "final", "String", "...", "basePackage", ")", "{", "final", "List", "<", "String", ">", "classes", "=", "new", "Arra...
Scan as list. @param clas the clas @param basePackage the base package @return the list
[ "Scan", "as", "list", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/annotations/AnnotationDetector.java#L63-L73
train
demidenko05/beige-uml
beige-uml-swing/src/main/java/org/beigesoft/uml/ui/swing/PaneProjectLight.java
PaneProjectLight.refreshGuiAndShowFile
@Override public void refreshGuiAndShowFile(File file) { if(rootNode.getChildCount() > 0) { rootNode.removeAllChildren(); treeModel.reload(); } if(guiMain.getAsmProjectUml().getProjectUml() != null) { addTreeNodes(file); guiMain.getMenuMain().setVisibleProjectMenu(true); } else { guiMain.getMenuMain().setVisibleProjectMenu(false); } }
java
@Override public void refreshGuiAndShowFile(File file) { if(rootNode.getChildCount() > 0) { rootNode.removeAllChildren(); treeModel.reload(); } if(guiMain.getAsmProjectUml().getProjectUml() != null) { addTreeNodes(file); guiMain.getMenuMain().setVisibleProjectMenu(true); } else { guiMain.getMenuMain().setVisibleProjectMenu(false); } }
[ "@", "Override", "public", "void", "refreshGuiAndShowFile", "(", "File", "file", ")", "{", "if", "(", "rootNode", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "rootNode", ".", "removeAllChildren", "(", ")", ";", "treeModel", ".", "reload", "(", ")...
refresh tree and expand to file that usually newly created
[ "refresh", "tree", "and", "expand", "to", "file", "that", "usually", "newly", "created" ]
65f6024fa944e10875d9a3be3e4a586bede39683
https://github.com/demidenko05/beige-uml/blob/65f6024fa944e10875d9a3be3e4a586bede39683/beige-uml-swing/src/main/java/org/beigesoft/uml/ui/swing/PaneProjectLight.java#L231-L244
train
kiswanij/jk-util
src/main/java/com/jk/util/JK.java
JK.buildToString
public static String buildToString(Object... params) { StringBuffer finalMessage = new StringBuffer(); int i = 0; for (Object object : params) { if (i++ > 0) { finalMessage.append(FIELD_SEPARATOR); } if (object instanceof List<?>) { finalMessage.append(JKCollectionUtil.toString((List<?>) object)); } else { finalMessage.append(JKObjectUtil.toString(object, true)); } } String fullText = finalMessage.toString(); return fullText; }
java
public static String buildToString(Object... params) { StringBuffer finalMessage = new StringBuffer(); int i = 0; for (Object object : params) { if (i++ > 0) { finalMessage.append(FIELD_SEPARATOR); } if (object instanceof List<?>) { finalMessage.append(JKCollectionUtil.toString((List<?>) object)); } else { finalMessage.append(JKObjectUtil.toString(object, true)); } } String fullText = finalMessage.toString(); return fullText; }
[ "public", "static", "String", "buildToString", "(", "Object", "...", "params", ")", "{", "StringBuffer", "finalMessage", "=", "new", "StringBuffer", "(", ")", ";", "int", "i", "=", "0", ";", "for", "(", "Object", "object", ":", "params", ")", "{", "if", ...
Builds the to string. @param params the params @return the string
[ "Builds", "the", "to", "string", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L165-L180
train
kiswanij/jk-util
src/main/java/com/jk/util/JK.java
JK.toMap
public static Map toMap(Object[] keys, Object[] values) { Map map = new HashMap<>(); int i = 0; for (Object key : keys) { map.put(key, values[i++]); } return map; }
java
public static Map toMap(Object[] keys, Object[] values) { Map map = new HashMap<>(); int i = 0; for (Object key : keys) { map.put(key, values[i++]); } return map; }
[ "public", "static", "Map", "toMap", "(", "Object", "[", "]", "keys", ",", "Object", "[", "]", "values", ")", "{", "Map", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "int", "i", "=", "0", ";", "for", "(", "Object", "key", ":", "keys", ")"...
To map. @param keys the keys @param values the values @return the map
[ "To", "map", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L250-L257
train
kiswanij/jk-util
src/main/java/com/jk/util/JK.java
JK.validateNull
public static void validateNull(String name, Object object) { if (object == null) { throw new IllegalStateException(name.concat(" cannot be null")); } }
java
public static void validateNull(String name, Object object) { if (object == null) { throw new IllegalStateException(name.concat(" cannot be null")); } }
[ "public", "static", "void", "validateNull", "(", "String", "name", ",", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "name", ".", "concat", "(", "\" cannot be null\"", ")", ")", ";...
Validate null. @param name the name @param object the object
[ "Validate", "null", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L307-L311
train
kiswanij/jk-util
src/main/java/com/jk/util/JK.java
JK.addToSystemConfig
public static void addToSystemConfig(String prefix, Properties prop) { for (Entry<Object, Object> entry : prop.entrySet()) { String key = prefix.concat(entry.getKey().toString()); String value = entry.getValue().toString(); System.setProperty(key, value); } }
java
public static void addToSystemConfig(String prefix, Properties prop) { for (Entry<Object, Object> entry : prop.entrySet()) { String key = prefix.concat(entry.getKey().toString()); String value = entry.getValue().toString(); System.setProperty(key, value); } }
[ "public", "static", "void", "addToSystemConfig", "(", "String", "prefix", ",", "Properties", "prop", ")", "{", "for", "(", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "prop", ".", "entrySet", "(", ")", ")", "{", "String", "key", "=", "pre...
Adds the to system config. @param prefix the prefix @param prop the prop
[ "Adds", "the", "to", "system", "config", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L414-L420
train
kiswanij/jk-util
src/main/java/com/jk/util/JK.java
JK.readPassword
public static char[] readPassword(String msg) { Console console = System.console(); if (console != null) { return console.readPassword(); } // console not available, most likely because of running inside IDE, try normal scanner = getScanner(); System.out.print(msg); return scanner.nextLine().toCharArray(); }
java
public static char[] readPassword(String msg) { Console console = System.console(); if (console != null) { return console.readPassword(); } // console not available, most likely because of running inside IDE, try normal scanner = getScanner(); System.out.print(msg); return scanner.nextLine().toCharArray(); }
[ "public", "static", "char", "[", "]", "readPassword", "(", "String", "msg", ")", "{", "Console", "console", "=", "System", ".", "console", "(", ")", ";", "if", "(", "console", "!=", "null", ")", "{", "return", "console", ".", "readPassword", "(", ")", ...
Read password. @param msg the msg @return the char[]
[ "Read", "password", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L456-L465
train
kiswanij/jk-util
src/main/java/com/jk/util/JK.java
JK.printOnce
public static void printOnce(Object msg) { if (messagesCache.get(msg.hashCode()) == null) { JK.printBlock(msg); messagesCache.put(msg.hashCode(), msg); } }
java
public static void printOnce(Object msg) { if (messagesCache.get(msg.hashCode()) == null) { JK.printBlock(msg); messagesCache.put(msg.hashCode(), msg); } }
[ "public", "static", "void", "printOnce", "(", "Object", "msg", ")", "{", "if", "(", "messagesCache", ".", "get", "(", "msg", ".", "hashCode", "(", ")", ")", "==", "null", ")", "{", "JK", ".", "printBlock", "(", "msg", ")", ";", "messagesCache", ".", ...
Print the message and then save it into list to avoid reporing it again, it can be helpfull to debugging purposes. @param msg the msg
[ "Print", "the", "message", "and", "then", "save", "it", "into", "list", "to", "avoid", "reporing", "it", "again", "it", "can", "be", "helpfull", "to", "debugging", "purposes", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L473-L478
train
kiswanij/jk-util
src/main/java/com/jk/util/JK.java
JK.getAppName
public static String getAppName() { String appName=System.getProperty(JKContextConstants.JK_APP_NAME); if (appName == null) { String mainClassName = JKDebugUtil.getMainClassName(); return mainClassName.substring(0, mainClassName.lastIndexOf(".")); } return appName; }
java
public static String getAppName() { String appName=System.getProperty(JKContextConstants.JK_APP_NAME); if (appName == null) { String mainClassName = JKDebugUtil.getMainClassName(); return mainClassName.substring(0, mainClassName.lastIndexOf(".")); } return appName; }
[ "public", "static", "String", "getAppName", "(", ")", "{", "String", "appName", "=", "System", ".", "getProperty", "(", "JKContextConstants", ".", "JK_APP_NAME", ")", ";", "if", "(", "appName", "==", "null", ")", "{", "String", "mainClassName", "=", "JKDebug...
Gets the app name. @return the app name
[ "Gets", "the", "app", "name", "." ]
8e0c85818423406f769444c76194a748e0a0fc0a
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JK.java#L540-L547
train