本文整理汇总了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"]])