Example #1
0
 def test_fetch_xray_pass(self):
     """fetch_xray()"""
     xray_fp = os.path.join(self.temp_dir, 'xray.yaml')
     fetch_xray(xray_fp)
     self.assertTrue(os.path.isfile(xray_fp))
     expected = [
         '101M', '102L', '102M', '103L', '103M', '104L', '104M',
         '105M', '106M', '107L', '107M', '108L', '108M',
         '109L', '109M', '10GS', '10MH'
     ]
     result = read_yaml(xray_fp)
     self.assertTrue(set(expected) < set(result))
     return None
Example #2
0
def fetch_and_write_files(dirs):
    """Fetch initial data files.

    Fetch data from remote servers and write to files if local files
    do not already exist. Fetches pdb_chain_uniprot.tsv, obsolete PDB
    files, and X-ray PDB files.

    Args:
        dirs (ProjectFolders): A named tuple of directory paths.

    Returns:
        None

    """
    assert isinstance(dirs, ProjectFolders)
    assert os.path.isdir(dirs.project_home)
    assert dirs.uni_data
    assert dirs.tsv_data
    assert dirs.working

    # Run unit test for this manually to not overload servers.
    obs_fp = os.path.join(dirs.working, 'obs.yaml')
    if not os.path.exists(obs_fp):
        fetch_obsolete(obs_fp)

    # Run unit test for this manually to not overload servers.
    xray_fp = os.path.join(dirs.working, 'xray.yaml')
    if not os.path.exists(xray_fp):
        fetch_xray(xray_fp)

    # Run unit test for this manually to not overload servers.
    chain_fp = os.path.join(dirs.tsv_data, 'pdb_chain_uniprot.tsv')
    if not os.path.exists(chain_fp):
        fetch_pdb_chain_uniprot(chain_fp)

    return None