Program: 12483
Project: 12483
Buggy source:
/** 
 * @param doc
 * @param stringBuffer
 * @param URIPrefix
 * @throws IOException
 * @throws SBOLConversionException
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following methods:<ul> <li> {@link SBOLDocument#createComponentDefinition(String,String,URI)},</li> <li>  {@link Identified#setAnnotations(List)},</li> <li>  {@link SequenceAnnotation#addAnnotation(Annotation)},</li> <li>  {@link ComponentDefinition#createSequenceAnnotation(String,String,int,int,OrientationType)},</li> <li>  {@link SequenceAnnotation#setComponent(String)},</li> <li>  {@link SequenceAnnotation#addRange(String,int,int,OrientationType)},</li> <li>  {@link Range#addAnnotation(Annotation)},</li> <li>  {@link ComponentDefinition#createSequenceAnnotation(String,String,int,OrientationType)},</li> <li>  {@link SBOLDocument#createSequence(String,String,String,URI)}, </li> <li>  {@link ComponentDefinition#addSequence(Sequence)}, or </li> <li>  {@link #createSubComponentDefinitions(SBOLDocument,ComponentDefinition,URI,String,String)}.</li> </ul>
 */
static void read(SBOLDocument doc,String stringBuffer,String URIPrefix) throws IOException, SBOLConversionException, SBOLValidationException {
  so=new SequenceOntology();
  doc.addNamespace(URI.create(GBNAMESPACE),GBPREFIX);
  BufferedReader br=new BufferedReader(new StringReader(stringBuffer));
  String strLine;
  int featureCnt=0;
  int refCnt=0;
  while (true) {
    boolean cont=false;
    String id="String_Node_Str";
    String version="String_Node_Str";
    nextLine=null;
    featureMode=false;
    originMode=false;
    StringBuilder sbSequence=new StringBuilder();
    String elements=null;
    String description="String_Node_Str";
    URI type=ComponentDefinition.DNA;
    ComponentDefinition topCD=null;
    List<Annotation> annotations=new ArrayList<Annotation>();
    List<Annotation> nestedAnnotations=null;
    Annotation annotation=null;
    boolean circular=false;
    int baseCount=0;
    while ((strLine=readGenBankLine(br)) != null) {
      strLine=strLine.trim();
      if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        id=strSplit[1];
        annotation=new Annotation(new QName(GBNAMESPACE,LOCUS,GBPREFIX),strSplit[1]);
        annotations.add(annotation);
        baseCount=Integer.parseInt(strSplit[2]);
        if (strSplit[4].toUpperCase().contains("String_Node_Str")) {
          type=ComponentDefinition.RNA;
        }
        annotation=new Annotation(new QName(GBNAMESPACE,MOLECULE,GBPREFIX),strSplit[4]);
        annotations.add(annotation);
        for (int i=5; i < strSplit.length; i++) {
          if (strSplit[i].startsWith("String_Node_Str") || strSplit[i].startsWith("String_Node_Str")) {
            if (strSplit[i].startsWith("String_Node_Str"))             circular=true;
          }
 else           if (strSplit[i].length() == 3) {
            annotation=new Annotation(new QName(GBNAMESPACE,DIVISION,GBPREFIX),strSplit[i]);
          }
 else {
            annotation=new Annotation(new QName(GBNAMESPACE,DATE,GBPREFIX),strSplit[i]);
          }
          annotations.add(annotation);
        }
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        description=strLine.replaceFirst("String_Node_Str","String_Node_Str");
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        String accession=strSplit[1];
        id=accession;
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        version=strSplit[1].split("String_Node_Str")[1];
        if (!id.equals(strSplit[1].split("String_Node_Str")[0])) {
          throw new SBOLConversionException("String_Node_Str");
        }
        if (strSplit.length > 2) {
          annotation=new Annotation(new QName(GBNAMESPACE,GINUMBER,GBPREFIX),strSplit[2]);
          annotations.add(annotation);
        }
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,KEYWORDS,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,SOURCE,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,ORGANISM,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        nestedAnnotations=new ArrayList<Annotation>();
        Annotation labelAnnotation=new Annotation(new QName(GBNAMESPACE,LABEL,GBPREFIX),annotationStr);
        nestedAnnotations.add(labelAnnotation);
        URI nestedURI=URI.create(URIPrefix + "String_Node_Str" + id+ "String_Node_Str"+ refCnt);
        refCnt++;
        annotation=new Annotation(new QName(GBNAMESPACE,REFERENCE,GBPREFIX),new QName(GBNAMESPACE,NESTEDREFERENCE,GBPREFIX),nestedURI,nestedAnnotations);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,AUTHORS,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,TITLE,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,JOURNAL,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,MEDLINE,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,PUBMED,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,COMMENT,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,BASECOUNT,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        topCD=doc.createComponentDefinition(id,version,type);
        if (circular) {
          topCD.addType(SequenceOntology.CIRCULAR);
        }
 else {
          topCD.addType(SequenceOntology.LINEAR);
        }
        topCD.addRole(SequenceOntology.ENGINEERED_REGION);
        if (!"String_Node_Str".equals(description)) {
          topCD.setDescription(description);
        }
        topCD.setAnnotations(annotations);
        featureMode=true;
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        originMode=true;
        featureMode=false;
      }
 else {
        if (featureMode) {
          if (strLine.startsWith("String_Node_Str")) {
            String tag=strLine.replace("String_Node_Str","String_Node_Str").trim();
            String value="String_Node_Str";
            if ((-1) != strLine.indexOf('=')) {
              String[] splitStr=strLine.split("String_Node_Str");
              tag=splitStr[0].replace("String_Node_Str","String_Node_Str");
              value=splitStr[1];
            }
            StringBuilder sbValue=new StringBuilder();
            sbValue.append(value);
            if (value.startsWith("String_Node_Str") && !value.endsWith("String_Node_Str")) {
              while (true) {
                strLine=readGenBankLine(br).trim();
                sbValue.append(strLine);
                if (strLine.endsWith("String_Node_Str")) {
                  break;
                }
              }
            }
            SequenceAnnotation sa=topCD.getSequenceAnnotation("String_Node_Str" + (featureCnt - 1));
            if (null != sa) {
              annotation=new Annotation(new QName(GBNAMESPACE,tag,GBPREFIX),value);
              sa.addAnnotation(annotation);
            }
          }
 else {
            strLine=strLine.replace("String_Node_Str","String_Node_Str");
            String[] strSplit=strLine.split("String_Node_Str");
            URI role=convertGenBanktoSO(strSplit[0]);
            String range=strSplit[1];
            boolean outerComplement=false;
            OrientationType orientation=OrientationType.INLINE;
            if (range.startsWith("String_Node_Str")) {
              outerComplement=true;
              orientation=OrientationType.REVERSECOMPLEMENT;
              range=range.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
            }
            if (range.startsWith("String_Node_Str") || range.startsWith("String_Node_Str")) {
              String multiType="String_Node_Str";
              if (range.startsWith("String_Node_Str")) {
                multiType="String_Node_Str";
              }
              range=range.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
              range=range.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
              String[] ranges=range.split("String_Node_Str");
              int rangeCnt=0;
              SequenceAnnotation sa=null;
              for (              String r : ranges) {
                orientation=OrientationType.INLINE;
                if (r.startsWith("String_Node_Str") || outerComplement) {
                  orientation=OrientationType.REVERSECOMPLEMENT;
                  r=r.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
                }
                boolean startLessThan=false;
                boolean endGreaterThan=false;
                if (r.contains("String_Node_Str")) {
                  startLessThan=true;
                  r=r.replace("String_Node_Str","String_Node_Str");
                }
                if (r.contains("String_Node_Str")) {
                  endGreaterThan=true;
                  r=r.replace("String_Node_Str","String_Node_Str");
                }
                boolean singleBaseRange=false;
                String[] rangeSplit=null;
                if (range.contains("String_Node_Str") && !range.contains("String_Node_Str")) {
                  rangeSplit=r.split("String_Node_Str");
                  singleBaseRange=true;
                }
 else {
                  rangeSplit=r.split("String_Node_Str");
                }
                int start=Integer.parseInt(rangeSplit[0]);
                int end=Integer.parseInt(rangeSplit[1]);
                Range newRange=null;
                if (rangeCnt == 0) {
                  sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str" + rangeCnt,start,end,orientation);
                  sa.addRole(role);
                  annotation=new Annotation(new QName(GBNAMESPACE,MULTIRANGETYPE,GBPREFIX),multiType);
                  sa.addAnnotation(annotation);
                  newRange=(Range)sa.getLocation("String_Node_Str" + rangeCnt);
                }
 else                 if (sa != null) {
                  newRange=sa.addRange("String_Node_Str" + rangeCnt,start,end,orientation);
                }
                if (outerComplement) {
                  annotation=new Annotation(new QName(GBNAMESPACE,POSITION,GBPREFIX),"String_Node_Str" + ((ranges.length - 1) - rangeCnt));
                }
 else {
                  annotation=new Annotation(new QName(GBNAMESPACE,POSITION,GBPREFIX),"String_Node_Str" + rangeCnt);
                }
                newRange.addAnnotation(annotation);
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,STARTLESSTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,ENDGREATERTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                rangeCnt++;
              }
            }
 else             if (range.contains("String_Node_Str")) {
              String[] rangeSplit=range.split("String_Node_Str");
              int at=Integer.parseInt(rangeSplit[0]);
              SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",at,orientation);
              sa.addRole(role);
            }
 else {
              boolean startLessThan=false;
              boolean endGreaterThan=false;
              if (range.contains("String_Node_Str")) {
                startLessThan=true;
                range=range.replace("String_Node_Str","String_Node_Str");
              }
              if (range.contains("String_Node_Str")) {
                endGreaterThan=true;
                range=range.replace("String_Node_Str","String_Node_Str");
              }
              boolean singleBaseRange=false;
              String[] rangeSplit=null;
              if (range.contains("String_Node_Str") && !range.contains("String_Node_Str")) {
                rangeSplit=range.split("String_Node_Str");
                singleBaseRange=true;
              }
 else {
                rangeSplit=range.split("String_Node_Str");
              }
              int start=Integer.parseInt(rangeSplit[0]);
              int end=Integer.parseInt(rangeSplit[1]);
              if (start > end && circular) {
                SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",start,baseCount,orientation);
                sa.addRole(role);
                annotation=new Annotation(new QName(GBNAMESPACE,STRADLESORIGIN,GBPREFIX),"String_Node_Str");
                sa.addAnnotation(annotation);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,STARTLESSTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                newRange=sa.addRange("String_Node_Str",1,end,orientation);
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,ENDGREATERTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
 else {
                SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",start,end,orientation);
                sa.addRole(role);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,STARTLESSTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,ENDGREATERTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
            }
            featureCnt++;
          }
        }
 else         if (originMode) {
          if (elements == null) {
            elements=new String("String_Node_Str");
          }
          if (strLine.startsWith("String_Node_Str")) {
            cont=true;
            break;
          }
          String[] strSplit=strLine.split("String_Node_Str");
          for (int i=1; i < strSplit.length; i++) {
            sbSequence.append(strSplit[i]);
          }
        }
        cont=false;
      }
    }
    if (topCD != null) {
      Sequence sequence=doc.createSequence(id + "String_Node_Str",version,sbSequence.toString(),Sequence.IUPAC_DNA);
      topCD.addSequence(sequence);
      createSubComponentDefinitions(doc,topCD,type,sbSequence.toString(),version);
    }
    if (!cont)     break;
  }
  br.close();
}

Fixed version (ground truth):
/** 
 * @param doc
 * @param stringBuffer
 * @param URIPrefix
 * @throws IOException
 * @throws SBOLConversionException
 * @throws SBOLValidationException if an SBOL validation rule violation occurred in any of the following methods:<ul> <li> {@link SBOLDocument#createComponentDefinition(String,String,URI)},</li> <li>  {@link Identified#setAnnotations(List)},</li> <li>  {@link SequenceAnnotation#addAnnotation(Annotation)},</li> <li>  {@link ComponentDefinition#createSequenceAnnotation(String,String,int,int,OrientationType)},</li> <li>  {@link SequenceAnnotation#setComponent(String)},</li> <li>  {@link SequenceAnnotation#addRange(String,int,int,OrientationType)},</li> <li>  {@link Range#addAnnotation(Annotation)},</li> <li>  {@link ComponentDefinition#createSequenceAnnotation(String,String,int,OrientationType)},</li> <li>  {@link SBOLDocument#createSequence(String,String,String,URI)}, </li> <li>  {@link ComponentDefinition#addSequence(Sequence)}, or </li> <li>  {@link #createSubComponentDefinitions(SBOLDocument,ComponentDefinition,URI,String,String)}.</li> </ul>
 */
static void read(SBOLDocument doc,String stringBuffer,String URIPrefix) throws IOException, SBOLConversionException, SBOLValidationException {
  so=new SequenceOntology();
  doc.addNamespace(URI.create(GBNAMESPACE),GBPREFIX);
  BufferedReader br=new BufferedReader(new StringReader(stringBuffer));
  String strLine;
  int featureCnt=0;
  int refCnt=0;
  while (true) {
    boolean cont=false;
    String id="String_Node_Str";
    String version="String_Node_Str";
    nextLine=null;
    featureMode=false;
    originMode=false;
    StringBuilder sbSequence=new StringBuilder();
    String elements=null;
    String description="String_Node_Str";
    URI type=ComponentDefinition.DNA;
    ComponentDefinition topCD=null;
    List<Annotation> annotations=new ArrayList<Annotation>();
    List<Annotation> nestedAnnotations=null;
    Annotation annotation=null;
    boolean circular=false;
    int baseCount=0;
    while ((strLine=readGenBankLine(br)) != null) {
      strLine=strLine.trim();
      if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        id=strSplit[1];
        annotation=new Annotation(new QName(GBNAMESPACE,LOCUS,GBPREFIX),strSplit[1]);
        annotations.add(annotation);
        baseCount=Integer.parseInt(strSplit[2]);
        if (strSplit[4].toUpperCase().contains("String_Node_Str")) {
          type=ComponentDefinition.RNA;
        }
        annotation=new Annotation(new QName(GBNAMESPACE,MOLECULE,GBPREFIX),strSplit[4]);
        annotations.add(annotation);
        for (int i=5; i < strSplit.length; i++) {
          if (strSplit[i].startsWith("String_Node_Str") || strSplit[i].startsWith("String_Node_Str")) {
            if (strSplit[i].startsWith("String_Node_Str"))             circular=true;
          }
 else           if (strSplit[i].length() == 3) {
            annotation=new Annotation(new QName(GBNAMESPACE,DIVISION,GBPREFIX),strSplit[i]);
          }
 else {
            annotation=new Annotation(new QName(GBNAMESPACE,DATE,GBPREFIX),strSplit[i]);
          }
          annotations.add(annotation);
        }
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        description=strLine.replaceFirst("String_Node_Str","String_Node_Str");
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        String accession=strSplit[1];
        id=accession;
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        version=strSplit[1].split("String_Node_Str")[1];
        if (!id.equals(strSplit[1].split("String_Node_Str")[0])) {
          throw new SBOLConversionException("String_Node_Str");
        }
        if (strSplit.length > 2) {
          annotation=new Annotation(new QName(GBNAMESPACE,GINUMBER,GBPREFIX),strSplit[2]);
          annotations.add(annotation);
        }
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,KEYWORDS,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,SOURCE,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,ORGANISM,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        nestedAnnotations=new ArrayList<Annotation>();
        Annotation labelAnnotation=new Annotation(new QName(GBNAMESPACE,LABEL,GBPREFIX),annotationStr);
        nestedAnnotations.add(labelAnnotation);
        URI nestedURI=URI.create(URIPrefix + id + "String_Node_Str"+ refCnt);
        refCnt++;
        annotation=new Annotation(new QName(GBNAMESPACE,REFERENCE,GBPREFIX),new QName(GBNAMESPACE,NESTEDREFERENCE,GBPREFIX),nestedURI,nestedAnnotations);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,AUTHORS,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,TITLE,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,JOURNAL,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,MEDLINE,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        Annotation nestedAnnotation=new Annotation(new QName(GBNAMESPACE,PUBMED,GBPREFIX),annotationStr);
        nestedAnnotations.add(nestedAnnotation);
        annotation.setNestedAnnotations(nestedAnnotations);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,COMMENT,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String annotationStr=strLine.replace("String_Node_Str","String_Node_Str").trim();
        annotation=new Annotation(new QName(GBNAMESPACE,BASECOUNT,GBPREFIX),annotationStr);
        annotations.add(annotation);
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        topCD=doc.createComponentDefinition(id,version,type);
        if (circular) {
          topCD.addType(SequenceOntology.CIRCULAR);
        }
 else {
          topCD.addType(SequenceOntology.LINEAR);
        }
        topCD.addRole(SequenceOntology.ENGINEERED_REGION);
        if (!"String_Node_Str".equals(description)) {
          topCD.setDescription(description);
        }
        topCD.setAnnotations(annotations);
        featureMode=true;
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        originMode=true;
        featureMode=false;
      }
 else {
        if (featureMode) {
          if (strLine.startsWith("String_Node_Str")) {
            String tag=strLine.replace("String_Node_Str","String_Node_Str").trim();
            String value="String_Node_Str";
            if ((-1) != strLine.indexOf('=')) {
              String[] splitStr=strLine.split("String_Node_Str");
              tag=splitStr[0].replace("String_Node_Str","String_Node_Str");
              value=splitStr[1];
            }
            StringBuilder sbValue=new StringBuilder();
            sbValue.append(value);
            if (value.startsWith("String_Node_Str") && !value.endsWith("String_Node_Str")) {
              while (true) {
                strLine=readGenBankLine(br).trim();
                sbValue.append(strLine);
                if (strLine.endsWith("String_Node_Str")) {
                  break;
                }
              }
            }
            SequenceAnnotation sa=topCD.getSequenceAnnotation("String_Node_Str" + (featureCnt - 1));
            if (null != sa) {
              annotation=new Annotation(new QName(GBNAMESPACE,tag,GBPREFIX),value);
              sa.addAnnotation(annotation);
            }
          }
 else {
            strLine=strLine.replace("String_Node_Str","String_Node_Str");
            String[] strSplit=strLine.split("String_Node_Str");
            URI role=convertGenBanktoSO(strSplit[0]);
            String range=strSplit[1];
            boolean outerComplement=false;
            OrientationType orientation=OrientationType.INLINE;
            if (range.startsWith("String_Node_Str")) {
              outerComplement=true;
              orientation=OrientationType.REVERSECOMPLEMENT;
              range=range.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
            }
            if (range.startsWith("String_Node_Str") || range.startsWith("String_Node_Str")) {
              String multiType="String_Node_Str";
              if (range.startsWith("String_Node_Str")) {
                multiType="String_Node_Str";
              }
              range=range.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
              range=range.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
              String[] ranges=range.split("String_Node_Str");
              int rangeCnt=0;
              SequenceAnnotation sa=null;
              for (              String r : ranges) {
                orientation=OrientationType.INLINE;
                if (r.startsWith("String_Node_Str") || outerComplement) {
                  orientation=OrientationType.REVERSECOMPLEMENT;
                  r=r.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
                }
                boolean startLessThan=false;
                boolean endGreaterThan=false;
                if (r.contains("String_Node_Str")) {
                  startLessThan=true;
                  r=r.replace("String_Node_Str","String_Node_Str");
                }
                if (r.contains("String_Node_Str")) {
                  endGreaterThan=true;
                  r=r.replace("String_Node_Str","String_Node_Str");
                }
                boolean singleBaseRange=false;
                String[] rangeSplit=null;
                if (range.contains("String_Node_Str") && !range.contains("String_Node_Str")) {
                  rangeSplit=r.split("String_Node_Str");
                  singleBaseRange=true;
                }
 else {
                  rangeSplit=r.split("String_Node_Str");
                }
                int start=Integer.parseInt(rangeSplit[0]);
                int end=Integer.parseInt(rangeSplit[1]);
                Range newRange=null;
                if (rangeCnt == 0) {
                  sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str" + rangeCnt,start,end,orientation);
                  sa.addRole(role);
                  annotation=new Annotation(new QName(GBNAMESPACE,MULTIRANGETYPE,GBPREFIX),multiType);
                  sa.addAnnotation(annotation);
                  newRange=(Range)sa.getLocation("String_Node_Str" + rangeCnt);
                }
 else                 if (sa != null) {
                  newRange=sa.addRange("String_Node_Str" + rangeCnt,start,end,orientation);
                }
                if (outerComplement) {
                  annotation=new Annotation(new QName(GBNAMESPACE,POSITION,GBPREFIX),"String_Node_Str" + ((ranges.length - 1) - rangeCnt));
                }
 else {
                  annotation=new Annotation(new QName(GBNAMESPACE,POSITION,GBPREFIX),"String_Node_Str" + rangeCnt);
                }
                newRange.addAnnotation(annotation);
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,STARTLESSTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,ENDGREATERTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                rangeCnt++;
              }
            }
 else             if (range.contains("String_Node_Str")) {
              String[] rangeSplit=range.split("String_Node_Str");
              int at=Integer.parseInt(rangeSplit[0]);
              SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",at,orientation);
              sa.addRole(role);
            }
 else {
              boolean startLessThan=false;
              boolean endGreaterThan=false;
              if (range.contains("String_Node_Str")) {
                startLessThan=true;
                range=range.replace("String_Node_Str","String_Node_Str");
              }
              if (range.contains("String_Node_Str")) {
                endGreaterThan=true;
                range=range.replace("String_Node_Str","String_Node_Str");
              }
              boolean singleBaseRange=false;
              String[] rangeSplit=null;
              if (range.contains("String_Node_Str") && !range.contains("String_Node_Str")) {
                rangeSplit=range.split("String_Node_Str");
                singleBaseRange=true;
              }
 else {
                rangeSplit=range.split("String_Node_Str");
              }
              int start=Integer.parseInt(rangeSplit[0]);
              int end=Integer.parseInt(rangeSplit[1]);
              if (start > end && circular) {
                SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",start,baseCount,orientation);
                sa.addRole(role);
                annotation=new Annotation(new QName(GBNAMESPACE,STRADLESORIGIN,GBPREFIX),"String_Node_Str");
                sa.addAnnotation(annotation);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,STARTLESSTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                newRange=sa.addRange("String_Node_Str",1,end,orientation);
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,ENDGREATERTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
 else {
                SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",start,end,orientation);
                sa.addRole(role);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,STARTLESSTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBNAMESPACE,ENDGREATERTHAN,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBNAMESPACE,SINGLEBASERANGE,GBPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
            }
            featureCnt++;
          }
        }
 else         if (originMode) {
          if (elements == null) {
            elements=new String("String_Node_Str");
          }
          if (strLine.startsWith("String_Node_Str")) {
            cont=true;
            break;
          }
          String[] strSplit=strLine.split("String_Node_Str");
          for (int i=1; i < strSplit.length; i++) {
            sbSequence.append(strSplit[i]);
          }
        }
        cont=false;
      }
    }
    if (topCD != null) {
      Sequence sequence=doc.createSequence(id + "String_Node_Str",version,sbSequence.toString(),Sequence.IUPAC_DNA);
      topCD.addSequence(sequence);
      createSubComponentDefinitions(doc,topCD,type,sbSequence.toString(),version);
    }
    if (!cont)     break;
  }
  br.close();
}