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


Python SampleTemplate.add_filepath方法代码示例

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


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

示例1: SQLConnectionHandler

# 需要导入模块: from qiita_db.metadata_template import SampleTemplate [as 别名]
# 或者: from qiita_db.metadata_template.SampleTemplate import add_filepath [as 别名]
from os.path import join
from time import strftime

from qiita_db.util import get_mountpoint
from qiita_db.sql_connection import SQLConnectionHandler
from qiita_db.metadata_template import SampleTemplate, PrepTemplate

conn_handler = SQLConnectionHandler()

_id, fp_base = get_mountpoint('templates')[0]

for study_id in conn_handler.execute_fetchall(
        "SELECT study_id FROM qiita.study"):
    study_id = study_id[0]
    if SampleTemplate.exists(study_id):
        st = SampleTemplate(study_id)
        fp = join(fp_base, '%d_%s.txt' % (study_id, strftime("%Y%m%d-%H%M%S")))
        st.to_file(fp)
        st.add_filepath(fp)

for prep_template_id in conn_handler.execute_fetchall(
        "SELECT prep_template_id FROM qiita.prep_template"):
    prep_template_id = prep_template_id[0]
    pt = PrepTemplate(prep_template_id)
    study_id = pt.study_id

    fp = join(fp_base, '%d_prep_%d_%s.txt' % (pt.study_id, prep_template_id,
              strftime("%Y%m%d-%H%M%S")))
    pt.to_file(fp)
    pt.add_filepath(fp)
开发者ID:BrindhaBioinfo,项目名称:qiita,代码行数:32,代码来源:6.py


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