示例#1
0
 private void processSubLevelField(System.String field, System.String fieldNumber, System.String subfield, System.String datum)
 {
     //logger.debug("Processing sub level field");
     if (field.Equals("OVERALL REACTION"))
     {
         if (subfield.Equals("REACTION_ID"))
         {
             if (readSecondaryFiles.Set && readThisEntry)
             {
                 // parse referenced file
                 System.String filename = readSecondaryDir.getSetting() + datum + ".rxn";
                 System.IO.FileInfo file = new System.IO.FileInfo(filename);
                 bool tmpBool;
                 if (System.IO.File.Exists(file.FullName))
                     tmpBool = true;
                 else
                     tmpBool = System.IO.Directory.Exists(file.FullName);
                 if (tmpBool)
                 {
                     //logger.info("Reading overall reaction from: ", filename);
                     //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                     System.IO.StreamReader reader = new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default);
                     IChemObjectReader rxnReader = new ReaderFactory().createReader(reader);
                     currentReaction = (Reaction)rxnReader.read(new Reaction());
                     currentReaction.ID = datum;
                     currentReaction.setProperty(CDKConstants.TITLE, "Overall Reaction");
                     // don't add it now, wait until annotation is parsed
                 }
                 else
                 {
                     System.String error = "Cannot find secondary file: " + filename;
                     //logger.error(error);
                     throw new CDKException(error);
                 }
             }
             else
             {
                 //logger.warn("Not reading overall reaction for this entry");
             }
         }
         else if (subfield.Equals("OVERALL REACTION ANNOTATION"))
         {
             parseReactionAnnotation(datum, currentReaction);
             currentReactionStepSet.addReaction(currentReaction);
         }
     }
     else if (field.Equals("REACTION STAGES"))
     {
         if (subfield.Equals("REACTION STAGES"))
         {
             // new reaction step
             // cannot create one, because CDK io does not
             // allow that (yet)
             reactionStepAnnotation = null;
             reactionStepComments = null;
         }
         else if (subfield.Equals("ANNOTATION"))
         {
             reactionStepAnnotation = datum;
         }
         else if (subfield.Equals("COMMENTS"))
         {
             reactionStepComments = datum;
         }
         else if (subfield.Equals("STEP_ID"))
         {
             // read secondary RXN files?
             if (readSecondaryFiles.Set && readThisEntry)
             {
                 // parse referenced file
                 System.String filename = readSecondaryDir.getSetting() + datum + ".rxn";
                 System.IO.FileInfo file = new System.IO.FileInfo(filename);
                 bool tmpBool2;
                 if (System.IO.File.Exists(file.FullName))
                     tmpBool2 = true;
                 else
                     tmpBool2 = System.IO.Directory.Exists(file.FullName);
                 if (tmpBool2)
                 {
                     //logger.info("Reading reaction step from: ", filename);
                     //UPGRADE_TODO: Constructor 'java.io.FileReader.FileReader' was converted to 'System.IO.StreamReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
                     System.IO.StreamReader reader = new System.IO.StreamReader(file.FullName, System.Text.Encoding.Default);
                     IChemObjectReader rxnReader = new ReaderFactory().createReader(reader);
                     currentReaction = (Reaction)rxnReader.read(new Reaction());
                     currentReaction.ID = datum;
                     currentReaction.setProperty(CDKConstants.TITLE, "Step " + fieldNumber);
                 }
                 else
                 {
                     //logger.error("Cannot find secondary file: ", filename);
                 }
                 // convert PseudoAtom's in EnzymeResidueLocator's if appropriate
                 markEnzymeResidueLocatorAtoms(currentReaction);
                 // now parse annotation
                 if (reactionStepAnnotation != null)
                 {
                     parseReactionAnnotation(reactionStepAnnotation, currentReaction);
                 }
                 // and set comments
                 if (reactionStepComments != null)
                 {
                     currentReaction.setProperty(CDKConstants.COMMENT, reactionStepComments);
                 }
                 // now, I'm ready to add reaction
                 currentReactionStepSet.addReaction(currentReaction);
             }
             else
             {
                 //logger.warn("Not reading reactions of this entry.");
             }
         }
     }
     else if (field.Equals("SUBSTRATES"))
     {
         //logger.warn("Ignoring top level definition of substrates");
     }
     else if (field.Equals("PRODUCTS"))
     {
         //logger.warn("Ignoring top level definition of products");
     }
     else if (field.Equals("REFERENCES"))
     {
         if (subfield.Equals("MEDLINE_ID"))
         {
             currentEntry.setProperty(MedlineID, datum);
         }
     }
     else
     {
         //UPGRADE_ISSUE: Method 'java.io.LineNumberReader.getLineNumber' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaioLineNumberReadergetLineNumber'"
         //logger.error("Unrecognized sub level field ", field, " around line " + input.getLineNumber());
     }
 }