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


Python CharonSession.seqrun_create方法代码示例

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


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

示例1: create_charon_entries_from_project

# 需要导入模块: from ngi_pipeline.database.classes import CharonSession [as 别名]
# 或者: from ngi_pipeline.database.classes.CharonSession import seqrun_create [as 别名]

#.........这里部分代码省略.........
            else:
                update_failed=True
                LOG.error(e)
                continue
        for libprep in sample:
            if delete_existing:
                LOG.warn('Deleting existing libprep "{}"'.format(libprep))
                try:
                    charon_session.libprep_delete(projectid=project.project_id,
                                                  sampleid=sample.name,
                                                  libprepid=libprep.name)
                except CharonError as e:
                    LOG.warn('Could not delete libprep "{}": {}'.format(libprep, e))
            try:
                qc = "PASSED"
                LOG.info('Creating libprep "{}" with qc status "{}"'.format(libprep, qc))
                charon_session.libprep_create(projectid=project.project_id,
                                              sampleid=sample.name,
                                              libprepid=libprep.name,
                                              qc=qc)
                LOG.info(('Project/sample/libprep "{}/{}/{}" created in '
                          'Charon').format(project, sample, libprep))
            except CharonError as e:
                if e.status_code == 400:
                    if force_overwrite:
                        LOG.warn('Overwriting data for project "{}" / '
                                 'sample "{}" / libprep "{}"'.format(project, sample,
                                                                     libprep))
                        charon_session.libprep_update(projectid=project.project_id,
                                                      sampleid=sample.name,
                                                      libprepid=libprep.name,
                                                      qc=qc)
                        LOG.info(('Project/sample/libprep "{}/{}/{}" updated in '
                                  'Charon').format(project, sample, libprep))
                    else:
                        LOG.debug(e)
                        LOG.info('Project "{}" / sample "{}" / libprep "{}" already '
                                 'exists; moving to libpreps'.format(project, sample, libprep))
                else:
                    update_failed=True
                    LOG.error(e)
                    continue
            for seqrun in libprep:
                if delete_existing:
                    LOG.warn('Deleting existing seqrun "{}"'.format(seqrun))
                    try:
                        charon_session.seqrun_delete(projectid=project.project_id,
                                                     sampleid=sample.name,
                                                     libprepid=libprep.name,
                                                     seqrunid=seqrun.name)
                    except CharonError as e:
                        update_failed=True
                        LOG.error('Could not delete seqrun "{}": {}'.format(seqrun, e))
                try:
                    alignment_status="NOT_RUNNING"
                    LOG.info('Creating seqrun "{}" with alignment_status "{}"'.format(seqrun, alignment_status))
                    charon_session.seqrun_create(projectid=project.project_id,
                                                 sampleid=sample.name,
                                                 libprepid=libprep.name,
                                                 seqrunid=seqrun.name,
                                                 alignment_status=alignment_status,
                                                 total_reads=0,
                                                 mean_autosomal_coverage=0)
                    LOG.info(('Project/sample/libprep/seqrun "{}/{}/{}/{}" '
                              'created in Charon').format(project, sample,
                                                          libprep, seqrun))
                except CharonError as e:
                    if e.status_code == 400:
                        if force_overwrite:
                            LOG.warn('Overwriting data for project "{}" / '
                                     'sample "{}" / libprep "{}" / '
                                     'seqrun "{}"'.format(project, sample,
                                                          libprep, seqrun))
                            charon_session.seqrun_update(projectid=project.project_id,
                                                         sampleid=sample.name,
                                                         libprepid=libprep.name,
                                                         seqrunid=seqrun.name,
                                                         alignment_status=alignment_status,
                                                         total_reads=0,
                                                         mean_autosomal_coverage=0)
                            LOG.info(('Project/sample/libprep/seqrun "{}/{}/{}/{}" '
                                      'updated in Charon').format(project, sample,
                                                                  libprep, seqrun))
                        else:
                            LOG.info('Project "{}" / sample "{}" / libprep "{}" / '
                                     'seqrun "{}" already exists; next...'.format(project, sample,
                                                                                  libprep, seqrun))
                    else:
                        update_failed=True
                        LOG.error(e)
                        continue

    if update_failed :
        if retry_on_fail:
            create_charon_entries_from_project(project, best_practice_analysis=best_practice_analysis,
                                       sequencing_facility=sequencing_facility,
                                       force_overwrite=force_overwrite, delete_existing=delete_existing,
                                       retry_on_fail=False)
        else:
            raise CharonError("A network error blocks Charon updating.")
开发者ID:Galithil,项目名称:ngi_pipeline,代码行数:104,代码来源:filesystem.py

示例2: create_charon_entries_from_project

# 需要导入模块: from ngi_pipeline.database.classes import CharonSession [as 别名]
# 或者: from ngi_pipeline.database.classes.CharonSession import seqrun_create [as 别名]
def create_charon_entries_from_project(project, workflow="NGI", force_overwrite=False):
    """Given a project object, creates the relevant entries
    in Charon.

    :param NGIProject project: The NGIProject object
    :param str workflow: The workflow to assign for this project (default NGI)
    :param bool force_overwrite: If this is set to true, overwrite existing entries in Charon (default false)
    """
    charon_session = CharonSession()
    try:
        status="SEQUENCED"
        LOG.info('Creating project "{}" with status "{}" and workflow "{}"'.format(project, status, workflow))
        charon_session.project_create(projectid=project.project_id,
                                      name=project.name,
                                      status=status,
                                      pipeline=workflow)
    except CharonError:
        if force_overwrite:
            LOG.warn('Overwriting data for project "{}"'.format(project))
            charon_session.project_update(projectid=project.project_id,
                                          name=project.name,
                                          status=status,
                                          pipeline=workflow)
        else:
            LOG.info('Project "{}" already exists; moving to samples...'.format(project))

    for sample in project:
        try:
            LOG.info('Creating sample "{}"'.format(sample))
            charon_session.sample_create(projectid=project.project_id,
                                         sampleid=sample.name,
                                         status="NEW")
        except CharonError:
            if force_overwrite:
                LOG.warn('Overwriting data for project "{}" / '
                         'sample "{}"'.format(project, sample))
                charon_session.sample_update(projectid=project.project_id,
                                             sampleid=sample.name,
                                             status="NEW")
            else:
                LOG.info('Project "{}" / sample "{}" already exists; moving '
                         'to libpreps'.format(project, sample))

        for libprep in sample:
            try:
                LOG.info('Creating libprep "{}"'.format(libprep))
                charon_session.libprep_create(projectid=project.project_id,
                                              sampleid=sample.name,
                                              libprepid=libprep.name,
                                              status="NEW")
            except CharonError:
                if force_overwrite:
                    LOG.warn('Overwriting data for project "{}" / '
                             'sample "{}" / libprep "{}"'.format(project, sample,
                                                                 libprep))
                    charon_session.libprep_update(projectid=project.project_id,
                                                  sampleid=sample.name,
                                                  libprepid=libprep.name,
                                                  status="NEW")
                else:
                    LOG.info('Project "{}" / sample "{}" / libprep "{}" already '
                             'exists; moving to libpreps'.format(project, sample, libprep))

            for seqrun in libprep:
                try:
                    LOG.info('Creating seqrun "{}"'.format(seqrun))
                    charon_session.seqrun_create(projectid=project.project_id,
                                                 sampleid=sample.name,
                                                 libprepid=libprep.name,
                                                 seqrunid=seqrun.name,
                                                 total_reads=0,
                                                 mean_autosomal_coverage=0,
                                                 sequencing_status="DONE",
                                                 alignment_status="NEW")
                except CharonError as e:
                    if force_overwrite:
                        LOG.warn('Overwriting data for project "{}" / '
                                 'sample "{}" / libprep "{}" / '
                                 'seqrun "{}"'.format(project, sample,
                                                      libprep, seqrun))
                        charon_session.seqrun_update(projectid=project.project_id,
                                                     sampleid=sample.name,
                                                     libprepid=libprep.name,
                                                     seqrunid=seqrun.name,
                                                     status="NEW")
                    else:
                        LOG.info('Project "{}" / sample "{}" / libprep "{}" / '
                                 'seqrun "{}" already exists; next...'.format(project, sample,
                                                                              libprep, seqrun))
开发者ID:johandahlberg,项目名称:ngi_pipeline,代码行数:91,代码来源:filesystem.py


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