예제 #1
0
  private void loadGroup(DomainFile domainFile, String gene, DomainAcc acc, Polypeptide polypeptide)
      throws IOException {
    logger.debug("In loadGroup()");
    DbXRef interProDbxref = null;
    if (acc != DomainAcc.NULL && analysis.getProgram().equals("iprscan")) {
      logger.debug(
          String.format(
              "Creating InterPro dbxref for '%s' with description '%s'",
              acc.getId(), acc.getDescription()));
      interProDbxref = objectManager.getDbXRef("InterPro", acc.getId(), acc.getDescription());
    }

    int n = -1;
    for (DomainRow row : domainFile.rows(gene, acc)) {
      n++;
      logger.debug(row);

      // Insert polypeptide_domain
      DbXRef dbxref = objectManager.getDbXRef(row.db(), row.nativeAcc(), row.nativeDesc());
      if (dbxref == null) {
        throw new RuntimeException(
            String.format("Could not find database '%s' on line %d", row.db(), row.lineNumber()));
      }

      String domainUniqueName;
      String accessionNumber = acc.getId();
      if (accessionNumber == null) {
        accessionNumber = row.nativeAcc();
      }
      if (n == 0) {
        domainUniqueName =
            String.format("%s:%s:%s", polypeptide.getUniqueName(), row.db(), accessionNumber);
      } else {
        domainUniqueName =
            String.format("%s:%s:%s:%d", polypeptide.getUniqueName(), row.db(), accessionNumber, n);
      }

      PolypeptideDomain polypeptideDomain =
          sequenceDao.createPolypeptideDomain(
              domainUniqueName,
              polypeptide,
              row.score(),
              row.acc().getDescription(),
              row.fmin(),
              row.fmax(),
              dbxref,
              row.evalue(),
              analysis);

      // add GO terms
      addGoTerms(row.getGoTerms(), polypeptide, polypeptideDomain, row.getGoTermComment());

      // link to InterPro dbxref if applicable
      if (interProDbxref != null && analysis.getProgram().equals("iprscan")) {
        FeatureDbXRef featureDbXRef = new FeatureDbXRef(interProDbxref, polypeptideDomain, true);
        sequenceDao.persist(featureDbXRef);
        polypeptideDomain.addFeatureDbXRef(featureDbXRef);
      }
    }
  }
예제 #2
0
  private void loadKey(DomainFile domainFile, String key) throws IOException {

    Polypeptide polypeptide = getPolypeptideForKey(key);
    if (polypeptide == null) {

      if (notFoundNotFatal) {
        String errorMessage = String.format("Failed to find %s '%s'", keyType, key);
        logger.error(errorMessage);
      } else {
        throw new RuntimeException(String.format("Failed to find %s '%s'", keyType, key));
      }
    } else {

      for (DomainAcc acc : domainFile.accsForKey(key)) {
        logger.debug(String.format("Processing '%s'", acc.getId()));
        loadGroup(domainFile, key, acc, polypeptide);
      }
    }
  }