Program: 12456
Project: 12456
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,String defaultVersion) throws IOException, SBOLConversionException, SBOLValidationException {
  so=new SequenceOntology();
  doc.addNamespace(URI.create(GBNAMESPACE),GBPREFIX);
  doc.addNamespace(URI.create(GBCONVNAMESPACE),GBCONVPREFIX);
  BufferedReader br=new BufferedReader(new StringReader(stringBuffer));
  String strLine;
  int featureCnt=0;
  int refCnt=0;
  nextLine=null;
  String labelType="String_Node_Str";
  URI lastRole=null;
  while (true) {
    boolean cont=false;
    String id="String_Node_Str";
    String accession="String_Node_Str";
    String version=defaultVersion;
    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")) {
        id=strLine.substring(12,28).trim();
        annotation=new Annotation(new QName(GBNAMESPACE,LOCUS,GBPREFIX),id);
        id=URIcompliance.fixDisplayId(id);
        annotations.add(annotation);
        baseCount=Integer.parseInt(strLine.substring(29,40).trim());
        String seqType=strLine.substring(44,53).trim();
        if (seqType.toUpperCase().contains("String_Node_Str")) {
          type=ComponentDefinition.RNA;
        }
        annotation=new Annotation(new QName(GBNAMESPACE,MOLECULE,GBPREFIX),seqType);
        annotations.add(annotation);
        String topology=strLine.substring(55,63).trim();
        if (topology.startsWith("String_Node_Str") || topology.startsWith("String_Node_Str")) {
          if (topology.startsWith("String_Node_Str"))           circular=true;
        }
        String division=strLine.substring(64,67).trim();
        annotation=new Annotation(new QName(GBNAMESPACE,DIVISION,GBPREFIX),division);
        annotations.add(annotation);
        String date=strLine.substring(68,79).trim();
        annotation=new Annotation(new QName(GBNAMESPACE,DATE,GBPREFIX),date);
        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");
        if (strSplit.length > 1) {
          accession=strSplit[1];
          if (accession.length() > 1) {
            id=accession;
            id=URIcompliance.fixDisplayId(id);
          }
        }
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        if (strSplit.length > 1) {
          if (!accession.equals(strSplit[1])) {
            if (strSplit[1].split("String_Node_Str").length > 1) {
              version=strSplit[1].split("String_Node_Str")[strSplit[1].split("String_Node_Str").length - 1];
            }
            String vId=strSplit[1].split("String_Node_Str")[0];
            if (!accession.equals(vId)) {
              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.setAnnotations(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.setAnnotations(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.setAnnotations(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.setAnnotations(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.setAnnotations(nestedAnnotations);
        Annotation pubMedAnnotation=new Annotation(new QName("String_Node_Str","String_Node_Str","String_Node_Str"),annotationStr);
        annotations.add(pubMedAnnotation);
      }
 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 (sa != null) {
              if (tag.equals("String_Node_Str")) {
                sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                labelType="String_Node_Str";
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")&& !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")&& !labelType.equals("String_Node_Str")&& !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
              if (value.startsWith("String_Node_Str")) {
                value=value.replaceAll("String_Node_Str","String_Node_Str");
                annotation=new Annotation(new QName(GBCONVNAMESPACE,tag,GBCONVPREFIX),value);
              }
 else {
                annotation=new Annotation(new QName(GBCONVNAMESPACE,tag,GBCONVPREFIX),value);
              }
              sa.addAnnotation(annotation);
            }
          }
 else {
            strLine=strLine.replace("String_Node_Str","String_Node_Str");
            String[] strSplit=strLine.split("String_Node_Str");
            String featureType=strSplit[0];
            URI role=convertGenBanktoSO(featureType);
            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.setName(featureType);
                  sa.addRole(role);
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,MULTIRANGETYPE,GBCONVPREFIX),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(GBCONVNAMESPACE,POSITION,GBCONVPREFIX),"String_Node_Str" + ((ranges.length - 1) - rangeCnt));
                }
 else {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,POSITION,GBCONVPREFIX),"String_Node_Str" + rangeCnt);
                }
                newRange.addAnnotation(annotation);
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,STARTLESSTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,ENDGREATERTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"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);
              sa.setName(featureType);
            }
 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[0]);
              if (rangeSplit.length > 1) {
                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);
                sa.setName(featureType);
                annotation=new Annotation(new QName(GBCONVNAMESPACE,STRADLESORIGIN,GBCONVPREFIX),"String_Node_Str");
                sa.addAnnotation(annotation);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,STARTLESSTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                newRange=sa.addRange("String_Node_Str",1,end,orientation);
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,ENDGREATERTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
 else {
                SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",start,end,orientation);
                sa.addRole(role);
                sa.setName(featureType);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,STARTLESSTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,ENDGREATERTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
            }
            labelType="String_Node_Str";
            lastRole=role;
            featureCnt++;
          }
        }
 else         if (originMode) {
          if (featureCnt == 1) {
            topCD.clearRoles();
            topCD.addRole(lastRole);
          }
          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,String defaultVersion) throws IOException, SBOLConversionException, SBOLValidationException {
  so=new SequenceOntology();
  doc.addNamespace(URI.create(GBNAMESPACE),GBPREFIX);
  doc.addNamespace(URI.create(GBCONVNAMESPACE),GBCONVPREFIX);
  BufferedReader br=new BufferedReader(new StringReader(stringBuffer));
  String strLine;
  int featureCnt=0;
  int refCnt=0;
  nextLine=null;
  String labelType="String_Node_Str";
  URI lastRole=null;
  while (true) {
    boolean cont=false;
    String id="String_Node_Str";
    String accession="String_Node_Str";
    String version=defaultVersion;
    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")) {
        id=strLine.substring(12,28).trim();
        annotation=new Annotation(new QName(GBNAMESPACE,LOCUS,GBPREFIX),id);
        id=URIcompliance.fixDisplayId(id);
        annotations.add(annotation);
        int startBaseCount=strLine.substring(29,40).lastIndexOf("String_Node_Str");
        baseCount=Integer.parseInt(strLine.substring(29 + startBaseCount,40).trim());
        String seqType=strLine.substring(44,53).trim();
        if (seqType.toUpperCase().contains("String_Node_Str")) {
          type=ComponentDefinition.RNA;
        }
        annotation=new Annotation(new QName(GBNAMESPACE,MOLECULE,GBPREFIX),seqType);
        annotations.add(annotation);
        String topology=strLine.substring(55,63).trim();
        if (topology.startsWith("String_Node_Str") || topology.startsWith("String_Node_Str")) {
          if (topology.startsWith("String_Node_Str"))           circular=true;
        }
        String division=strLine.substring(64,67).trim();
        annotation=new Annotation(new QName(GBNAMESPACE,DIVISION,GBPREFIX),division);
        annotations.add(annotation);
        String date=strLine.substring(68,79).trim();
        annotation=new Annotation(new QName(GBNAMESPACE,DATE,GBPREFIX),date);
        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");
        if (strSplit.length > 1) {
          accession=strSplit[1];
          if (accession.length() > 1) {
            id=accession;
            id=URIcompliance.fixDisplayId(id);
          }
        }
      }
 else       if (strLine.startsWith("String_Node_Str")) {
        String[] strSplit=strLine.split("String_Node_Str");
        if (strSplit.length > 1) {
          if (!accession.equals(strSplit[1])) {
            if (strSplit[1].split("String_Node_Str").length > 1) {
              version=strSplit[1].split("String_Node_Str")[strSplit[1].split("String_Node_Str").length - 1];
            }
            String vId=strSplit[1].split("String_Node_Str")[0];
            if (!accession.equals(vId)) {
              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.setAnnotations(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.setAnnotations(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.setAnnotations(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.setAnnotations(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.setAnnotations(nestedAnnotations);
        Annotation pubMedAnnotation=new Annotation(new QName("String_Node_Str","String_Node_Str","String_Node_Str"),annotationStr);
        annotations.add(pubMedAnnotation);
      }
 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 (sa != null) {
              if (tag.equals("String_Node_Str")) {
                sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                labelType="String_Node_Str";
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")&& !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
 else               if (tag.equals("String_Node_Str")) {
                if (!labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str") && !labelType.equals("String_Node_Str")&& !labelType.equals("String_Node_Str")&& !labelType.equals("String_Node_Str")) {
                  sa.setName(value.replace("String_Node_Str","String_Node_Str"));
                  labelType="String_Node_Str";
                }
              }
              if (value.startsWith("String_Node_Str")) {
                value=value.replaceAll("String_Node_Str","String_Node_Str");
                annotation=new Annotation(new QName(GBCONVNAMESPACE,tag,GBCONVPREFIX),value);
              }
 else {
                annotation=new Annotation(new QName(GBCONVNAMESPACE,tag,GBCONVPREFIX),value);
              }
              sa.addAnnotation(annotation);
            }
          }
 else {
            strLine=strLine.replace("String_Node_Str","String_Node_Str");
            String[] strSplit=strLine.split("String_Node_Str");
            String featureType=strSplit[0];
            URI role=convertGenBanktoSO(featureType);
            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.setName(featureType);
                  sa.addRole(role);
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,MULTIRANGETYPE,GBCONVPREFIX),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(GBCONVNAMESPACE,POSITION,GBCONVPREFIX),"String_Node_Str" + ((ranges.length - 1) - rangeCnt));
                }
 else {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,POSITION,GBCONVPREFIX),"String_Node_Str" + rangeCnt);
                }
                newRange.addAnnotation(annotation);
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,STARTLESSTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,ENDGREATERTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"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);
              sa.setName(featureType);
            }
 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[0]);
              if (rangeSplit.length > 1) {
                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);
                sa.setName(featureType);
                annotation=new Annotation(new QName(GBCONVNAMESPACE,STRADLESORIGIN,GBCONVPREFIX),"String_Node_Str");
                sa.addAnnotation(annotation);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,STARTLESSTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                newRange=sa.addRange("String_Node_Str",1,end,orientation);
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,ENDGREATERTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
 else {
                SequenceAnnotation sa=topCD.createSequenceAnnotation("String_Node_Str" + featureCnt,"String_Node_Str",start,end,orientation);
                sa.addRole(role);
                sa.setName(featureType);
                Range newRange=(Range)sa.getLocation("String_Node_Str");
                if (startLessThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,STARTLESSTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (endGreaterThan) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,ENDGREATERTHAN,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
                if (singleBaseRange) {
                  annotation=new Annotation(new QName(GBCONVNAMESPACE,SINGLEBASERANGE,GBCONVPREFIX),"String_Node_Str");
                  newRange.addAnnotation(annotation);
                }
              }
            }
            labelType="String_Node_Str";
            lastRole=role;
            featureCnt++;
          }
        }
 else         if (originMode) {
          if (featureCnt == 1) {
            topCD.clearRoles();
            topCD.addRole(lastRole);
          }
          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();
}