• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python bargraph.plot函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中multiqc.plots.bargraph.plot函数的典型用法代码示例。如果您正苦于以下问题:Python plot函数的具体用法?Python plot怎么用?Python plot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: bcbio_mirna_stats

 def bcbio_mirna_stats(self):
     bcbio_data = list()
     fns = self.find_log_files('bcbio/seqbuster')
     mirs_data = defaultdict(dict)
     mirs_key = OrderedDict()
     iso_data = defaultdict(dict)
     iso_key = OrderedDict()
     for f in fns:
         s_name = self.clean_s_name(f['fn'], root=None)
         with open(os.path.join(f['root'], f['fn'])) as in_handle:
             for line in in_handle:
                 cols = line.strip().split()
                 if line.startswith("mirs_"):
                     mirs_key[cols[0]] = {'name': cols[0].replace("_", " ")}
                     mirs_data[s_name][cols[0]] = int(cols[1])
                 if line.startswith("iso_"):
                     iso_key[cols[0]] = {'name': cols[0].replace("_", " ")}
                     iso_data[s_name][cols[0]] = int(cols[1])
     self.write_data_file(mirs_data, "seqbuster_mirs")
     self.write_data_file(iso_data, "seqbuster_isomirs")
     if mirs_data:
         cnfg = {'ylab': '# of miRNAs'}
         cnfg['title'] = "Number of miRNAs with changes"
         self.mirs = bargraph.plot(mirs_data, mirs_key, cnfg)
     if iso_data:
         cnfg = {'ylab': '# of isomiRs'}
         cnfg['title'] = "Number of isomiRs with changes"
         self.iso = bargraph.plot(iso_data, iso_key, cnfg)
开发者ID:roryk,项目名称:MultiQC_bcbio,代码行数:28,代码来源:srna.py


示例2: bowtie2_alignment_plot

    def bowtie2_alignment_plot (self):
        """ Make the HighCharts HTML to plot the alignment rates """

        half_warning = ''
        for s_name in self.bowtie2_data:
            if 'paired_aligned_mate_one_halved' in self.bowtie2_data[s_name] or 'paired_aligned_mate_multi_halved' in self.bowtie2_data[s_name] or 'paired_aligned_mate_none_halved' in self.bowtie2_data[s_name]:
                half_warning = '<em>Please note that single mate alignment counts are halved to tally with pair counts properly.</em>'
        description_text = 'This plot shows the number of reads aligning to the reference in different ways.'

        # Config for the plot
        config = {
            'ylab': '# Reads',
            'cpswitch_counts_label': 'Number of Reads'
        }

        # Two plots, don't mix SE with PE
        if self.num_se > 0:
            sekeys = OrderedDict()
            sekeys['unpaired_aligned_one'] = { 'color': '#20568f', 'name': 'SE mapped uniquely' }
            sekeys['unpaired_aligned_multi'] = { 'color': '#f7a35c', 'name': 'SE multimapped' }
            sekeys['unpaired_aligned_none'] = { 'color': '#981919', 'name': 'SE not aligned' }
            config['id'] = 'bowtie2_se_plot'
            config['title'] = 'Bowtie 2: SE Alignment Scores'
            self.add_section(
                description = description_text,
                helptext = '''
                There are 3 possible types of alignment:
                * **SE Mapped uniquely**: Read has only one occurence in the reference genome.
                * **SE Multimapped**: Read has multiple occurence.
                * **SE No aligned**: Read has no occurence.
                ''',
                plot = bargraph.plot(self.bowtie2_data, sekeys, config)
            )

        if self.num_pe > 0:
            pekeys = OrderedDict()
            pekeys['paired_aligned_one'] = { 'color': '#20568f', 'name': 'PE mapped uniquely' }
            pekeys['paired_aligned_discord_one'] = { 'color': '#5c94ca', 'name': 'PE mapped discordantly uniquely' }
            pekeys['paired_aligned_mate_one_halved'] = { 'color': '#95ceff', 'name': 'PE one mate mapped uniquely' }
            pekeys['paired_aligned_multi'] = { 'color': '#f7a35c', 'name': 'PE multimapped' }
            pekeys['paired_aligned_discord_multi'] = { 'color': '#dce333', 'name': 'PE discordantly multimapped' }
            pekeys['paired_aligned_mate_multi_halved'] = { 'color': '#ffeb75', 'name': 'PE one mate multimapped' }
            pekeys['paired_aligned_mate_none_halved'] = { 'color': '#981919', 'name': 'PE neither mate aligned' }
            config['id'] = 'bowtie2_pe_plot'
            config['title'] = 'Bowtie 2: PE Alignment Scores'
            self.add_section(
                description = "<br>".join([description_text,half_warning]),
                helptext = '''
                There are 6 possible types of alignment:
                * **PE mapped uniquely**: Pair has only one occurence in the reference genome.
                * **PE mapped discordantly uniquely**: Pair has only one occurence but not in proper pair.
                * **PE one mate mapped uniquely**: One read of a pair has one occurence.
                * **PE multimapped**: Pair has multiple occurence.
                * **PE one mate multimapped**: One read of a pair has multiple occurence.
                * **PE neither mate aligned**: Pair has no occurence.
                ''',
                plot = bargraph.plot(self.bowtie2_data, pekeys, config)
            )
开发者ID:chapmanb,项目名称:MultiQC,代码行数:58,代码来源:bowtie2.py


示例3: hisat2_alignment_plot

    def hisat2_alignment_plot (self):
        """ Make the HighCharts HTML to plot the alignment rates """

        # Split the data into SE and PE
        sedata = {}
        pedata = {}
        for s_name, data in self.hisat2_data.items():
            if 'paired_total' in data:
                # Save half 'pairs' of mate counts
                m_keys = ['unpaired_total', 'unpaired_aligned_none', 'unpaired_aligned_one', 'unpaired_aligned_multi']
                for k in m_keys:
                    if k in data:
                        data[k] = float(data[k]) / 2.0
                pedata[s_name] = data
            else:
                sedata[s_name] = data

        # Two plots, don't mix SE with PE
        if len(sedata) > 0:
            sekeys = OrderedDict()
            sekeys['unpaired_aligned_one'] = { 'color': '#20568f', 'name': 'SE mapped uniquely' }
            sekeys['unpaired_aligned_multi'] = { 'color': '#f7a35c', 'name': 'SE multimapped' }
            sekeys['unpaired_aligned_none'] = { 'color': '#981919', 'name': 'SE not aligned' }
            pconfig = {
                'id': 'hisat2_se_plot',
                'title': 'HISAT2: SE Alignment Scores',
                'ylab': '# Reads',
                'cpswitch_counts_label': 'Number of Reads'
            }
            self.add_section(
                plot = bargraph.plot(sedata, sekeys, pconfig)
            )

        if len(pedata) > 0:
            pekeys = OrderedDict()
            pekeys['paired_aligned_one'] = { 'color': '#20568f', 'name': 'PE mapped uniquely' }
            pekeys['paired_aligned_discord_one'] = { 'color': '#5c94ca', 'name': 'PE mapped discordantly uniquely' }
            pekeys['unpaired_aligned_one'] = { 'color': '#95ceff', 'name': 'PE one mate mapped uniquely' }
            pekeys['paired_aligned_multi'] = { 'color': '#f7a35c', 'name': 'PE multimapped' }
            pekeys['unpaired_aligned_multi'] = { 'color': '#ffeb75', 'name': 'PE one mate multimapped' }
            pekeys['unpaired_aligned_none'] = { 'color': '#981919', 'name': 'PE neither mate aligned' }
            pconfig = {
                'id': 'hisat2_pe_plot',
                'title': 'HISAT2: PE Alignment Scores',
                'ylab': '# Reads',
                'cpswitch_counts_label': 'Number of Reads'
            }
            self.add_section(
                description = '<em>Please note that single mate alignment counts are halved to tally with pair counts properly.</em>',
                plot = bargraph.plot(pedata, pekeys, pconfig)
            )
开发者ID:avilella,项目名称:MultiQC,代码行数:51,代码来源:hisat2.py


示例4: bbt_simple_plot

    def bbt_simple_plot(self):
        """ Makes a simple bar plot with summed alignment counts for
        each species, stacked. """

        # First, sum the different types of alignment counts
        data = OrderedDict()
        cats = OrderedDict()
        for s_name in self.bbt_data:
            data[s_name] = OrderedDict()
            for org in self.bbt_data[s_name]:
                data[s_name][org] = self.bbt_data[s_name][org]['hits'] - self.bbt_data[s_name][org]['shared']
                if org not in cats and org != 'multiMatch' and org != 'noMatch':
                    if org.lower().endswith('.fa'):
                        cname = org[:-3]
                    elif org.lower().endswith('.fasta'):
                        cname = org[:-6]
                    else:
                        cname = org
                    cats[org] = { 'name': cname }

        pconfig = {
            'id': 'biobloom_tools',
            'title': 'BioBloom Tools: Alignment counts per species',
            'ylab': 'Number of hits',
            'hide_zero_cats': False
        }
        cats['multiMatch'] = { 'name': 'Multiple Genomes', 'color': '#820000' }
        cats['noMatch'] = { 'name': 'No Match', 'color': '#cccccc' }

        return bargraph.plot(data, cats, pconfig)
开发者ID:chapmanb,项目名称:MultiQC,代码行数:30,代码来源:biobloomtools.py


示例5: summary_plot

 def summary_plot(data):
     """Barplot of combined pairs"""
     cats = OrderedDict()
     cats = {
         'inniepairs': {
             'name': 'Combined innie pairs',
             'color': '#191970'
         },
         'outiepairs': {
             'name': 'Combined outie pairs',
             'color': '#00A08A'
         },
         'uncombopairs': {
             'name': 'Uncombined pairs',
             'color': '#cd1076'
         },
         'discardpairs': {
             'name': 'Discarded pairs',
             'color': '#ffd700'
         }
     }
     splotconfig = {'id': 'flash_combo_stats_plot',
                    'title': 'FLASh: Read combination statistics',
                    'ylab': 'Number of read pairs',
                    'hide_zero_cats': False }
     return bargraph.plot(data, cats, splotconfig)
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:26,代码来源:flash.py


示例6: tag_info_chart

    def tag_info_chart (self):

        """ Make the taginfo.txt plot """

        ## TODO: human chrs on hg19. How will this work with GRCh genome or other, non human, genomes?
        # nice if they are ordered by size
        ucsc = ["chr" + str(i) for i in range(1,23)].append([ "chrX", "chrY", "chrM"])
        ensembl = list(range(1,23)).append([ "X", "Y", "MT"])
        pconfig = {
            'id': 'tagInfo',
            'title': 'Homer: Tag Info Distribution',
            'ylab': 'Tags',
            'cpswitch_counts_label': 'Number of Tags'
        }

        ## check if chromosomes starts with "chr" (UCSC) or "#" (ensembl)
        sample1 = next(iter(self.tagdir_data['taginfo_total']))
        chrFormat = next(iter(self.tagdir_data['taginfo_total'][sample1]))

        if ("chr" in chrFormat):
            chrs = ucsc
        else:
            chrs = ensembl

        return bargraph.plot(self.tagdir_data['taginfo_total'], chrs, pconfig)
开发者ID:chapmanb,项目名称:MultiQC,代码行数:25,代码来源:tagdirectory.py


示例7: hicpro_as_chart

    def hicpro_as_chart (self):
        """ Generate Allele-specific plot"""
        
        keys = OrderedDict()
        keys['Valid_pairs_from_ref_genome_(1-1)'] = { 'color': '#e6550d', 'name': 'Genome1 specific read pairs (1-1)' }
        keys['Valid_pairs_from_ref_genome_with_one_unassigned_mate_(0-1/1-0)'] = { 'color': '#fdae6b', 'name': 'Genome1 with one unassigned mate (0-1/1-0)' }
        keys['Valid_pairs_from_alt_genome_(2-2)']  = { 'color': '#756bb1', 'name': 'Genome2 specific read pairs (2-2)' }
        keys['Valid_pairs_from_alt_genome_with_one_unassigned_mate_(0-2/2-0)'] = { 'color': '#bcbddc', 'name': 'Genome2 with one unassigned mate (0-2/2-0)' }
        keys['Valid_pairs_from_alt_and_ref_genome_(1-2/2-1)'] = { 'color': '#a6611a', 'name': 'Trans homologuous read pairs (1-2/2/1)' }
        keys['Valid_pairs_with_both_unassigned_mated_(0-0)'] = { 'color': '#cccccc', 'name': 'Unassigned read pairs' }
        keys['Valid_pairs_with_at_least_one_conflicting_mate_(3-)'] = { 'color': '#a9a2a2', 'name': 'Conflicting read pairs' }

        # check allele-specific analysis was run
        num_samples = 0
        for s_name in self.hicpro_data:
            for k in keys:
                num_samples += sum([1 if k in self.hicpro_data[s_name] else 0])
        if num_samples == 0:
            return False
        
        # Config for the plot
        config = {
            'id': 'hicpro_asan_plot',
            'title': 'HiC-Pro: Allele-specific Statistics',
            'ylab': '# Pairs',
            'cpswitch_counts_label': 'Number of Pairs'
        }

        return bargraph.plot(self.hicpro_data, keys, config)
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:29,代码来源:hicpro.py


示例8: hicpro_mapping_chart

    def hicpro_mapping_chart (self):
        """ Generate the HiC-Pro Aligned reads plot """

        # Specify the order of the different possible categories
        keys = OrderedDict()
        keys['Full_Alignments_Read']   = { 'color': '#005ce6', 'name': 'Full reads Alignments' }
        keys['Trimmed_Alignments_Read'] = { 'color': '#3385ff', 'name': 'Trimmed reads Alignments' }
        keys['Failed_To_Align_Read']     = { 'color': '#a9a2a2', 'name': 'Failed To Align' }
                               
        data = [{},{}]
        for s_name in self.hicpro_data:
            for r in [1,2]:
                data[r-1]['{} [R{}]'.format(s_name, r)] = {
                    'Full_Alignments_Read': self.hicpro_data[s_name]['global_R{}'.format(r)],
                    'Trimmed_Alignments_Read': self.hicpro_data[s_name]['local_R{}'.format(r)],
                    'Failed_To_Align_Read': int(self.hicpro_data[s_name]['total_R{}'.format(r)]) - int(self.hicpro_data[s_name]['mapped_R{}'.format(r)])
                }
        
        # Config for the plot
        config = {
            'id': 'hicpro_mapping_stats_plot',
            'title': 'HiC-Pro: Mapping Statistics',
            'ylab': '# Reads',
            'ylab': '# Reads: Read 1',
            'data_labels': [
                {'name': 'Read 1', 'ylab': '# Reads: Read 1'},
                {'name': 'Read 2', 'ylab': '# Reads: Read 2'}
            ]
        }

        return bargraph.plot(data, [keys, keys], config)
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:31,代码来源:hicpro.py


示例9: hicpro_capture_chart

    def hicpro_capture_chart (self):
        """ Generate Capture Hi-C plot"""

        keys = OrderedDict()
        keys['valid_pairs_on_target_cap_cap'] = { 'color': '#0039e6', 'name': 'Capture-Capture interactions' }
        keys['valid_pairs_on_target_cap_rep']  = { 'color': '#809fff', 'name': 'Capture-Reporter interactions' }
        keys['valid_pairs_off_target'] = { 'color': '#cccccc', 'name': 'Off-target valid pairs' }
  
        # Check capture info are available
        num_samples = 0
        for s_name in self.hicpro_data:
            for k in keys:
                num_samples += sum([1 if k in self.hicpro_data[s_name] else 0])
        if num_samples == 0:
            return False

        # Config for the plot
        config = {
            'id': 'hicpro_cap_plot',
            'title': 'HiC-Pro: Capture Statistics',
            'ylab': '# Pairs',
            'cpswitch_counts_label': 'Number of Pairs'
        }

        return bargraph.plot(self.hicpro_data, keys, config)
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:25,代码来源:hicpro.py


示例10: chart_align_strand

    def chart_align_strand(self):

        # mapping strand distribution
        pd1 = {}
        pd2 = {}
        for sid, dd in self.mdata['align_strand'].items():
            pd1[sid] = dd['read1']
            pd2[sid] = dd['read2']

        self.add_section(
            name='Mapping Strand Distribution',
            anchor='biscuit-strands',
            description = "This plot shows the distribution of strand of mapping and strand of bisulfite conversion.",
            helptext="Most bisulfite libraries has read 1 goes to parent `++` or `--` and read 2 goes to daughter/synthesized `+-` or `-+`. PBAT or most single-cell/low input libraries typically don't observe this rule.",
            plot = bargraph.plot([pd1, pd2], 
                [OrderedDict([
                    ('++', {'name':'++: Waston-Aligned, Waston-Bisulfite Conversion', 'color': '#F53855'}),
                    ('+-', {'name':'+-: Waston-Aligned, Crick-Bisulfite Conversion', 'color': '#E37B40'}),
                    ('-+', {'name':'-+: Crick-Aligned, Waston-Bisulfite Conversion', 'color': '#46B29D'}),
                    ('--', {'name':'--: Crick-Aligned, Crick-Bisulfite Conversion', 'color': '#324D5C'}),]),
                OrderedDict([
                    ('++', {'name':'++: Waston-Aligned, Waston-Bisulfite Conversion', 'color': '#F53855'}),
                    ('+-', {'name':'+-: Waston-Aligned, Crick-Bisulfite Conversion', 'color': '#E37B40'}),
                    ('-+', {'name':'-+: Crick-Aligned, Waston-Bisulfite Conversion', 'color': '#46B29D'}),
                    ('--', {'name':'--: Crick-Aligned, Crick-Bisulfite Conversion', 'color': '#324D5C'})])], 
                {'id':'biscuit_strands',
                 'title':'BISCUIT: Mapping Strand Distribution',
                 'ylab':'Number of Reads',
                 'cpswitch_c_active': True,
                 'cpswitch_counts_label': '# Reads',
                 'data_labels': [
                    {'name': 'Read 1', },
                    {'name': 'Read 2', }]
            })
        )
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:35,代码来源:biscuit.py


示例11: star_genecount_chart

    def star_genecount_chart (self):
        """ Make a plot for the ReadsPerGene output """

        # Specify the order of the different possible categories
        keys = OrderedDict()
        keys['N_genes'] =        { 'color': '#2f7ed8', 'name': 'Overlapping Genes' }
        keys['N_noFeature'] =    { 'color': '#0d233a', 'name': 'No Feature' }
        keys['N_ambiguous'] =    { 'color': '#492970', 'name': 'Ambiguous Features' }
        keys['N_multimapping'] = { 'color': '#f28f43', 'name': 'Multimapping' }
        keys['N_unmapped'] =     { 'color': '#7f0000', 'name': 'Unmapped' }

        # Config for the plot
        pconfig = {
            'id': 'star_gene_counts',
            'title': 'STAR: Gene Counts',
            'ylab': '# Reads',
            'cpswitch_counts_label': 'Number of Reads',
            'data_labels': ['Unstranded','Same Stranded','Reverse Stranded']
        }
        datasets = [
            self.star_genecounts_unstranded,
            self.star_genecounts_first_strand,
            self.star_genecounts_second_strand
        ]
        return bargraph.plot(datasets, [keys,keys,keys,keys], pconfig)
开发者ID:avilella,项目名称:MultiQC,代码行数:25,代码来源:star.py


示例12: theta2_purities_chart

    def theta2_purities_chart (self):
        """ Make the plot showing alignment rates """

        # Specify the order of the different possible categories
        keys = OrderedDict()
        keys['proportion_germline'] =   { 'name': 'Germline' }
        keys['proportion_tumour_1'] =   { 'name': 'Tumour Subclone 1' }
        keys['proportion_tumour_2'] =   { 'name': 'Tumour Subclone 2' }
        keys['proportion_tumour_3'] =   { 'name': 'Tumour Subclone 3' }
        keys['proportion_tumour_4'] =   { 'name': 'Tumour Subclone 4' }
        keys['proportion_tumour_5'] =   { 'name': 'Tumour Subclone 5' }
        keys['proportion_tumour_gt5'] = { 'name': 'Tumour Subclones > 5' }

        # Config for the plot
        pconfig = {
            'id': 'theta2_purity_plot',
            'title': 'THetA2: Tumour Subclone Purities',
            'cpswitch': False,
            'ymin': 0,
            'ymax': 100,
            'ylab': '% Purity',
            'tt_suffix': '%'
        }

        return bargraph.plot(self.theta2_data, keys, pconfig)
开发者ID:avilella,项目名称:MultiQC,代码行数:25,代码来源:theta2.py


示例13: adapter_removal_retained_chart

    def adapter_removal_retained_chart(self):

        pconfig = {
            'title': 'Adapter Removal: Discarded Reads',
            'id': 'ar_retained_plot',
            'ylab': '# Reads',
            'hide_zero_cats': False,
            'cpswitch_counts_label': 'Number of Reads'
        }

        cats_pec = OrderedDict()

        if self.__any_paired:
            cats_pec['retained_reads'] = {'name': 'Retained Read Pairs'}

        cats_pec['singleton_m1'] = {'name': 'Singleton R1'}

        if self.__any_paired:
            cats_pec['singleton_m2'] = {'name': 'Singleton R2'}

            if self.__any_collapsed:
                cats_pec['full-length_cp'] = {'name': 'Full-length Collapsed Pairs'}
                cats_pec['truncated_cp'] = {'name': 'Truncated Collapsed Pairs'}

        cats_pec['discarded_m1'] = {'name': 'Discarded R1'}

        if self.__any_paired:
            cats_pec['discarded_m2'] = {'name': 'Discarded R2'}

        self.add_section(
            name='Retained and Discarded Paired-End Collapsed',
            anchor='adapter_removal_retained_plot',
            description='The number of retained and discarded reads.',
            plot=bargraph.plot(self.adapter_removal_data, cats_pec, pconfig)
        )
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:35,代码来源:adapterRemoval.py


示例14: bowtie_alignment_plot

    def bowtie_alignment_plot (self):
        """ Make the HighCharts HTML to plot the alignment rates """

        # Specify the order of the different possible categories
        keys = OrderedDict()
        keys['reads_aligned'] = { 'color': '#8bbc21', 'name': 'Aligned' }
        keys['multimapped'] =   { 'color': '#2f7ed8', 'name': 'Multimapped' }
        keys['not_aligned'] =   { 'color': '#0d233a', 'name': 'Not aligned' }

        # Config for the plot
        config = {
            'id': 'bowtie1_alignment',
            'title': 'Bowtie 1: Alignment Scores',
            'ylab': '# Reads',
            'cpswitch_counts_label': 'Number of Reads'
        }

        self.add_section(
            description = 'This plot shows the number of reads aligning to the reference in different ways.',
            helptext = '''
            There are 3 possible types of alignment:
            * **Aligned**: Read has only one occurence in the reference genome.
            * **Multimapped**: Read has multiple occurence.
            * **Not aligned**: Read has no occurence.
            ''',
            plot = bargraph.plot(self.bowtie_data, keys, config)
        )
开发者ID:chapmanb,项目名称:MultiQC,代码行数:27,代码来源:bowtie1.py


示例15: parse_samtools_rmdup

    def parse_samtools_rmdup(self):
        """ Find Samtools rmdup logs and parse their data """

        self.samtools_rmdup = dict()
        for f in self.find_log_files('samtools/rmdup', filehandles=True):
            # Example below:
            # [bam_rmdupse_core] 26602816 / 103563641 = 0.2569 in library '   '
            dups_regex = "\[bam_rmdups?e?_core\] (\d+) / (\d+) = (\d+\.\d+) in library '(.*)'"
            s_name = f['s_name']
            for l in f['f']:
                match = re.search(dups_regex, l)
                if match:
                    library_name = match.group(4).strip()
                    if library_name != '':
                        s_name = library_name
                    if s_name in self.samtools_rmdup:
                        log.debug("Duplicate sample name found in {}! Overwriting: {}".format(f['fn'], s_name))
                    self.add_data_source(f, s_name)
                    self.samtools_rmdup[s_name] = dict()
                    self.samtools_rmdup[s_name]['n_dups'] = int(match.group(1))
                    self.samtools_rmdup[s_name]['n_tot'] = int(match.group(2))
                    self.samtools_rmdup[s_name]['n_unique'] = int(match.group(2)) - int(match.group(1))
                    self.samtools_rmdup[s_name]['pct_dups'] = float(match.group(3))*100

        # Filter to strip out ignored sample names
        self.samtools_rmdup = self.ignore_samples(self.samtools_rmdup)

        if len(self.samtools_rmdup) > 0:
            # Write parsed report data to a file
            self.write_data_file(self.samtools_rmdup, 'multiqc_samtools_rmdup')

            # Make a bar plot showing duplicates
            keys = OrderedDict()
            keys['n_unique'] = {'name': 'Non-duplicated reads'}
            keys['n_dups'] = {'name': 'Duplicated reads'}
            pconfig = {
                'id': 'samtools_rmdup_plot',
                'title': 'Samtools rmdup: Duplicate alignments',
                'yDecimals': False
            }
            self.add_section (
                name = 'Duplicates removed',
                anchor = 'samtools-rmdup',
                plot = bargraph.plot(self.samtools_rmdup, keys, pconfig)
            )

            # Add a column to the General Stats table
            # General Stats Table
            stats_headers = OrderedDict()
            stats_headers['pct_dups'] = {
                'title': '% Dups',
                'description': 'Percent of duplicate alignments',
                'min': 0,
                'max': 100,
                'suffix': '%',
                'scale': 'OrRd'
            }
            self.general_stats_addcols(self.samtools_rmdup, stats_headers, 'Samtools rmdup')

        return len(self.samtools_rmdup)
开发者ID:avilella,项目名称:MultiQC,代码行数:60,代码来源:rmdup.py


示例16: slamdunkUtrRatesPlot

    def slamdunkUtrRatesPlot (self):
        """ Generate the UTR rates plot """

        cats = OrderedDict()
        keys = ['T>C', 'A>T', 'A>G', 'A>C', 'T>A', 'T>G', 'G>A', 'G>T', 'G>C', 'C>A', 'C>T', 'C>G']
        for i, v in enumerate(keys):
            cats[v] = { 'color': self.plot_cols[i] }

        pconfig = {
            'id': 'slamdunk_utrratesplot',
            'title': 'Slamdunk: Overall conversion rates per UTR',
            'cpswitch': False,
            'cpswitch_c_active': False,
            'ylab': 'Number of conversions',
            'stacking': 'normal',
            'tt_decimals': 2,
            'tt_suffix': '%',
            'tt_percentages': False,
            'hide_zero_cats': False
        }

        self.add_section (
            name = 'Conversion rates per UTR',
            anchor = 'slamdunk_utr_rates',
            description = """This plot shows the individual conversion rates for all UTRs
                        (see the <a href="http://t-neumann.github.io/slamdunk/docs.html#utrrates" target="_blank">slamdunk docs</a>).""",
            plot = bargraph.plot(self.utrates_data, cats, pconfig)
        )
开发者ID:chapmanb,项目名称:MultiQC,代码行数:28,代码来源:slamdunk.py


示例17: hicup_alignment_chart

    def hicup_alignment_chart (self):
        """ Generate the HiCUP Aligned reads plot """

        # Specify the order of the different possible categories
        keys = OrderedDict()
        keys['Unique_Alignments_Read']   = { 'color': '#2f7ed8', 'name': 'Unique Alignments' }
        keys['Multiple_Alignments_Read'] = { 'color': '#492970', 'name': 'Multiple Alignments' }
        keys['Failed_To_Align_Read']     = { 'color': '#0d233a', 'name': 'Failed To Align' }
        keys['Too_Short_To_Map_Read']    = { 'color': '#f28f43', 'name': 'Too short to map' }

        # Construct a data structure for the plot - duplicate the samples for read 1 and read 2
        data = {}
        for s_name in self.hicup_data:
            data['{} Read 1'.format(s_name)] = {}
            data['{} Read 2'.format(s_name)] = {}
            data['{} Read 1'.format(s_name)]['Unique_Alignments_Read'] = self.hicup_data[s_name]['Unique_Alignments_Read_1']
            data['{} Read 2'.format(s_name)]['Unique_Alignments_Read'] = self.hicup_data[s_name]['Unique_Alignments_Read_2']
            data['{} Read 1'.format(s_name)]['Multiple_Alignments_Read'] = self.hicup_data[s_name]['Multiple_Alignments_Read_1']
            data['{} Read 2'.format(s_name)]['Multiple_Alignments_Read'] = self.hicup_data[s_name]['Multiple_Alignments_Read_2']
            data['{} Read 1'.format(s_name)]['Failed_To_Align_Read'] = self.hicup_data[s_name]['Failed_To_Align_Read_1']
            data['{} Read 2'.format(s_name)]['Failed_To_Align_Read'] = self.hicup_data[s_name]['Failed_To_Align_Read_2']
            data['{} Read 1'.format(s_name)]['Too_Short_To_Map_Read'] = self.hicup_data[s_name]['Too_Short_To_Map_Read_1']
            data['{} Read 2'.format(s_name)]['Too_Short_To_Map_Read'] = self.hicup_data[s_name]['Too_Short_To_Map_Read_2']

        # Config for the plot
        config = {
            'id': 'hicup_mapping_stats_plot',
            'title': 'HiCUP: Mapping Statistics',
            'ylab': '# Reads',
            'cpswitch_counts_label': 'Number of Reads'
        }

        return bargraph.plot(data, keys, config)
开发者ID:chapmanb,项目名称:MultiQC,代码行数:33,代码来源:hicup.py


示例18: __init__

    def __init__(self, c_id, mod):

        modname = mod['config'].get('section_name', c_id.replace('_', ' ').title())
        if modname == '' or modname is None:
            modname = 'Custom Content'

        # Initialise the parent object
        super(MultiqcModule, self).__init__(
            name = modname,
            anchor = mod['config'].get('section_anchor', c_id),
            href = mod['config'].get('section_href'),
            info = mod['config'].get('description')
        )

        pconfig = mod['config'].get('pconfig', {})
        if pconfig.get('title') is None:
            pconfig['title'] = modname

        # Table
        if mod['config'].get('plot_type') == 'table':
            pconfig['sortRows'] = pconfig.get('sortRows', False)
            headers = mod['config'].get('headers')
            self.add_section( plot = table.plot(mod['data'], headers, pconfig) )
            self.write_data_file( mod['data'], "multiqc_{}".format(modname.lower().replace(' ', '_')) )

        # Bar plot
        elif mod['config'].get('plot_type') == 'bargraph':
            self.add_section( plot = bargraph.plot(mod['data'], mod['config'].get('categories'), pconfig) )

        # Line plot
        elif mod['config'].get('plot_type') == 'linegraph':
            self.add_section( plot = linegraph.plot(mod['data'], pconfig) )

        # Scatter plot
        elif mod['config'].get('plot_type') == 'scatter':
            self.add_section( plot = scatter.plot(mod['data'], pconfig) )

        # Heatmap
        elif mod['config'].get('plot_type') == 'heatmap':
            self.add_section( plot = heatmap.plot(mod['data'], mod['config'].get('xcats'), mod['config'].get('ycats'), pconfig) )

        # Beeswarm plot
        elif mod['config'].get('plot_type') == 'beeswarm':
            self.add_section( plot = beeswarm.plot(mod['data'], pconfig) )

        # Raw HTML
        elif mod['config'].get('plot_type') == 'html':
            self.add_section( content = mod['data'] )

        # Raw image file as html
        elif mod['config'].get('plot_type') == 'image':
            self.add_section( content = mod['data'] )

        # Not supplied
        elif mod['config'].get('plot_type') == None:
            log.warning("Plot type not found for content ID '{}'".format(c_id))

        # Not recognised
        else:
            log.warning("Error - custom content plot type '{}' not recognised for content ID {}".format(mod['config'].get('plot_type'), c_id))
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:60,代码来源:custom_content.py


示例19: mirtrace_contamination_check

    def mirtrace_contamination_check(self):
        """ Generate the miRTrace Contamination Check"""

        # A library of 24 colors. Should be enough for this plot
        color_lib = ['rgb(166,206,227)', 'rgb(31,120,180)', 'rgb(178,223,138)', 'rgb(51,160,44)', 'rgb(251,154,153)', 'rgb(227,26,28)', 'rgb(253,191,111)', 'rgb(255,127,0)', 'rgb(202,178,214)', 'rgb(106,61,154)', 'rgb(255,255,153)', 'rgb(177,89,40)', 'rgb(141,211,199)', 'rgb(255,255,179)', 'rgb(190,186,218)', 'rgb(251,128,114)', 'rgb(128,177,211)', 'rgb(253,180,98)', 'rgb(179,222,105)', 'rgb(252,205,229)', 'rgb(217,217,217)', 'rgb(188,128,189)', 'rgb(204,235,197)', 'rgb(255,237,111)']

        idx = 0

        # Specify the order of the different possible categories
        keys = OrderedDict()
        for clade in self.contamination_data[list(self.contamination_data.keys())[0]]:
            keys[clade] = { 'color': color_lib[idx], 'name': clade }
            if idx < 23:
                idx += 1
            else:
                idx = 0

        # Config for the plot
        config = {
            'cpswitch_c_active': False,
            'id': 'mirtrace_contamination_check_plot',
            'title': 'miRTrace: Contamination Check',
            'ylab': '# miRNA detected',
            'cpswitch_counts_label': 'Number of detected miRNA'
        }

        return bargraph.plot(self.contamination_data, keys, config)
开发者ID:vladsaveliev,项目名称:MultiQC,代码行数:27,代码来源:mirtrace.py


示例20: transcript_associated_plot

    def transcript_associated_plot (self):
        """ Plot a bargraph showing the Transcript-associated reads  """

        # Plot bar graph of groups
        keys = OrderedDict()
        keys['Exonic Rate'] = { 'name': 'Exonic', 'color': '#2f7ed8' }
        keys['Intronic Rate'] = { 'name': 'Intronic', 'color': '#8bbc21' }
        keys['Intergenic Rate'] = { 'name': 'Intergenic', 'color': '#0d233a'}

        # Config for the plot
        pconfig = {
            'id': 'rna_seqc_position_plot',
            'title': 'RNA-SeQC: Transcript-associated reads',
            'ylab': 'Ratio of Reads',
            'cpswitch': False,
            'ymax': 1,
            'ymin': 0,
            'tt_decimals': 3,
            'cpswitch_c_active': False
        }
        self.add_section (
            name = 'Transcript-associated reads',
            anchor = 'Transcript_associated',
            helptext = 'All of the above rates are per mapped read. Exonic Rate is the fraction mapping within exons. '
                       'Intronic Rate is the fraction mapping within introns. '
                       'Intergenic Rate is the fraction mapping in the genomic space between genes. ',
            plot = bargraph.plot(self.rna_seqc_metrics, keys, pconfig)
        )
开发者ID:chapmanb,项目名称:MultiQC,代码行数:28,代码来源:rna_seqc.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python linegraph.plot函数代码示例发布时间:2022-05-27
下一篇:
Python users.get_userstore函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap