from __future__ import absolute_import

from .bcbio import MultiqcModule
from multiqc import config


# Add search patterns and config options for the things that are used in MultiQC_bcbio
def multiqc_bcbio_config():
    """ Set up MultiQC config defaults for this package """
    bcbio_search_patterns = {
        'bcbio/metrics': {'fn': '*_bcbio.txt'},
        'bcbio/coverage': {'fn': '*_bcbio_coverage.txt'},
        'bcbio/coverage_avg': {'fn': '*_bcbio_coverage_avg.txt'},
        'bcbio/variants': {'fn': '*_bcbio_variants.txt'},
        'bcbio/target': {'fn': 'target_info.yaml'},
        'bcbio/qsignature': {'fn': '*bcbio_qsignature.ma'},
        'bcbio/vcfstats': {'fn': '*_bcbio_variants_stats.txt'},
        'bcbio/seqbuster': {'contents': 'seqbuster'},
        'bcbio/umi': {'fn': '*_umi_stats.yaml'},
        'bcbio/viral': {'fn': '*viral*-counts.txt'},
        'bcbio/damage': {'fn': '*damage.yaml'},
    }
    config.update_dict(config.sp, bcbio_search_patterns)

    config.fn_clean_exts.append({'type': 'regex', 'pattern': '_bcbio.*'})
    
    config.update_dict(config.table_columns_visible, {
        'FastQC': {
            'percent_duplicates': False,
            'total_sequences': False,
        },
        'QualiMap': {
            'percentage_aligned': False,
        },
        'Samtools Stats': {
            'non-primary_alignments': False,
            'reads_mapped': False,
            'reads_mapped_percent': False,
            'raw_total_sequences': False,
        }
    })

@@ -1497,13 +1497,410 @@
     
-%7D%0A    %7D)
+    'error_rate': False,%0A        %7D,%0A        'SnpEff': %7B%0A            'Change_rate': False,%0A            'Ts_Tv_ratio': False,%0A            'Number_of_variants_before_filter': False,%0A        %7D,%0A    %7D)%0A    config.module_order = %5B%0A        %22bcbio%22,%0A        %22samtools%22,%0A        %22goleft_indexcov%22,%0A        %22bcftools%22,%0A        %22picard%22,%0A        %22qualimap%22,%0A        %22snpeff%22,%0A        %22fastqc%22,%0A        %22preseq%22%0A    %5D
 %0A

Move table_columns_visible and module_order configs from bcbio source