Exemple #1
0
def mask2set(mask):
  local = []
  remote = []
  if PN_LOCAL_UNINIT & mask:
    local.append(EndpointState.UNINITIALIZED)
  if PN_LOCAL_ACTIVE & mask:
    local.append(EndpointState.ACTIVE)
  if PN_LOCAL_CLOSED & mask:
    local.append(EndpointState.CLOSED)
  if PN_REMOTE_UNINIT & mask:
    remote.append(EndpointState.UNINITIALIZED)
  if PN_REMOTE_ACTIVE & mask:
    remote.append(EndpointState.ACTIVE)
  if PN_REMOTE_CLOSED & mask:
    remote.append(EndpointState.CLOSED)

  if local:
    local = EnumSet.of(*local)
  else:
    local = None
  if remote:
    remote = EnumSet.of(*remote)
  else:
    remote = None

  return local, remote
def mask2set(mask):
  local = []
  remote = []
  if PN_LOCAL_UNINIT & mask:
    local.append(EndpointState.UNINITIALIZED)
  if PN_LOCAL_ACTIVE & mask:
    local.append(EndpointState.ACTIVE)
  if PN_LOCAL_CLOSED & mask:
    local.append(EndpointState.CLOSED)
  if PN_REMOTE_UNINIT & mask:
    remote.append(EndpointState.UNINITIALIZED)
  if PN_REMOTE_ACTIVE & mask:
    remote.append(EndpointState.ACTIVE)
  if PN_REMOTE_CLOSED & mask:
    remote.append(EndpointState.CLOSED)

  if local:
    local = EnumSet.of(*local)
  else:
    local = None
  if remote:
    remote = EnumSet.of(*remote)
  else:
    remote = None

  return local, remote
  def _enums(self, mask):
    local = []
    if (self.LOCAL_UNINIT | mask):
      local.append(EndpointState.UNINITIALIZED)
    if (self.LOCAL_ACTIVE | mask):
      local.append(EndpointState.ACTIVE)
    if (self.LOCAL_CLOSED | mask):
      local.append(EndpointState.CLOSED)

    remote = []
    if (self.REMOTE_UNINIT | mask):
      remote.append(EndpointState.UNINITIALIZED)
    if (self.REMOTE_ACTIVE | mask):
      remote.append(EndpointState.ACTIVE)
    if (self.REMOTE_CLOSED | mask):
      remote.append(EndpointState.CLOSED)

    return EnumSet.of(*local), EnumSet.of(*remote)
Exemple #4
0
    def _enums(self, mask):
        local = []
        if (self.LOCAL_UNINIT | mask):
            local.append(EndpointState.UNINITIALIZED)
        if (self.LOCAL_ACTIVE | mask):
            local.append(EndpointState.ACTIVE)
        if (self.LOCAL_CLOSED | mask):
            local.append(EndpointState.CLOSED)

        remote = []
        if (self.REMOTE_UNINIT | mask):
            remote.append(EndpointState.UNINITIALIZED)
        if (self.REMOTE_ACTIVE | mask):
            remote.append(EndpointState.ACTIVE)
        if (self.REMOTE_CLOSED | mask):
            remote.append(EndpointState.CLOSED)

        return EnumSet.of(*local), EnumSet.of(*remote)
Exemple #5
0
def process(tr, parameters, tableBuilder):
    #ids = sorted(parameters.get("ids"))
    types = parameters.get(
        "types")  #sample types (tiers) that are requested for the tsv
    project = parameters.get("project")

    tableBuilder.addHeader(CODE)
    tableBuilder.addHeader(SECONDARY_NAME)
    tableBuilder.addHeader(SOURCE)
    tableBuilder.addHeader(EXTERNAL_ID)
    tableBuilder.addHeader(SAMPLE_TYPE)
    tableBuilder.addHeader(XML)
    tableBuilder.addHeader(TIER)

    #search all samples of project
    search = tr.getSearchService()
    sc = SearchCriteria()
    pc = SearchCriteria()
    pc.addMatchClause(
        SearchCriteria.MatchClause.createAttributeMatch(
            SearchCriteria.MatchClauseAttribute.PROJECT, project))
    sc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(pc))
    fetchOptions = EnumSet.of(SampleFetchOption.ANCESTORS,
                              SampleFetchOption.PROPERTIES)
    allSamples = search.searchForSamples(sc, fetchOptions)
    #filter all samples by types
    samples = []
    for s in allSamples:
        if s.getSampleType() in types:
            samples.append(s)
    #sort remaining samples-
    samples = sorted(samples)

    voc = search.getVocabulary("Q_NCBI_TAXONOMY")
    for s in samples:
        code = sample.getCode()
        row = tableBuilder.addRow()
        row.setCell(CODE, code)
        row.setCell(SECONDARY_NAME,
                    sample.getPropertyValue("Q_SECONDARY_NAME"))
        row.setCell(SOURCE, fetchSource([sample], voc.getTerms(), []))
        row.setCell(EXTERNAL_ID, sample.getPropertyValue("Q_EXTERNALDB_ID"))
        extrType = sample.getPropertyValue("Q_PRIMARY_TISSUE")
        if not extrType:
            extrType = sample.getPropertyValue("Q_SAMPLE_TYPE")
        if not extrType:
            extrType = ""
        if extrType == "CELL_LINE":
            extrType = sample.getPropertyValue("Q_TISSUE_DETAILED")
        row.setCell(SAMPLE_TYPE, extrType)
        row.setCell(XML, sample.getPropertyValue("Q_PROPERTIES"))
        row.setCell(TIER, sample.getSampleType())
def endpoint_state(impl):
  return set2mask(EnumSet.of(impl.getLocalState()),
                  EnumSet.of(impl.getRemoteState()))
Exemple #7
0
def endpoint_state(impl):
  return set2mask(EnumSet.of(impl.getLocalState()),
                  EnumSet.of(impl.getRemoteState()))