示例#1
0
def sample_paths_jamo(samp):
    '''
    Find paths to h5 files using JAMO
  '''
    # Load JAMO module and import sdm_curl
    import EnvironmentModules as EnvMod
    EnvMod.module(['load', 'jamo'])
    # EnvMod.module(['load','hdf5'])
    for x in os.getenv("PYTHONPATH").split(":"):
        if x not in sys.path:
            sys.path.append(x)

    from sdm_curl import Curl
    curl = Curl(JAMO_URL)
    files = curl.post('api/metadata/query',
                      data={
                          'file_type': 'h5',
                          'metadata.sample_name': {
                              '$regex': samp
                          }
                      })
    if len(files) == 0:
        print >> sys.stderr, '[ERROR] No samples matching "%s"' % samp
        sys.exit(1)

    h5_paths = (os.path.join(f['file_path'], f['file_name']) for f in files
                if f['file_name'].endswith('bax.h5'))
    return sorted(h5_paths)
示例#2
0
def find_smrtcells_jamo_dna(sample_name):
  ''' Returns absolute path for all H5 files matching sample_name '''
  from sdm_curl import Curl
  filenames = []
  curl = Curl('https://sdm2.jgi-psf.org')
  files = curl.post('api/metadata/query',data={'metadata.sample_name':sample_name,'file_type':'h5'})
  if not files:
    return None
  return [os.path.join(f['file_path'],f['file_name']) for f in files]
示例#3
0
def find_smrtcells_jamo(sample_name):
  ''' Returns absolute path for all H5 files matching sample_name '''
  from sdm_curl import Curl
  filenames = []
  curl = Curl('https://sdm2.jgi-psf.org')
  files = curl.post('api/metadata/query',data={'metadata.sample_name':sample_name,'file_type':'h5'})
  if not files:
    return None
  locations = list(set(f['metadata']['sdm_smrt_cell']['fs_location'] for f in files))
  return locations
示例#4
0
def sample_paths_jamo(samp):
    """
    Find paths to h5 files using JAMO
  """
    # Load JAMO module and import sdm_curl
    import EnvironmentModules as EnvMod

    EnvMod.module(["load", "jamo"])
    # EnvMod.module(['load','hdf5'])
    for x in os.getenv("PYTHONPATH").split(":"):
        if x not in sys.path:
            sys.path.append(x)

    from sdm_curl import Curl

    curl = Curl(JAMO_URL)
    files = curl.post("api/metadata/query", data={"file_type": "h5", "metadata.sample_name": {"$regex": samp}})
    if len(files) == 0:
        print >>sys.stderr, '[ERROR] No samples matching "%s"' % samp
        sys.exit(1)

    h5_paths = (os.path.join(f["file_path"], f["file_name"]) for f in files if f["file_name"].endswith("bax.h5"))
    return sorted(h5_paths)