本文整理汇总了Python中ngi_pipeline.database.classes.CharonSession.sample_delete方法的典型用法代码示例。如果您正苦于以下问题:Python CharonSession.sample_delete方法的具体用法?Python CharonSession.sample_delete怎么用?Python CharonSession.sample_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ngi_pipeline.database.classes.CharonSession
的用法示例。
在下文中一共展示了CharonSession.sample_delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_charon_entries_from_project
# 需要导入模块: from ngi_pipeline.database.classes import CharonSession [as 别名]
# 或者: from ngi_pipeline.database.classes.CharonSession import sample_delete [as 别名]
def create_charon_entries_from_project(project, best_practice_analysis="whole_genome_reseq",
sequencing_facility="NGI-S",
force_overwrite=False, delete_existing=False,
retry_on_fail=True):
"""Given a project object, creates the relevant entries in Charon.
This code is remarkably shoddy as I created it in a hurry and then later
it became a part of the pipeline. Use at your own risk! Ha ha.
:param NGIProject project: The NGIProject object
:param str best_practice_analysis: The workflow to assign for this project (default "variant_calling")
:param str sequencing_facility: The facility that did the sequencing
:param bool force_overwrite: If this is set to true, overwrite existing entries in Charon (default false)
:param bool delete_existing: Don't just update existing entries, delete them and create new ones (default false)
"""
charon_session = CharonSession()
update_failed=False
try:
status = "OPEN"
LOG.info('Creating project "{}" with status "{}", best practice analysis "{}", '
'and sequencing_facility {}'.format(project, status,
best_practice_analysis,
sequencing_facility))
charon_session.project_create(projectid=project.project_id,
name=project.name,
status=status,
best_practice_analysis=best_practice_analysis,
sequencing_facility=sequencing_facility)
LOG.info('Project "{}" created in Charon.'.format(project))
except CharonError as e:
if e.status_code == 400:
if force_overwrite:
LOG.warn('Overwriting data for project "{}"'.format(project))
charon_session.project_update(projectid=project.project_id,
name=project.name,
status=status,
best_practice_analysis=best_practice_analysis,
sequencing_facility=sequencing_facility)
LOG.info('Project "{}" updated in Charon.'.format(project))
else:
LOG.info('Project "{}" already exists; moving to samples...'.format(project))
else:
raise
for sample in project:
if delete_existing:
LOG.warn('Deleting existing sample "{}"'.format(sample))
try:
charon_session.sample_delete(projectid=project.project_id,
sampleid=sample.name)
except CharonError as e:
update_failed=True
LOG.error('Could not delete sample "{}": {}'.format(sample, e))
try:
analysis_status = "TO_ANALYZE"
LOG.info('Creating sample "{}" with analysis_status "{}"'.format(sample, analysis_status))
charon_session.sample_create(projectid=project.project_id,
sampleid=sample.name,
analysis_status=analysis_status)
LOG.info('Project/sample "{}/{}" created in Charon.'.format(project, sample))
except CharonError as e:
if e.status_code == 400:
if force_overwrite:
LOG.warn('Overwriting data for project "{}" / '
'sample "{}"'.format(project, sample))
charon_session.sample_update(projectid=project.project_id,
sampleid=sample.name,
analysis_status=analysis_status)
LOG.info('Project/sample "{}/{}" updated in Charon.'.format(project, sample))
else:
LOG.info('Project "{}" / sample "{}" already exists; moving '
'to libpreps'.format(project, sample))
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,
#.........这里部分代码省略.........