当前位置: 首页>>代码示例>>Python>>正文


Python CharonSession.sample_reset方法代码示例

本文整理汇总了Python中ngi_pipeline.database.classes.CharonSession.sample_reset方法的典型用法代码示例。如果您正苦于以下问题:Python CharonSession.sample_reset方法的具体用法?Python CharonSession.sample_reset怎么用?Python CharonSession.sample_reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ngi_pipeline.database.classes.CharonSession的用法示例。


在下文中一共展示了CharonSession.sample_reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: reset_charon_records_by_name

# 需要导入模块: from ngi_pipeline.database.classes import CharonSession [as 别名]
# 或者: from ngi_pipeline.database.classes.CharonSession import sample_reset [as 别名]
def reset_charon_records_by_name(project_id, restrict_to_samples=None,
                                 restrict_to_libpreps=None, restrict_to_seqruns=None):
    if not restrict_to_samples: restrict_to_samples = []
    if not restrict_to_libpreps: restrict_to_libpreps = []
    if not restrict_to_seqruns: restrict_to_seqruns = []
    charon_session = CharonSession()
    LOG.info("Resetting Charon record for project {}".format(project_id))
    charon_session.project_reset(projectid=project_id)
    LOG.info("Charon record for project {} reset".format(project_id))
    for sample in charon_session.project_get_samples(projectid=project_id).get('samples', []):
        sample_id = sample['sampleid']
        if restrict_to_samples and sample_id not in restrict_to_samples:
            LOG.info("Skipping project/sample {}/{}: not in list of samples to use "
                     "({})".format(project_id, sample_id, ", ".join(restrict_to_samples)))
            continue
        LOG.info("Resetting Charon record for project/sample {}/{}".format(project_id,
                                                                           sample_id))
        charon_session.sample_reset(projectid=project_id, sampleid=sample_id)
        LOG.info("Charon record for project/sample {}/{} reset".format(project_id,
                                                                       sample_id))
        for libprep in charon_session.sample_get_libpreps(projectid=project_id,
                                                          sampleid=sample_id).get('libpreps', []):
            libprep_id = libprep['libprepid']
            if restrict_to_libpreps and libprep_id not in restrict_to_libpreps:
                LOG.info("Skipping project/sample/libprep {}/{}/{}: not in list "
                         "of libpreps to use ({})".format(project_id, sample_id,
                                                          libprep_id, ", ".join(restrict_to_libpreps)))
                continue
            LOG.info("Resetting Charon record for project/sample"
                     "libprep {}/{}/{}".format(project_id, sample_id, libprep_id))
            charon_session.libprep_reset(projectid=project_id, sampleid=sample_id,
                                         libprepid=libprep_id)
            LOG.info("Charon record for project/sample/libprep {}/{}/{} "
                     "reset".format(project_id, sample_id, libprep_id))
            for seqrun in charon_session.libprep_get_seqruns(projectid=project_id,
                                                             sampleid=sample_id,
                                                             libprepid=libprep_id).get('seqruns', []):
                seqrun_id = seqrun['seqrunid']
                if restrict_to_seqruns and seqrun_id not in restrict_to_seqruns:
                    LOG.info("Skipping project/sample/libprep/seqrun {}/{}/{}/{}: "
                             "not in list of seqruns to use ({})".format(project_id,
                                                                         sample_id,
                                                                         libprep_id,
                                                                         seqrun_id,
                                                                         ", ".join(restrict_to_seqruns)))
                    continue
                LOG.info("Resetting Charon record for project/sample/libprep/"
                         "seqrun {}/{}/{}/{}".format(project_id, sample_id,
                                                     libprep_id, seqrun_id))
                charon_session.seqrun_reset(projectid=project_id, sampleid=sample_id,
                                            libprepid=libprep_id, seqrunid=seqrun_id)
                LOG.info("Charon record for project/sample/libprep/seqrun "
                         "{}/{}/{}/{} reset".format(project_id, sample_id,
                                                    libprep_id, seqrun_id))
开发者ID:Galithil,项目名称:ngi_pipeline,代码行数:56,代码来源:charon.py

示例2: reset_charon_records_by_object

# 需要导入模块: from ngi_pipeline.database.classes import CharonSession [as 别名]
# 或者: from ngi_pipeline.database.classes.CharonSession import sample_reset [as 别名]
def reset_charon_records_by_object(project_obj):
    charon_session = CharonSession()
    LOG.info("Resetting Charon record for project {}".format(project_obj))
    charon_session.project_reset(projectid=project_obj.project_id)
    LOG.info("Charon record for project {} reset".format(project_obj))
    for sample_obj in project_obj:
        LOG.info("Resetting Charon record for project/sample {}/{}".format(project_obj,
                                                                           sample_obj))
        try:
            charon_session.sample_reset(projectid=project_obj.project_id,
                                        sampleid=sample_obj.name)
            LOG.info("Charon record for project/sample {}/{} reset".format(project_obj,
                                                                           sample_obj))
        except CharonError as e:
            LOG.error("Unable to reset Charon record for project/sample {}/{}: "
                      "{}".format(project_obj, sample_obj, e))
        for libprep_obj in sample_obj:
            LOG.info("Resetting Charon record for project/sample"
                     "libprep {}/{}/{}".format(project_obj, sample_obj, libprep_obj))
            try:
                charon_session.libprep_reset(projectid=project_obj.project_id,
                                             sampleid=sample_obj.name,
                                             libprepid=libprep_obj.name)
                LOG.info("Charon record for project/sample/libprep {}/{}/{} "
                         "reset".format(project_obj, sample_obj, libprep_obj))
            except CharonError as e:
                LOG.error("Unable to reset Charon record for project/sample/libprep "
                          "{}/{}/{}: {}".format(project_obj, sample_obj,
                                                libprep_obj, e))
            for seqrun_obj in libprep_obj:
                LOG.info("Resetting Charon record for project/sample/libprep/"
                         "seqrun {}/{}/{}/{}".format(project_obj, sample_obj,
                                                     libprep_obj, seqrun_obj))
                try:
                    charon_session.seqrun_reset(projectid=project_obj.project_id,
                                                sampleid=sample_obj.name,
                                                libprepid=libprep_obj.name,
                                                seqrunid=seqrun_obj.name)
                    LOG.info("Charon record for project/sample/libprep/seqrun "
                             "{}/{}/{}/{} reset".format(project_obj, sample_obj,
                                                        libprep_obj, seqrun_obj))
                except CharonError as e:
                    LOG.error("Unable to reset Charon record for project/sample/"
                              "libprep/seqrun {}/{}/{}/{}: {}".format(project_obj,
                                                                      sample_obj,
                                                                      libprep_obj,
                                                                      seqrun_obj,
                                                                      e))
开发者ID:Galithil,项目名称:ngi_pipeline,代码行数:50,代码来源:charon.py


注:本文中的ngi_pipeline.database.classes.CharonSession.sample_reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。