Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def featurecounts_stats_table(self):
""" Take the parsed stats from the featureCounts report and add them to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['percent_assigned'] = {
'title': '% Assigned',
'description': '% Assigned reads',
'max': 100,
'min': 0,
'suffix': '%',
'scale': 'RdYlGn'
}
headers['Assigned'] = {
'title': '{} Assigned'.format(config.read_count_prefix),
'description': 'Assigned reads ({})'.format(config.read_count_desc),
'min': 0,
'scale': 'PuBu',
'modify': lambda x: float(x) * config.read_count_multiplier,
'shared_key': 'read_count'
}
self.general_stats_addcols(self.featurecounts_data, headers)
def sargasso_stats_table(self):
""" Take the parsed stats from the sargasso report and add them to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['sargasso_percent_assigned'] = {
'title': '% Assigned',
'description': 'Sargasso % Assigned reads',
'max': 100,
'min': 0,
'suffix': '%',
'scale': 'RdYlGn'
}
headers['Assigned-Reads'] = {
'title': '{} Assigned'.format(config.read_count_prefix),
'description': 'Sargasso Assigned reads ({})'.format(config.read_count_desc),
'min': 0,
'scale': 'PuBu',
'modify': lambda x: float(x) * config.read_count_multiplier,
'shared_key': 'read_count'
}
self.general_stats_addcols(self.sargasso_data, headers)
def index_metrics_summary_table(self,data):
headers = OrderedDict()
headers['Total Reads'] = {
'title': '{} Reads'.format(config.read_count_prefix),
'description': 'The total number of reads for this lane ({})'.format(config.read_count_desc),
'modify': lambda x: float(x) * config.read_count_multiplier,
'format': '{:,.2f}',
'shared_key': 'read_count'
}
headers['PF Reads'] = {
'title': '{} PF Reads'.format(config.read_count_prefix),
'description': 'The total number of passing filter reads for this lane ({})'.format(config.read_count_desc),
'modify': lambda x: float(x) * config.read_count_multiplier,
'format': '{:,.2f}',
'shared_key': 'read_count'
}
headers['% Read Identified (PF)'] = {
'rid': 'summary_reads_identified_pf',
'title': '% Reads Identified (PF)',
'description': 'The total fraction of passing filter reads assigned to an index.',
'suffix': '%',
'description': 'Average coverage (X) on nuclear genome.',
'min': 0,
'scale': 'GnBu',
'suffix': ' X',
'hidden': True
}
headers['mt_nuc_ratio'] = {
'title': 'MT to Nuclear Ratio',
'description': 'Mitochondrial to nuclear reads ratio (MTNUC)',
'min': 0,
'max': 100,
'scale': 'RdYlGrn-rev',
}
headers['nucreads'] = {
'title': '{} Genome reads'.format(config.read_count_prefix),
'description': 'Reads on the nuclear genome ({})'.format(config.read_count_desc),
'modify': lambda x: x * config.read_count_multiplier,
'shared_key': 'read_count',
'scale': 'BuPu',
'hidden': True
}
headers['mtreads'] = {
'title': '{} MT genome reads'.format(config.read_count_prefix),
'description': 'Reads on the mitochondrial genome ({})'.format(config.read_count_desc),
'modify': lambda x: x * config.read_count_multiplier,
'shared_key': 'read_count',
'scale': 'OrRd',
'hidden': True
}
self.general_stats_addcols(self.mtnuc_data, headers)
'min': 0,
'scale': 'PuRd',
'modify': lambda x: x * config.read_count_multiplier,
'shared_key': 'read_count'
}
headers['Percentage_Valid'] = {
'title': '% Valid',
'description': 'Percent Valid Pairs',
'max': 100,
'min': 0,
'suffix': '%',
'scale': 'YlGn'
}
headers['Paired_Read_1'] = {
'title': '{} Pairs Aligned'.format(config.read_count_prefix),
'description': 'Paired Alignments ({})'.format(config.read_count_desc),
'min': 0,
'scale': 'PuRd',
'modify': lambda x: x * config.read_count_multiplier,
'shared_key': 'read_count'
}
headers['Percentage_Mapped'] = {
'title': '% Aligned',
'description': 'Percentage of Paired Alignments',
'max': 100,
'min': 0,
'suffix': '%',
'scale': 'YlGn'
}
self.general_stats_addcols(self.hicup_data, headers, 'HiCUP')
}
headers['multimapper'] = {
'namespace': 'Slamdunk',
'title': '{} Multimap-Filtered'.format(config.read_count_prefix),
'description': '# multimap-filtered reads ({})'.format(config.read_count_desc),
'shared_key': 'read_count',
'min': 0,
'format': '{:,.2f}',
'suffix': config.read_count_prefix,
'scale': 'OrRd',
'modify': lambda x: float(x) * config.read_count_multiplier,
}
headers['nmfiltered'] = {
'namespace': 'Slamdunk',
'title': '{} NM-Filtered'.format(config.read_count_prefix),
'description': '# NM-filtered reads ({})'.format(config.read_count_desc),
'shared_key': 'read_count',
'min': 0,
'format': '{:,.2f}',
'suffix': config.read_count_prefix,
'scale': 'OrRd',
'modify': lambda x: float(x) * config.read_count_multiplier,
}
headers['idfiltered'] = {
'namespace': 'Slamdunk',
'title': '{} Identity-Filtered'.format(config.read_count_prefix),
'description': '# identity-filtered reads ({})'.format(config.read_count_desc),
'shared_key': 'read_count',
'min': 0,
'format': '{:,.2f}',
'suffix': config.read_count_prefix,
'scale': 'OrRd',
'max': 100,
'min': 0,
'suffix': '%',
'scale': 'BuGn',
}
headers['good_reads'] = {
'title': '{} Good Reads'.format(config.read_count_prefix),
'description': 'Good Reads ({})'.format(config.read_count_desc),
'min': 0,
'modify': lambda x: x * config.read_count_multiplier,
'scale': 'GnBu',
'shared_key': 'read_count'
}
headers['total_reads'] = {
'title': '{} Total Reads'.format(config.read_count_prefix),
'description': 'Total Reads ({})'.format(config.read_count_desc),
'min': 0,
'modify': lambda x: x * config.read_count_multiplier,
'scale': 'Blues',
'shared_key': 'read_count'
}
headers['readlen'] = {
'title': 'Read Length',
'description': 'Read Length',
'min': 0,
'suffix': ' bp',
'format': '{:,.0f}',
'scale': 'YlGn'
}
self.general_stats_addcols(self.afterqc_data, headers)
self.add_data_source(f, section='flagstat')
self.samtools_flagstat[f['s_name']] = parsed_data
# Filter to strip out ignored sample names
self.samtools_flagstat = self.ignore_samples(self.samtools_flagstat)
if len(self.samtools_flagstat) > 0:
# Write parsed report data to a file (restructure first)
self.write_data_file(self.samtools_flagstat, 'multiqc_samtools_flagstat')
# General Stats Table
flagstats_headers = dict()
flagstats_headers['mapped_passed'] = {
'title': '{} Reads Mapped'.format(config.read_count_prefix),
'description': 'Reads Mapped in the bam file ({})'.format(config.read_count_desc),
'min': 0,
'modify': lambda x: x * config.read_count_multiplier,
'shared_key': 'read_count',
'placement' : 100.0
}
self.general_stats_addcols(self.samtools_flagstat, flagstats_headers, 'Samtools Flagstat')
# Make dot plot of counts
keys = OrderedDict()
reads = {
'min': 0,
'modify': lambda x: float(x) / 1000000.0,
'suffix': 'M reads',
'decimalPlaces': 2,
'shared_key': 'read_count'
}
'description': 'Mean coverage',
'min': 0,
'suffix': 'X',
'scale': 'BuPu'
}
self.general_stats_headers['percentage_aligned'] = {
'title': '% Aligned',
'description': '% mapped reads',
'max': 100,
'min': 0,
'suffix': '%',
'scale': 'YlGn'
}
self.general_stats_headers['mapped_reads'] = {
'title': '{} Aligned'.format(config.read_count_prefix),
'description': 'Number of mapped reads ({})'.format(config.read_count_desc),
'scale': 'RdYlGn',
'shared_key': 'read_count',
'hidden': True
}
self.general_stats_headers['total_reads'] = {
'title': '{} Total reads'.format(config.read_count_prefix),
'description': 'Number of reads ({})'.format(config.read_count_desc),
'scale': 'Blues',
'shared_key': 'read_count',
'hidden': True
}
self.general_stats_headers['general_error_rate'] = {
'title': 'Error rate',
'description': 'Alignment error rate. Total edit distance (SAM NM field) over the number of mapped bases',
'max': 100,
'min': 0,
def star_stats_table(self):
""" Take the parsed stats from the STAR report and add them to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['uniquely_mapped_percent'] = {
'title': '% Aligned',
'description': '% Uniquely mapped reads',
'max': 100,
'min': 0,
'suffix': '%',
'scale': 'YlGn'
}
headers['uniquely_mapped'] = {
'title': '{} Aligned'.format(config.read_count_prefix),
'description': 'Uniquely mapped reads ({})'.format(config.read_count_desc),
'min': 0,
'scale': 'PuRd',
'modify': lambda x: x * config.read_count_multiplier,
'shared_key': 'read_count'
}
self.general_stats_addcols(self.star_data, headers)