Exemplo n.º 1
0
  public void basicLoad() {
    try {

      PDBFileReader reader = new PDBFileReader();

      // the path to the local PDB installation
      reader.setPath("/tmp");

      // are all files in one directory, or are the files split,
      // as on the PDB ftp servers?
      reader.setPdbDirectorySplit(true);

      // should a missing PDB id be fetched automatically from the FTP servers?
      reader.setAutoFetch(true);

      // configure the parameters of file parsing

      FileParsingParameters params = new FileParsingParameters();

      // should the ATOM and SEQRES residues be aligned when creating the internal data model?
      params.setAlignSeqRes(true);

      // should secondary structure get parsed from the file
      params.setParseSecStruc(false);

      reader.setFileParsingParameters(params);

      Structure structure = reader.getStructureById("4hhb");

      System.out.println(structure);

      Chain c = structure.getChainByPDB("C");

      System.out.print(c);

      System.out.println(c.getHeader());

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  private void runSCOPTests() {

    ScopDatabase scop = ScopFactory.getSCOP();

    List<ScopDomain> domains = scop.getDomainsForPDB("4HHB");

    assertTrue(domains.size() == 4);

    // test case sensitivity;
    List<ScopDomain> domains2 = scop.getDomainsForPDB("4hhb");
    assertTrue(domains2.size() == domains.size());

    // System.out.println(domains);

    String scop1m02 =
        "d1m02a_	1m02	A:	k.36.1.1	74353	cl=58788,cf=75796,sf=75797,fa=75798,dm=75799,sp=75800,px=74353";

    List<ScopDomain> domains1m02 = scop.getDomainsForPDB("1m02");
    assertTrue(domains1m02.size() == 1);
    ScopDomain d1 = domains1m02.get(0);

    assertNotNull(d1);

    assertEquals(
        "The toString() methods for ScopDomains don't match the scop display",
        d1.toString(),
        scop1m02);

    List<ScopDomain> domains1cdg = scop.getDomainsForPDB("1CDG");
    assertTrue(domains1cdg.size() == 4);
    ScopDomain d2 = domains1cdg.get(0);
    AtomCache cache = new AtomCache();
    try {
      Structure s = cache.getStructureForDomain(d2);

      // checkRange(s,"A:496-581");
      // now with ligands!
      checkRange(s, "A:496-692");

    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }

    // check a domain with multiple ranges
    List<ScopDomain> domains1xzp = scop.getDomainsForPDB("1xzp");
    assertTrue(domains1xzp.size() == 4);

    try {
      Structure s = cache.getStructureForDomain(domains1xzp.get(0));
      Chain a = s.getChainByPDB("A");

      // now with ligands...
      assertEquals(a.getAtomGroups().size(), 176);

    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }

    // check insertion codes

    List<ScopDomain> domains2bq6 = scop.getDomainsForPDB("2bq6");
    assertTrue(domains2bq6.size() == 2);
    ScopDomain target = scop.getDomainByScopID("d2bq6a1");

    assertNotNull(target);
    try {
      Structure s = cache.getStructureForDomain(target);

      Chain a = s.getChainByPDB("A");
      assertEquals(a.getAtomGroups().size(), 52);
      checkRange(s, "A:1A-49");

    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }