Пример #1
0
def DoFetchObsoletes(filename):

    obs = []
    fetch_ok = True

    try:
        pdblist = PDBList()
        sys.stdout.write(
            "INFO: Fetching obsolete structure information online...\n")
        obs = pdblist.get_all_obsolete()
    except:
        fetch_ok = False
        sys.stderr.write(
            "[FAILED]\nUnable to fetch obsolete structures information online.\n"
        )

    if fetch_ok:
        sys.stdout.write("[OK].\n")

        try:
            with open(filename, 'w') as f:
                for ob in obs:
                    f.write("%s\n" % ob)
            fetch_ok = True

        except IOError:
            sys.stderr.write(
                "ERROR: Could not write obsoletes into file: '%s'.\n" %
                filename)
            fetch_ok = False

    return fetch_ok, obs
Пример #2
0
 def test_get_all_obsolete(self):
     """Tests the Bio.PDB.PDBList.get_all_obsolete method."""
     pdblist = PDBList(
         obsolete_pdb="unimportant"
     )  # obsolete_pdb declared to prevent from creating the "obsolete" directory
     entries = pdblist.get_all_obsolete()
     # As number of obsolete entries constantly grow, test checks if a certain number was exceeded
     self.assertTrue(len(entries) > 3000)
Пример #3
0
 def test_get_all_obsolete(self):
     """Tests the Bio.PDB.PDBList.get_all_obsolete method."""
     pdblist = PDBList(obsolete_pdb="unimportant")  # obsolete_pdb declared to prevent from creating the "obsolete" directory
     entries = pdblist.get_all_obsolete()
     # As number of obsolete entries constantly grow, test checks if a certain number was exceeded
     self.assertTrue(len(entries) > 3000)