本文整理汇总了Java中org.helm.notation.NotationException类的典型用法代码示例。如果您正苦于以下问题:Java NotationException类的具体用法?Java NotationException怎么用?Java NotationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotationException类属于org.helm.notation包,在下文中一共展示了NotationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInlineSmilesChem
import org.helm.notation.NotationException; //导入依赖的package包/类
@Test
public void testInlineSmilesChem() throws JDOMException, IOException,
MonomerException, NotationException, StructureException,
ClassNotFoundException {
Element xHELMRootElement = getXHELMRootElement("resources/inlineSmilesChem.xhelm");
String helmString = xHelmNotationParser
.getComplexNotationString(xHELMRootElement);
MonomerStore store = xHelmNotationParser
.getMonomerStore(xHELMRootElement);
boolean valid = ComplexNotationParser.validateComplexNotation(
helmString, store);
assertTrue(valid);
}
示例2: parse
import org.helm.notation.NotationException; //导入依赖的package包/类
/**
* This method convert the complex polymer extendendNotation into an
* ComplexPolymer object Will throw NotationException if graph
* extendendNotation format is invalid
*
* @param extendendNotation
* @param monomerStore
* @return ComplexPolymer
* @throws org.helm.notation.NotationException
* @throws org.helm.notation.MonomerException
*/
public static ComplexPolymer parse(String extendendNotation,
MonomerStore monomerStore) throws NotationException,
MonomerException, JDOMException, IOException {
ComplexPolymer cp = new ComplexPolymer();
String allNodeString = getAllNodeString(extendendNotation);
List<PolymerNode> nodes = getPolymerNodeList(allNodeString,
monomerStore);
cp.setPolymerNodeList(nodes);
String allEdgeString = getAllEdgeString(extendendNotation);
List<PolymerEdge> edges = getPolymerEdgeList(allEdgeString);
cp.setPolymerEdgeList(edges);
String allBasePairString = getAllBasePairString(extendendNotation);
List<PolymerEdge> basePairEdges = getPolymerEdgeList(allBasePairString);
cp.setBasePairList(basePairEdges);
String allNodeLabelString = getAllNodeLabelString(extendendNotation);
Map<String, String> annotationMap = getPolymerNodeIDAnnotationMap(allNodeLabelString);
cp.setPolymerNodeAnnotationMap(annotationMap);
return cp;
}
示例3: testQRPeptide
import org.helm.notation.NotationException; //导入依赖的package包/类
@Test
public void testQRPeptide() throws JDOMException, IOException,
MonomerException, NotationException, StructureException,
ClassNotFoundException {
Element xHELMRootElement = getXHELMRootElement("resources/qr_peptide.xhelm");
String helmString = xHelmNotationParser
.getComplexNotationString(xHELMRootElement);
MonomerStore store = xHelmNotationParser
.getMonomerStore(xHELMRootElement);
assertEquals("PEPTIDE1{[QR]}$$$$", helmString);
assertTrue(ComplexNotationParser.validateComplexNotation(helmString,
store));
}
示例4: getNotation
import org.helm.notation.NotationException; //导入依赖的package包/类
public String getNotation() throws NotationException, IOException,
MonomerException, JDOMException {
ComplexProtein cp = new ComplexProtein();
cp.setSequences(getSequences());
if (annotationTable.getCellEditor() != null) {
annotationTable.getCellEditor().stopCellEditing();
}
cp.setAnnotations(annotationTableModel
.getPopulatedSeqeuenceAnnotations());
if (connectionTable.getCellEditor() != null) {
connectionTable.getCellEditor().stopCellEditing();
}
cp.setConnections(connectionTableModel.getPopulatedConnections());
return cp.getNotation();
}
示例5: getTotalMonomerCount
import org.helm.notation.NotationException; //导入依赖的package包/类
public static int getTotalMonomerCount(String notation,
MonomerStore monomerStore) throws NotationException {
monomerStore = checkForMonomerStore(monomerStore);
int totalMonomerCount = 0;
List<PolymerNode> nodes = ComplexNotationParser.getPolymerNodeList(
notation, monomerStore);
for (PolymerNode node : nodes) {
String polymerType = node.getType();
String label = node.getLabel();
int monomerCount = SimpleNotationParser.getMonomerCount(label,
polymerType, monomerStore);
totalMonomerCount = totalMonomerCount + monomerCount;
}
return totalMonomerCount;
}
示例6: getComplexNotation
import org.helm.notation.NotationException; //导入依赖的package包/类
/**
* This method return the HELM complex notation for nucleotide sequences,
* which could have more than one strand separated by space
*
* @param nucleotideSequences
* @return complex notatoion
* @throws NotationException
* @throws MonomerException
* @throws IOException
* @throws JDOMException
* @throws StructureException
*/
public String getComplexNotation(String nucleotideSequences)
throws NotationException, MonomerException, IOException,
JDOMException, StructureException {
if (null == nucleotideSequences
|| nucleotideSequences.trim().length() == 0) {
return null;
}
String result = null;
String[] singles = nucleotideSequences.split("\\s");
if (singles.length == 1) {
result = getComplexNotationFromSingleNucleotideSequence(singles[0]);
} else {
result = getComplexNotationFromSingleNucleotideSequence(singles[0]);
for (int i = 1; i < singles.length; i++) {
String notation = getComplexNotationFromSingleNucleotideSequence(singles[i]);
result = ComplexNotationParser.getCombinedComlexNotation(
result, notation);
}
}
result = ComplexNotationParser.hybridize(result);
return result;
}
示例7: validatePairEdge
import org.helm.notation.NotationException; //导入依赖的package包/类
private static void validatePairEdge(PolymerEdge edge,
Map<String, String> nodeMap) throws NotationException {
if (edge.getEdgeType() != PolymerEdge.PAIR_EDGE) {
throw new NotationException("Invalid base pair edge: "
+ edge.getEdgeNotation() + " => " + edge.toString());
}
if (!(nodeMap.containsKey(edge.getSourceNode()))) {
throw new NotationException(
"Polymer edge contains unknown polymer node ID");
}
if (!(nodeMap.containsKey(edge.getTargetNode()))) {
throw new NotationException(
"Polymer edge contains unknown polymer node ID");
}
}
示例8: validateNodeID
import org.helm.notation.NotationException; //导入依赖的package包/类
/**
* nodeID must be in the format of Letters followed by Numbers, throws
* NotationException if invalid
*
* @param nodeID
* @throws org.helm.notation.NotationException
*/
private static boolean validateNodeID(String nodeID)
throws NotationException {
char[] chars = nodeID.toCharArray();
if (!(String.valueOf(chars[0]).matches("[A-Za-z]"))) {
throw new NotationException(INVALID_NODE_ID + ": " + nodeID);
}
if (!(String.valueOf(chars[chars.length - 1]).matches("[0-9]"))) {
throw new NotationException(INVALID_NODE_ID + ": " + nodeID);
}
boolean foundNum = false;
for (int i = 0; i < chars.length; i++) {
if (String.valueOf(chars[i]).matches("[0-9]")) {
foundNum = true;
}
if (foundNum) {
if ((String.valueOf(chars[i]).matches("[A-Za-z]"))) {
throw new NotationException(INVALID_NODE_ID + ": " + nodeID);
}
}
}
return true;
}
示例9: replaceMonomer
import org.helm.notation.NotationException; //导入依赖的package包/类
/**
* This method replaces existing monomer with new monomer in simple polymer
* notation
*
* @param simpleNotation
* @param polymerType
* @param existingMonomerID
* @param newMonomerID
* @param monomerStore
* @param validate
* - true will run monomer replacement validation, false will not
* run validation
* @return simple notation after replacement
* @throws org.helm.notation.MonomerException
* @throws java.io.IOException
* @throws org.jdom.JDOMException
* @throws org.helm.notation.NotationException
*/
public static String replaceMonomer(String simpleNotation,
String polymerType, String existingMonomerID, String newMonomerID,
MonomerStore monomerStore, boolean validate)
throws MonomerException, IOException, JDOMException,
NotationException {
if (validate) {
boolean valid = validateMonomerReplacement(polymerType,
existingMonomerID, newMonomerID, monomerStore);
}
List<String> monomerIDs = getMonomerIDList(simpleNotation, polymerType,
monomerStore);
for (int i = 0; i < monomerIDs.size(); i++) {
String tmp = monomerIDs.get(i);
if (tmp.equals(existingMonomerID)) {
monomerIDs.set(i, newMonomerID);
}
}
return getSimpleNotation(monomerIDs, polymerType, monomerStore);
}
示例10: copy
import org.helm.notation.NotationException; //导入依赖的package包/类
public static Nucleotide copy(Nucleotide nucleotide) throws IOException,
NotationException {
ByteArrayOutputStream baos = new ByteArrayOutputStream(100);
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(nucleotide);
byte buf[] = baos.toByteArray();
oos.close();
// deserialize byte array into ArrayList
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
ObjectInputStream ois = new ObjectInputStream(bais);
Nucleotide nuc;
try {
nuc = (Nucleotide) ois.readObject();
} catch (ClassNotFoundException cnfe) {
throw new NotationException("Unable to copy Nucleotide");
}
ois.close();
return nuc;
}
示例11: getModifiedPeptideSequence
import org.helm.notation.NotationException; //导入依赖的package包/类
/**
* This method returns the modified peptide sequence
*
* @param polymerNotation
* -- simple peptide notation
* @param delimiter
* used to separate amino acid
* @param monomerStore
* @return modified amino acid sequenc with specified delimiter
* @throws org.helm.notation.NotationException
* @throws org.helm.notation.MonomerException
* @throws java.io.IOException
* @throws org.jdom.JDOMException
* @throws org.helm.notation.StructureException
*/
public static String getModifiedPeptideSequence(String polymerNotation,
String delimiter, MonomerStore monomerStore)
throws NotationException, MonomerException, IOException,
JDOMException, StructureException {
List<Monomer> list = getMonomerList(polymerNotation,
Monomer.PEPTIDE_POLYMER_TYPE, monomerStore);
StringBuffer sb = new StringBuffer();
String separator = "";
if (null == delimiter) {
separator = "";
} else {
separator = delimiter;
}
for (Monomer monomer : list) {
if (sb.length() > 0) {
sb.append(separator);
}
sb.append(monomer.getAlternateId());
}
return sb.toString();
}
示例12: getComplexPolymerSMILES
import org.helm.notation.NotationException; //导入依赖的package包/类
/**
* This methods returns the unique SMILES string for complex polymer
* extendendNotation, if all monomers have specific structures
*
* @param extendedNotation
* text string for complex polymer extendendNotation
* @param monomerStore
* @throws java.io.IOException
* @throws org.helm.notation.NotationException
* @throws org.helm.notation.MonomerException
* @throws org.helm.notation.StructureException
* @throws org.jdom.JDOMException
*/
public static String getComplexPolymerSMILES(String extendedNotation,
MonomerStore monomerStore) throws IOException, NotationException,
MonomerException, StructureException, JDOMException {
monomerStore = checkForMonomerStore(monomerStore);
List<Molecule> list = getComplexPolymerStructure(extendedNotation,
monomerStore);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < list.size(); i++) {
Molecule m = list.get(i);
String smi = m.toFormat("smiles");
if (sb.length() > 0) {
sb.append(".");
}
sb.append(smi);
}
String mixtureSmiles = sb.toString();
Molecule mol = StructureParser.getMolecule(mixtureSmiles);
return mol.toFormat("smiles:u");
}
示例13: getTrimmedNucleotideSequence
import org.helm.notation.NotationException; //导入依赖的package包/类
/**
* generate single letter (natural analog) nucleotide sequence for simple
* RNA notation, remove nucleotide without base from both ends
*
* @param polymerNotation
* @param monomerStore
* @return single letter (natural analog) sequence
* @throws org.helm.notation.NotationException
* @throws org.helm.notation.MonomerException
* @throws java.io.IOException
* @throws org.jdom.JDOMException
*/
public static String getTrimmedNucleotideSequence(String polymerNotation,
MonomerStore monomerStore) throws NotationException,
MonomerException, IOException, JDOMException, StructureException {
List<Nucleotide> list = getNucleotideList(polymerNotation, monomerStore);
int start = 0;
Nucleotide na = list.get(start);
while (null == na.getBaseMonomer(monomerStore)) {
start++;
na = list.get(start);
}
int end = list.size() - 1;
na = list.get(end);
while (null == na.getBaseMonomer(monomerStore)) {
end--;
na = list.get(end);
}
StringBuffer sb = new StringBuffer();
for (int i = start; i <= end; i++) {
sb.append(list.get(i).getNaturalAnalog(monomerStore));
}
return sb.toString();
}
示例14: testInlineSmilesSinglePeptide
import org.helm.notation.NotationException; //导入依赖的package包/类
@Test
public void testInlineSmilesSinglePeptide() throws JDOMException,
IOException, MonomerException, NotationException,
StructureException, ClassNotFoundException {
Element xHELMRootElement = getXHELMRootElement("resources/InlineSmilesSinglePeptide.xhelm");
String helmString = xHelmNotationParser
.getComplexNotationString(xHELMRootElement);
MonomerStore store = xHelmNotationParser
.getMonomerStore(xHELMRootElement);
boolean valid = ComplexNotationParser.validateComplexNotation(
helmString, store);
assertTrue(valid);
}
示例15: getNodeIndex
import org.helm.notation.NotationException; //导入依赖的package包/类
private static int getNodeIndex(String[] nodes, List<String> sortedNodeIDs)
throws NotationException {
int index = 0;
for (String node : nodes) {
boolean found = false;
for (int i = 0; i < sortedNodeIDs.size(); i++) {
String tmp = sortedNodeIDs.get(i);
if (tmp.equals(node)) {
index = index + i;
found = true;
break;
}
}
if (!found) {
throw new NotationException(
"Invalid polymer node ID found in Generic connection");
}
}
return index;
}