Exemple #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);
      }
    }
  }
Exemple #2
0
  private void addGoTerms(
      Set<GoInstance> goTerms,
      Polypeptide polypeptide,
      PolypeptideDomain polypeptideDomain,
      String comment) {

    for (GoInstance goInstance : goTerms) {
      try {
        if (polypeptide.getGo().contains(goInstance.getId())) {
          logger.info(
              String.format(
                  "The GO term '%s' has already been added to polypeptide '%s'",
                  goInstance.getId(), polypeptide));
          continue;
        }

        logger.info(
            String.format(
                "Creating %s GO term '%s' for domain '%s'",
                comment, goInstance.getId(), polypeptideDomain.getUniqueName()));

        DbXRef withFrom = null;
        if (goInstance.getWithFrom() != null)
          withFrom = featureUtils.findOrCreateDbXRefForWithFrom(goInstance.getWithFrom());

        featureUtils.createGoEntries(polypeptide, goInstance, comment, withFrom);
      } catch (ParsingException e) {
        logger.error(e);
      }
    }
  }