예제 #1
0
def create_project_report_on_gdocs(fc, qc, encoded_credentials, gdocs_folder):
    """Upload the sample read distribution for a project to google docs.
    """
    success = True
    # Create a client class which will make HTTP requests with Google Docs server.
    client = g_spreadsheet.get_client(encoded_credentials)
    doc_client = g_document.get_client(encoded_credentials)

    # Get a reference to the parent folder
    parent_folder = g_document.get_folder(doc_client, gdocs_folder)

    if not parent_folder:
        parent_folder = g_document.add_folder(doc_client, gdocs_folder)
        log.info("Folder {!r} created".format(gdocs_folder))

    parent_folder_title = _from_unicode(parent_folder.title.text)

    # Loop over the projects
    for project_name in fc.get_project_names():

        # Get a flowcell object containing just the data for the project
        project_fc = fc.prune_to_project(project_name)

        ssheet_title = project_name + "_sequencing_results"
        ssheet = g_spreadsheet.get_spreadsheet(client, ssheet_title)
        if not ssheet:
            ssheet = g_document.add_spreadsheet(doc_client, ssheet_title)
            g_document.move_to_folder(doc_client, ssheet, parent_folder)
            ssheet = g_spreadsheet.get_spreadsheet(client, ssheet_title)
            log.info("Spreadsheet {!r} created in " \
                     "folder {!r}".format(_from_unicode(ssheet.title.text), \
                                          parent_folder_title))

        success &= bc_metrics._write_project_report_to_gdocs(
            client, ssheet, project_fc)
        success &= bc_metrics.write_project_report_summary_to_gdocs(
            client, ssheet)
        success &= qc_metrics.write_run_report_to_gdocs(project_fc, \
                                                        qc, \
                                                        ssheet_title, \
                                                        encoded_credentials)

        log.info("Sequencing results report written to spreadsheet '%s'" \
            % _from_unicode(ssheet.title.text))

    return success
예제 #2
0
def create_project_report_on_gdocs(fc, qc, encoded_credentials, gdocs_folder):
    """Upload the sample read distribution for a project to google docs.
    """
    success = True
    # Create a client class which will make HTTP requests with Google Docs server.
    client = g_spreadsheet.get_client(encoded_credentials)
    doc_client = g_document.get_client(encoded_credentials)

    # Get a reference to the parent folder
    parent_folder = g_document.get_folder(doc_client, gdocs_folder)

    if not parent_folder:
        parent_folder = g_document.add_folder(doc_client, gdocs_folder)
        log.info("Folder {!r} created".format(gdocs_folder))

    parent_folder_title = _from_unicode(parent_folder.title.text)

    # Loop over the projects
    for project_name in fc.get_project_names():

        # Get a flowcell object containing just the data for the project
        project_fc = fc.prune_to_project(project_name)

        ssheet_title = project_name + "_sequencing_results"
        ssheet = g_spreadsheet.get_spreadsheet(client, ssheet_title)
        if not ssheet:
            ssheet = g_document.add_spreadsheet(doc_client, ssheet_title)
            g_document.move_to_folder(doc_client, ssheet, parent_folder)
            ssheet = g_spreadsheet.get_spreadsheet(client, ssheet_title)
            log.info("Spreadsheet {!r} created in " \
                     "folder {!r}".format(_from_unicode(ssheet.title.text), \
                                          parent_folder_title))

        success &= bc_metrics._write_project_report_to_gdocs(client, ssheet, project_fc)
        success &= bc_metrics.write_project_report_summary_to_gdocs(client, ssheet)
        success &= qc_metrics.write_run_report_to_gdocs(project_fc, \
                                                        qc, \
                                                        ssheet_title, \
                                                        encoded_credentials)

        log.info("Sequencing results report written to spreadsheet '%s'" \
            % _from_unicode(ssheet.title.text))

    return success
예제 #3
0
파일: bc_metrics.py 프로젝트: hussius/bcbb
def write_project_report_to_gdocs(fc_date, fc_name, project_bc_metrics, encoded_credentials, gdocs_folder=""):
    """Upload the sample read distribution for a project to google docs"""

    # Create a client class which will make HTTP requests with Google Docs server.
    client = bcbio.google.spreadsheet.get_client(encoded_credentials)
    doc_client = bcbio.google.document.get_client(encoded_credentials)

    # Get a reference to the parent folder
    parent_folder = bcbio.google.document.get_folder(doc_client, gdocs_folder)

    # Group the barcode data by project
    grouped = group_bc_stats(project_bc_metrics)

    # Loop over the projects and write the project summary for each
    for pdata in grouped:

        project_name = pdata.get("project_name", "")
        ssheet_title = project_name + "_sequencing_results"
        ssheet = bcbio.google.spreadsheet.get_spreadsheet(client, ssheet_title)
        if not ssheet:
            bcbio.google.document.add_spreadsheet(doc_client, ssheet_title)
            ssheet = bcbio.google.spreadsheet.get_spreadsheet(client, ssheet_title)

        _write_project_report_to_gdocs(client, ssheet, fc_date, fc_name, pdata)
        _write_project_report_summary_to_gdocs(client, ssheet)

        # Just to make it look a bit nicer, remove the default 'Sheet1' worksheet
        wsheet = bcbio.google.spreadsheet.get_worksheet(client, ssheet, "Sheet 1")
        if wsheet:
            client.DeleteWorksheet(wsheet)

        folder_name = project_name
        folder = bcbio.google.document.get_folder(doc_client, folder_name)
        if not folder:
            log.info("creating folder '%s'" % _from_unicode(folder_name))
            folder = bcbio.google.document.add_folder(doc_client, folder_name, parent_folder)

        ssheet = bcbio.google.document.move_to_folder(doc_client, ssheet, folder)
        log.info(
            "'%s' spreadsheet written to folder '%s'" % (_from_unicode(ssheet.title.text), _from_unicode(folder_name))
        )
예제 #4
0
def _get_query(title, exact_match):
    """Get a query object for the supplied parameters"""

    p = {}
    if title:
        # The urllib.quote method does not handle unicode, so encode the title in utf-8
        p['title'] = _from_unicode(title)
        if exact_match:
            p['title-exact'] = 'true'
        else:
            p['title-exact'] = 'false'

    return gdata.spreadsheet.service.DocumentQuery(params=p)
예제 #5
0
파일: spreadsheet.py 프로젝트: aminmg/bcbb
def _get_query(title, exact_match):
    """Get a query object for the supplied parameters"""

    p = {}
    if title:
        # The urllib.quote method does not handle unicode, so encode the title in utf-8
        p['title'] = _from_unicode(title)
        if exact_match:
            p['title-exact'] = 'true'
        else:
            p['title-exact'] = 'false'

    return gdata.spreadsheet.service.DocumentQuery(params=p)
예제 #6
0
 def get_barcode_id(self):
     return _from_unicode(self.barcode_id)
예제 #7
0
 def get_description(self):
     return _from_unicode(self.description)
예제 #8
0
 def get_project(self):
     return _from_unicode(self.project)
예제 #9
0
 def get_full_name(self):
     return _from_unicode(self.full_name)
예제 #10
0
 def get_name(self):
     return _from_unicode(self.name)
예제 #11
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_name(self):
     return _from_unicode(self.name)
예제 #12
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_project(self):
     return _from_unicode(self.project)
예제 #13
0
 def get_barcode_type(self):
     return _from_unicode(self.barcode_type)
예제 #14
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_barcode_type(self):
     return _from_unicode(self.barcode_type)
예제 #15
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_barcode_sequence(self):
     return _from_unicode(self.barcode_sequence)
예제 #16
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_barcode_full_name(self):
     return _from_unicode(self.barcode_full_name)
예제 #17
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_barcode_id(self):
     return _from_unicode(self.barcode_id)
예제 #18
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_description(self):
     return _from_unicode(self.description)
예제 #19
0
 def get_barcode_full_name(self):
     return _from_unicode(self.barcode_full_name)
예제 #20
0
 def get_barcode_sequence(self):
     return _from_unicode(self.barcode_sequence)
예제 #21
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_full_name(self):
     return _from_unicode(self.full_name)
예제 #22
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_analysis(self):
     return _from_unicode(self.analysis)
예제 #23
0
 def get_genome_build(self):
     return _from_unicode(self.genome_build)
예제 #24
0
 def get_analysis(self):
     return _from_unicode(self.analysis)
예제 #25
0
파일: flowcell.py 프로젝트: aminmg/bcbb
 def get_genome_build(self):
     return _from_unicode(self.genome_build)