コード例 #1
0
    def send_data(self):
        headers_barcodes = [ELEMENT_RUN_ELEMENT_ID, ELEMENT_RUN_NAME, ELEMENT_LANE, ELEMENT_PC_PASS_FILTER, ELEMENT_PROJECT,
                                 ELEMENT_LIBRARY_INTERNAL_ID, ELEMENT_SAMPLE_INTERNAL_ID, ELEMENT_BARCODE,
                                 ELEMENT_NB_READS_PASS_FILTER, ELEMENT_PC_READ_IN_LANE, ELEMENT_YIELD,
                                 ELEMENT_PC_Q30_R1, ELEMENT_PC_Q30_R2]
        headers_samples = [ELEMENT_PROJECT, ELEMENT_LIBRARY_INTERNAL_ID, ELEMENT_SAMPLE_INTERNAL_ID,
                   ELEMENT_NB_READS_PASS_FILTER, ELEMENT_YIELD, ELEMENT_PC_Q30_R1, ELEMENT_PC_Q30_R2]
        headers_unexpected = [ELEMENT_RUN_ELEMENT_ID, ELEMENT_RUN_NAME, ELEMENT_LANE, ELEMENT_BARCODE, ELEMENT_NB_READS_PASS_FILTER, ELEMENT_PC_READ_IN_LANE]

        cfg = Configuration()
        #Send run elements
        array_json = format_info(self.barcodes_info.values(), headers_barcodes, style='array')
        url=cfg.query('rest_api','url') + 'run_elements/'
        for payload in array_json:
            if not post_entry(url, payload):
                id = payload.pop(ELEMENT_RUN_ELEMENT_ID.key)
                patch_entry(url, payload, **{ELEMENT_RUN_ELEMENT_ID.key:id})

        #Send unexpected barcodes
        array_json = format_info(self.unexpected_barcode_info.values(), headers_unexpected, style='array')
        url=cfg.query('rest_api','url') + 'unexpected_barcodes/'
        for payload in array_json:
            if not post_entry(url, payload):
                id = payload.pop(ELEMENT_RUN_ELEMENT_ID.key)
                patch_entry(url, payload, **{ELEMENT_RUN_ELEMENT_ID.key:id})

        #Send samples information
        array_json = format_info(self.libraries_info.values(), headers_samples, style='array')
        url=cfg.query('rest_api','url') + 'samples/'
        for payload in array_json:
            lib_id = {ELEMENT_LIBRARY_INTERNAL_ID.key:payload.get(ELEMENT_LIBRARY_INTERNAL_ID.key)}
            if not post_entry(url, payload):
                patch_entry(url, payload, **lib_id)
コード例 #2
0
    def send_data(self):

        cfg = Configuration()
        headers_samples = [ELEMENT_PROJECT, ELEMENT_LIBRARY_INTERNAL_ID, ELEMENT_SAMPLE_INTERNAL_ID,
                   ELEMENT_NB_READS_PASS_FILTER, ELEMENT_YIELD, ELEMENT_PC_Q30_R1, ELEMENT_PC_Q30_R2]
        array_json = format_info(self.all_info, headers_samples, style='array')
        url=cfg.query('rest_api','url') + 'samples/'
        for payload in array_json:
            if not post_entry(url, payload):
                id = payload.pop(ELEMENT_LIBRARY_INTERNAL_ID.key)
                patch_entry(url, payload, **{ELEMENT_LIBRARY_INTERNAL_ID.key:id})
コード例 #3
0
from report_generation.formaters import format_info
from report_generation.model import Info, ELEMENT_NB_READS_SEQUENCED, \
    ELEMENT_NB_MAPPED_READS, ELEMENT_NB_DUPLICATE_READS, ELEMENT_NB_PROPERLY_MAPPED, \
    ELEMENT_MEDIAN_COVERAGE, ELEMENT_PC_DUPLICATE_READS, ELEMENT_PC_PROPERLY_MAPPED, \
    ELEMENT_PC_BASES_CALLABLE, ELEMENT_SAMPLE_INTERNAL_ID, ELEMENT_SAMPLE_EXTERNAL_ID, ELEMENT_NB_READS_PASS_FILTER,\
    ELEMENT_PC_MAPPED_READS, ELEMENT_PROJECT, ELEMENT_YIELD, \
    ELEMENT_LIBRARY_INTERNAL_ID, ELEMENT_PC_Q30_R1, ELEMENT_PC_Q30_R2, ELEMENT_NB_BASE, ELEMENT_NB_READS_IN_BAM, \
    ELEMENT_MEAN_COVERAGE, ELEMENT_SAMPLE_PLATE, ELEMENT_SAMPLE_PLATE_WELL, ELEMENT_GENDER, ELEMENT_GENOTYPE_PC_NOCALL, \
    ELEMENT_GENOTYPE_PC_MISMATCH
from report_generation.readers.mapping_stats_parsers import parse_bamtools_stats, parse_callable_bed_file, \
    parse_highdepth_yaml_file, get_nb_sequence_from_fastqc_html, parse_genotype_concordance
from report_generation.rest_communication import post_entry, patch_entry

__author__ = 'tcezard'

cfg = Configuration()
lims=Lims(**cfg.get('clarity'))
female_alias = ['f', 'female']
male_alias = ['m', 'male']

def match_gender(gender1, gender2):
    gender1 = str(gender1).lower()
    gender2 = str(gender2).lower()
    if gender1.lower() in female_alias and gender2.lower() in female_alias:
        return  'female'
    elif gender1.lower() in male_alias and gender2.lower() in male_alias:
        return 'male'
    else:
        return 'mismatch (vcf:%s lims:%s)'%(gender1, gender2)

class Bcbio_report: