當前位置: 首頁>>代碼示例>>Python>>正文


Python SearchCriteria.addSubCriteria方法代碼示例

本文整理匯總了Python中ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.addSubCriteria方法的典型用法代碼示例。如果您正苦於以下問題:Python SearchCriteria.addSubCriteria方法的具體用法?Python SearchCriteria.addSubCriteria怎麽用?Python SearchCriteria.addSubCriteria使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria的用法示例。


在下文中一共展示了SearchCriteria.addSubCriteria方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _getChildSamples

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
def _getChildSamples(parentSampleType, parentSamplePermId, sampleType):
    """Return the samples of given type for specified parent sample."""

    # The samples are of type 'sampleType'
    searchCriteria = SearchCriteria()
    searchCriteria.addMatchClause(
        MatchClause.createAttributeMatch(
            MatchClauseAttribute.TYPE,
            sampleType)
        )

    # The samples have given parent
    expSampleCriteria = SearchCriteria()
    expSampleCriteria.addMatchClause(
        MatchClause.createAttributeMatch(
            MatchClauseAttribute.TYPE,
            parentSampleType)
        )
    expSampleCriteria.addMatchClause(
        MatchClause.createAttributeMatch(
            MatchClauseAttribute.PERM_ID,
            parentSamplePermId)
        )
    searchCriteria.addSubCriteria(
        SearchSubCriteria.createSampleParentCriteria(expSampleCriteria)
    )

    # Now search
    samples = searchService.searchForSamples(searchCriteria)

    # Return the samples
    return samples
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:34,代碼來源:upgrade_experiment.py

示例2: _getExperimentSample

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
def _getExperimentSample(collectionPermId, expSamplePermId):
    """Retrieve the experiment sample."""

    # Get the experiment sample
    sampleCriteria = SearchCriteria()
    sampleCriteria.addMatchClause(
        MatchClause.createAttributeMatch(
            MatchClauseAttribute.PERM_ID,
            expSamplePermId)
        )
    expCriteria = SearchCriteria()
    expCriteria.addMatchClause(
        MatchClause.createAttributeMatch(
            MatchClauseAttribute.PERM_ID,
            collectionPermId)
        )
    # Add the experiment subcriteria
    sampleCriteria.addSubCriteria(
        SearchSubCriteria.createExperimentCriteria(
            expCriteria)
        )

    # Search
    expSampleList = searchService.searchForSamples(sampleCriteria)

    if len(expSampleList) != 1:
        return None

    # Return the experiment sample
    return expSampleList[0]
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:32,代碼來源:upgrade_experiment.py

示例3: _getDataSetForWell

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getDataSetForWell(self, wellCode=None):
        """
        Get the datasets belonging to the well with specified code. If none
        are found, return [].

        If no wellCode is given, it is assumed that the well is the passed
        entity with code self._entityCode.
        """

        if wellCode is None:
            wellCode = self._entityCode

        # Set search criteria to retrieve the dataset contained in the well
        searchCriteria = SearchCriteria()
        wellCriteria = SearchCriteria()
        wellCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, wellCode))
        searchCriteria.addSubCriteria(SearchSubCriteria.createSampleCriteria(wellCriteria))
        dataSets = searchService.searchForDataSets(searchCriteria)

        if len(dataSets) == 0:
            self._message = "Could not retrieve datasets for well " \
            "with code " + wellCode + "."

        # Return
        return dataSets
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:27,代碼來源:export_bdfacsdiva_datasets.py

示例4: _getDataSetForTube

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getDataSetForTube(self, tubeCode=None):
        """
        Get the datasets belonging to the tube with specified tube code.
        If none is found, return [].

        If no tubeCode is given, it is assumed that the tube is the passed
        entity with code self._entityCode.
        """

        if tubeCode is None:
            tubeCode = self._entityCode

        # Set search criteria to retrieve the dataset contained in the tube
        searchCriteria = SearchCriteria()
        tubeCriteria = SearchCriteria()
        tubeCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, tubeCode))
        searchCriteria.addSubCriteria(SearchSubCriteria.createSampleCriteria(tubeCriteria))
        dataSets = searchService.searchForDataSets(searchCriteria)

        if len(dataSets) == 0:
            self._message = "Could not retrieve datasets for tube " \
            "with code " + tubeCode + "."
            self._logger.error(self._message)

        # Return
        return dataSets
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:28,代碼來源:export_flow_datasets.py

示例5: _getAllTubes

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getAllTubes(self):
        """
        Get all tubes in the experiment. If the specimen is set (self._specimen),
        then return only those tubes that belong to it.
        Returns [] if none are found.
        """

        # Set search criteria to retrieve all tubes in the experiment
        # All tubes belong to a virtual tubeset - so the set of tubes in the
        # experiment is exactly the same as the set of tubes in the virtual
        # tubeset
        searchCriteria = SearchCriteria()
        searchCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, self._experimentPrefix + "_TUBE"))
        expCriteria = SearchCriteria()
        expCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PERM_ID, self._experiment.permId))
        searchCriteria.addSubCriteria(SearchSubCriteria.createExperimentCriteria(expCriteria))
        tubes = searchService.searchForSamples(searchCriteria)

        if len(tubes) == 0:
            self._message = "The experiment with code " + \
                            self._experimentCode + "does not contain tubes."
            self._logger.error(self._message)
            return tubes

        # Check that the specimen matches (if needed)
        if self._specimen != "":
            tubes = [tube for tube in tubes if \
                     tube.getPropertyValue(self._experimentPrefix + "_SPECIMEN") == self._specimen]

        # Return the (filtered) tubes
        return tubes
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:33,代碼來源:export_flow_datasets.py

示例6: _getDataSetsForExperiment

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getDataSetsForExperiment(self):
        """
        Return a list of datasets belonging to the experiment and optionally
        to the sample. If the sample ID is empty, only the experiment is used
        in the search criteria.
        If none are found, return [].

        """

        # Set search criteria to retrieve all datasets for the experiment.
        # If the sample code is set, we also filter by it.
        searchCriteria = SearchCriteria()
        searchCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, "MICROSCOPY_IMG_CONTAINER"))
        expCriteria = SearchCriteria()
        expCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PERM_ID, self._experiment.permId))
        searchCriteria.addSubCriteria(SearchSubCriteria.createExperimentCriteria(expCriteria))
        if self._sample is not None:
            self._logger.info("Filter by sample " + self._sampleId)
            sampleCriteria = SearchCriteria()
            sampleCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PERM_ID, self._sample.permId))
            searchCriteria.addSubCriteria(SearchSubCriteria.createSampleCriteria(sampleCriteria))

        dataSets = searchService.searchForDataSets(searchCriteria)

        if len(dataSets) == 0:
            dataSets = []
            self._message = "Could not retrieve datasets for experiment " \
            "with id " + self._experimentId
            if self._sampleId != "":
                self._message = self._message + " and sample with id " + \
                self._sampleId
            self._logger.error(self._message)

        # Return
        return dataSets
開發者ID:aarpon,項目名稱:obit_microscopy_core_technology,代碼行數:37,代碼來源:export_microscopy_datasets.py

示例7: createNewBarcode

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
def createNewBarcode(project, tr):
    search_service = tr.getSearchService()
    sc = SearchCriteria()
    pc = SearchCriteria()
    pc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.PROJECT, project));
    sc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(pc))
    foundSamples = search_service.searchForSamples(sc)

    foundSamplesFilter = [s for s in foundSamples if 'ENTITY' not in s.getCode()]

    offset = 0
    exists = True
    while exists:
        # create new barcode
        newBarcode = getNextFreeBarcode(project, len(foundSamplesFilter) + len(newTestSamples) + offset)

        # check if barcode already exists in database
        pc = SearchCriteria()
        pc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, newBarcode))
        found = search_service.searchForSamples(pc)
        if len(found) == 0:
            exists = False
        else:
            offset += 1

    return newBarcode
開發者ID:qbicsoftware,項目名稱:etl-scripts,代碼行數:28,代碼來源:register-imgag.py

示例8: _getDataSetsForSample

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
def _getDataSetsForSample(sampleIdentifier, dataSetType):
    """Return the dataSet of given type for specified sample."""

    # Set search criteria to retrieve the dataSet associated with the sample
    searchCriteria = SearchCriteria()
    searchCriteria.addMatchClause(
        MatchClause.createAttributeMatch(
            MatchClauseAttribute.TYPE,
            dataSetType)
        )

    sampleCriteria = SearchCriteria()
    sampleCriteria.addMatchClause(
        MatchClause.createAttributeMatch(
            MatchClauseAttribute.CODE,
            sampleIdentifier)
        )

    searchCriteria.addSubCriteria(
        SearchSubCriteria.createSampleCriteria(
            sampleCriteria)
        )
    dataSetList = searchService.searchForDataSets(searchCriteria)

    if len(dataSetList) != 1:
        []

    # Return the dataSet
    return dataSetList
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:31,代碼來源:upgrade_experiment.py

示例9: _getMicroscopySampleTypeSample

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getMicroscopySampleTypeSample(self):

        # Search sample of type MICROSCOPY_SAMPLE_TYPE with specified CODE
        sampleCriteria = SearchCriteria()
        sampleCriteria.addMatchClause(
            MatchClause.createAttributeMatch(
                MatchClauseAttribute.TYPE,
                self._sampleType)
            )
        sampleCriteria.addMatchClause(
            MatchClause.createAttributeMatch(
                MatchClauseAttribute.PERM_ID,
                self._samplePermId)
            )

        # Search parent sample of type MICROSCOPY_EXPERIMENT with specified permId
        sampleParentCriteria = SearchCriteria()
        sampleParentCriteria.addMatchClause(
            MatchClause.createAttributeMatch(
                MatchClauseAttribute.TYPE,
                self._expSampleType))
        sampleParentCriteria.addMatchClause(
            MatchClause.createAttributeMatch(
                MatchClauseAttribute.PERM_ID,
                self._expSamplePermId))

        # Add the parent sample subcriteria
        sampleCriteria.addSubCriteria(
            SearchSubCriteria.createSampleParentCriteria(
                sampleParentCriteria
                )
            )

        # Search
        samples = searchService.searchForSamples(sampleCriteria)

        if len(samples) == 0:
            samples = []
            self._message = "Could not retrieve MICROSCOPY_SAMPLE_TYPE sample with id " + \
                self._sampleId + " for parent sample MICROSCOPY_EXPERIMENT with id " + \
                self._expSampleId + " from COLLECTION experiment " + self._collectionId + "."
            self._logger.error(self._message)
            return samples

        if _DEBUG:
            self._logger.info("Retrieved " + str(len(samples)) + \
                              " samples of type MICROSCOPY_SAMPLE_TYPE " + \
                              "for parent sample MICROSCOPY_EXPERIMENT " +
                              "with ID " + self._expSamplePermId)

        # Return
        return samples[0]
開發者ID:aarpon,項目名稱:obit_microscopy_core_technology,代碼行數:54,代碼來源:export_microscopy_datasets.py

示例10: _getDataSetsForPlate

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getDataSetsForPlate(self, plateCode=None):
        """
        Return a list of datasets belonging to the plate with specified ID
        optionally filtered by self._specimen. If none are found, return [].

        If no plateCode is given, it is assumed that the plate is the passed
        entity with code self._entityCode.
        """
        if plateCode is None:
            plateCode = self._entityCode

        # Set search criteria to retrieve all wells contained in the plate
        searchCriteria = SearchCriteria()
        plateCriteria = SearchCriteria()
        plateCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, plateCode))
        searchCriteria.addSubCriteria(SearchSubCriteria.createSampleContainerCriteria(plateCriteria))
        wells = searchService.searchForSamples(searchCriteria)

        if len(wells) == 0:
            self._message = "Could not retrieve wells for plate with " \
            "code " + plateCode + "."
            self._logger.error(self._message)
            return wells

        # Check that the specimen matches (if needed)
        if self._specimen != "":
            wells = [well for well in wells if \
                       well.getPropertyValue(self._experimentPrefix + "_SPECIMEN") == self._specimen]

        # Now iterate over the samples and retrieve their datasets
        dataSets = []
        for well in wells:
            wellCode = well.getCode()
            dataSetsForWell = self._getDataSetForWell(wellCode)
            dataSets.extend(dataSetsForWell)

        if len(dataSets) == 0:
            self._message = "Could not retrieve datasets for wells in " \
            "plate with code " + plateCode + " from experiment " \
            "with code " + self._experimentCode + "."
            self._logger.error(self._message)

        # Return
        return dataSets
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:46,代碼來源:export_flow_datasets.py

示例11: _getSamples

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getSamples(self, expSampleType, expSamplePermId, sampleType):

        """
        Return a list of datasets of requested type belonging to the MICROSCOPY_EXPERIMENT sample 
        and a specific sample of type MICROSCOPY_SAMPLE_TYPE.
        If none are found, return [].
        """

        if _DEBUG:
            self._logger.info("* Requested experiment sample type: " + expSampleType)
            self._logger.info("* Requested experiment sample permId: " + expSamplePermId)
            self._logger.info("* Requested sample type: " + sampleType)

        # Search samples of type MICROSCOPY_SAMPLE_TYPE
        sampleCriteria = SearchCriteria()
        sampleCriteria.addMatchClause(
            MatchClause.createAttributeMatch(
                MatchClauseAttribute.TYPE,
                sampleType)
            )

        # Search parent sample of type MICROSCOPY_EXPERIMENT with specified permId
        sampleParentCriteria = SearchCriteria()
        sampleParentCriteria.addMatchClause(
            MatchClause.createAttributeMatch(
                MatchClauseAttribute.TYPE,
                expSampleType))
        sampleParentCriteria.addMatchClause(
            MatchClause.createAttributeMatch(
                MatchClauseAttribute.PERM_ID,
                expSamplePermId))

        # Add the parent sample subcriteria
        sampleCriteria.addSubCriteria(
            SearchSubCriteria.createSampleParentCriteria(
                sampleParentCriteria
                )
            )

        # Search
        samples = searchService.searchForSamples(sampleCriteria)
        # Return
        return samples
開發者ID:aarpon,項目名稱:obit_microscopy_core_technology,代碼行數:45,代碼來源:export_microscopy_datasets.py

示例12: _getAllPlates

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getAllPlates(self):
        """
        Get all plates in the experiment. Returns [] if none are found.
        """

        # Set search criteria to retrieve all plates in the experiment
        searchCriteria = SearchCriteria()
        searchCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, self._experimentPrefix + "_PLATE"))
        expCriteria = SearchCriteria()
        expCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PERM_ID, self._experiment.permId))
        searchCriteria.addSubCriteria(SearchSubCriteria.createExperimentCriteria(expCriteria))
        plates = searchService.searchForSamples(searchCriteria)

        if len(plates) == 0:
            self._message = "Could not retrieve plates for experiment with code " + self._experimentCode + "."
            return plates

        # Return the plates
        return plates
開發者ID:aarpon,項目名稱:obit_flow_core_technology,代碼行數:21,代碼來源:export_bdfacsdiva_datasets.py

示例13: aggregate

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
def aggregate(parameters, tableBuilder):
	codes = parameters.get("codes")

	tableBuilder.addHeader(PROJECT)
	tableBuilder.addHeader(DATASETS)

	allCodes = ""
	for code in codes:
		allCodes += code+" "
	sc = SearchCriteria()
	pc = SearchCriteria()
	pc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.PROJECT, allCodes))
	sc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(pc))
	found = searchService.searchForDataSets(sc)
	for ds in found:
		project = ds.getExperiment().getExperimentIdentifier().split("/")[2]
		try:
			projectMap[project] = projectMap[project]+1
		except:
			projectMap[project] = 1
	for key in projectMap:
		row = tableBuilder.addRow()
		row.setCell(PROJECT, key)
		row.setCell(DATASETS, projectMap[key])
開發者ID:qbicsoftware,項目名稱:etl-scripts,代碼行數:26,代碼來源:script.py

示例14: _getAccessoryDataSetsForExperiment

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
    def _getAccessoryDataSetsForExperiment(self):
        """
        Return a list of datasets belonging to the experiment and optionally
        to the sample. If the sample ID is empty, only the experiment is used
        in the search criteria.
        If none are found, return [].

        """

        # Set search criteria to retrieve all datasets of type for the experiment.
        # If the sample code is set, we also filter by it.
        searchCriteria = SearchCriteria()
        searchCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.TYPE, "MICROSCOPY_ACCESSORY_FILE"))
        expCriteria = SearchCriteria()
        expCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PERM_ID, self._experiment.permId))
        searchCriteria.addSubCriteria(SearchSubCriteria.createExperimentCriteria(expCriteria))
        if self._sample is not None:
            self._logger.info("Filter by sample " + self._sampleId)
            sampleCriteria = SearchCriteria()
            sampleCriteria.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.PERM_ID, self._sample.permId))
            searchCriteria.addSubCriteria(SearchSubCriteria.createSampleCriteria(sampleCriteria))

        accessoryDataSets = searchService.searchForDataSets(searchCriteria)

        # Append the accessory datasets
        if len(accessoryDataSets) != 0:
            self._message = "Found " + str(len(accessoryDataSets)) + \
                            " accessory datasets for experiment " \
                            "with id " + self._experimentId
            if self._sampleId != "":
                self._message = self._message + " and sample with id " + \
                self._sampleId
            self._logger.info(self._message)

        # Return
        return accessoryDataSets
開發者ID:aarpon,項目名稱:obit_microscopy_core_technology,代碼行數:38,代碼來源:export_microscopy_datasets.py

示例15: handle_BSA_Run

# 需要導入模塊: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria [as 別名]
# 或者: from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria import addSubCriteria [as 別名]
def handle_BSA_Run(transaction):
    # Get the name of the incoming file
    name = transaction.getIncoming().getName()
    incomingPath = transaction.getIncoming().getAbsolutePath()

    stem, ext = os.path.splitext(name)

    # Convert the raw file and write it to an mzml tmp folder.
    # Sadly, I can not see a way to make this part of the transaction.
    tmpdir = tempfile.mkdtemp(dir=MZML_TMP)
    try:
        convert = partial(convert_raw,
                  remote_base=REMOTE_BASE,
                  host=MSCONVERT_HOST,
                  timeout=CONVERSION_TIMEOUT,
                  user=MSCONVERT_USER)
        if ext.lower() in VENDOR_FORMAT_EXTENSIONS:
            openbis_format_code = VENDOR_FORMAT_EXTENSIONS[ext.lower()]
        else:
            raise ValueError("Invalid incoming file %s" % incomingPath)

        mzml_path = os.path.join(tmpdir, stem + '.mzML')
        raw_path = os.path.join(incomingPath, name)
        convert(raw_path, mzml_path)

        mzml_name = os.path.basename(mzml_path)
        mzml_dest = os.path.join(DROPBOX_PATH, mzml_name)

        os.rename(mzml_path, mzml_dest)
    finally:
        shutil.rmtree(tmpdir)

    # The MS experiment
    msExp = transaction.getExperiment(BSA_MPC_EXPERIMENT_ID)

    #TODO create new ms sample? if so, use normal qbic barcodes?
    msCode = "MS"+BSA_MPC_BARCODE

    search_service = transaction.getSearchService()
    sc = SearchCriteria()
    pc = SearchCriteria()
    pc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.PROJECT, BSA_MPC_PROJECT));
    sc.addSubCriteria(SearchSubCriteria.createExperimentCriteria(pc))

    foundSamples = search_service.searchForSamples(sc)

    run = 1
    for samp in foundSamples:
        if samp.getSampleType() == "Q_MS_RUN":
            existingRun = int(samp.getCode().split("_")[-1])
            if existingRun >= run:
                run = existingRun + 1

    msSample = transaction.createNewSample('/' + BSA_MPC_SPACE + '/' + msCode + "_" + str(run), "Q_MS_RUN")
    #set parent sample, always the same for bsa run
    msSample.setParentSampleIdentifiers([BSA_MPC_SAMPLE_ID])
    msSample.setExperiment(msExp)

    createRawDataSet(transaction, raw_path, msSample, openbis_format_code)
    GZipAndMoveMZMLDataSet(transaction, mzml_dest, msSample)

    for f in os.listdir(incomingPath):
        if ".testorig" in f:
            os.remove(os.path.realpath(os.path.join(incomingPath, f)))
開發者ID:qbicsoftware,項目名稱:etl-scripts,代碼行數:66,代碼來源:etl_msconvert.py


注:本文中的ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.addSubCriteria方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。