public ResidueInfo getResidue(PolymerType pt, Character oneLetterCode) {

    String monId;
    Map<Character, String> theMapToUse;
    switch (pt) {
      case peptide:
        theMapToUse = ResidueTools.AMINO_ACID_LOOKUP_1TO3;
        break;
      case dna:
        theMapToUse = ResidueTools.DNA_LOOKUP_1TO2;
        break;
      case rna:
        return ResidueProvider.getResidue(oneLetterCode.toString().toUpperCase());
      default:
        theMapToUse = Collections.emptyMap();
        break;
    }
    if ((monId = theMapToUse.get(oneLetterCode)) != null) {
      return ResidueProvider.getResidue(monId);
    } else if ((monId = theMapToUse.get(oneLetterCode.toString().toUpperCase().charAt(0)))
        != null) // TODO find an efficient way to convert Character to upper-case equiv
    {
      return ResidueProvider.getResidue(monId);
    } else {
      throw new RuntimeException("Could not find " + pt.toString() + " with code " + oneLetterCode);
    }
  }
예제 #2
0
  /**
   * provide a default view using BioJava.. could be done using some proper configuration
   * managment...
   */
  public void initBioJavaView() {

    // first the Residue Provider
    ResidueInfoFactory refactory = new BioJavaResidueInfoFactory();
    ResidueProvider.setResidueInfoFactory(refactory);

    // next the SequenceCollection Provider
    SequenceCollectionFactory sfactory = new BioJavaSequenceCollectionFactory();
    SequenceCollectionProvider.setSequenceCollectionFactory(sfactory);

    BioJavaPubMedFactory pfactory = new BioJavaPubMedFactory();
    PubMedProvider.setPubMedFactory(pfactory);
  }