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


Python GalaxyApiAccess.sqn_report方法代码示例

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


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

示例1: main

# 需要导入模块: from bcbio.galaxy.api import GalaxyApiAccess [as 别名]
# 或者: from bcbio.galaxy.api.GalaxyApiAccess import sqn_report [as 别名]
def main(config_file, month, year):
    with open(config_file) as in_handle:
        config = yaml.safe_load(in_handle)
    galaxy_api = GalaxyApiAccess(config["galaxy_url"],
        config["galaxy_apikey"])
    smonth, syear = (month - 1, year) if month > 1 else (12, year - 1)
    start_date = datetime(syear, smonth, 15, 0, 0, 0)
    # last day calculation useful if definition of month is
    # from first to last day instead of 15th-15th
    #(_, last_day) = calendar.monthrange(year, month)
    end_date = datetime(year, month, 14, 23, 59, 59)
    out_file = "%s_%s" % (start_date.strftime("%b"),
            end_date.strftime("%b-%Y-sequencing.csv"))
    with open(out_file, "w") as out_handle:
        writer = csv.writer(out_handle)
        writer.writerow([
            "Date", "Product", "Payment", "Researcher", "Lab", "Email",
            "Project", "Sample", "Description", "Genome", "Flowcell",
            "Lane", "Received", "Notes"])
        for s in galaxy_api.sqn_report(start_date.isoformat(),
                end_date.isoformat()):
            f_parts = s["sqn_run"]["run_folder"].split("_")
            flowcell = "_".join([f_parts[0], f_parts[-1]])
            writer.writerow([
                s["sqn_run"]["date"],
                s["sqn_type"],
                s["project"]["payment_(fund_number)"],
                s["project"]["researcher"],
                s["project"]["lab_association"],
                s["project"]["email"],
                s["project"]["project_name"],
                s["name"],
                s["description"],
                s["genome_build"],
                flowcell,
                s["sqn_run"]["lane"],
                _received_date(s["events"]),
                s["sqn_run"]["results_notes"]])
开发者ID:Cyberbio-Lab,项目名称:bcbio-nextgen,代码行数:40,代码来源:monthly_billing_report.py


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