_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q28200 | MultiqcModule.hicup_stats_table | train | def hicup_stats_table(self):
""" Add core HiCUP stats to the general stats table """
headers = OrderedDict()
headers['Percentage_Ditags_Passed_Through_HiCUP'] = {
'title': '% Passed',
'description': 'Percentage Di-Tags Passed Through HiCUP',
'max': 100,
... | python | {
"resource": ""
} |
q28201 | MultiqcModule.hicup_truncating_chart | train | def hicup_truncating_chart (self):
""" Generate the HiCUP Truncated reads plot """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['Not_Truncated_Reads'] = { 'color': '#2f7ed8', 'name': 'Not Truncated' }
keys['Truncated_Read'] = { 'color':... | python | {
"resource": ""
} |
q28202 | MultiqcModule.hicup_alignment_chart | train | 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'] =... | python | {
"resource": ""
} |
q28203 | MultiqcModule.hicup_filtering_chart | train | def hicup_filtering_chart(self):
""" Generate the HiCUP filtering plot """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['Valid_Pairs'] = { 'color': '#2f7ed8', 'name': 'Valid Pairs' }
keys['Same_Fragment_Internal'] = { 'color': '#0... | python | {
"resource": ""
} |
q28204 | parse_reports | train | def parse_reports(self):
""" Find Qualimap BamQC reports and parse their data """
# General stats - genome_results.txt
self.qualimap_bamqc_genome_results = dict()
for f in self.find_log_files('qualimap/bamqc/genome_results'):
parse_genome_results(self, f)
self.qualimap_bamqc_genome_results ... | python | {
"resource": ""
} |
q28205 | parse_genome_results | train | def parse_genome_results(self, f):
""" Parse the contents of the Qualimap BamQC genome_results.txt file """
regexes = {
'bam_file': r"bam file = (.+)",
'total_reads': r"number of reads = ([\d,]+)",
'mapped_reads': r"number of mapped reads = ([\d,]+)",
'mapped_bases': r"number of ... | python | {
"resource": ""
} |
q28206 | parse_coverage | train | def parse_coverage(self, f):
""" Parse the contents of the Qualimap BamQC Coverage Histogram file """
# Get the sample name from the parent parent directory
# Typical path: <sample name>/raw_data_qualimapReport/coverage_histogram.txt
s_name = self.get_s_name(f)
d = dict()
for l in f['f']:
... | python | {
"resource": ""
} |
q28207 | parse_insert_size | train | def parse_insert_size(self, f):
""" Parse the contents of the Qualimap BamQC Insert Size Histogram file """
# Get the sample name from the parent parent directory
# Typical path: <sample name>/raw_data_qualimapReport/insert_size_histogram.txt
s_name = self.get_s_name(f)
d = dict()
zero_insertsi... | python | {
"resource": ""
} |
q28208 | parse_gc_dist | train | def parse_gc_dist(self, f):
""" Parse the contents of the Qualimap BamQC Mapped Reads GC content distribution file """
# Get the sample name from the parent parent directory
# Typical path: <sample name>/raw_data_qualimapReport/mapped_reads_gc-content_distribution.txt
s_name = self.get_s_name(f)
d ... | python | {
"resource": ""
} |
q28209 | MultiqcModule.flexbar_barplot | train | def flexbar_barplot (self):
""" Make the HighCharts HTML to plot the flexbar rates """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['remaining_reads'] = { 'color': '#437bb1', 'name': 'Remaining reads' }
keys['skipped_due_to_un... | python | {
"resource": ""
} |
q28210 | parse_reports | train | def parse_reports(self):
""" Find RSeQC read_GC reports and parse their data """
# Set up vars
self.read_gc = dict()
self.read_gc_pct = dict()
# Go through files and parse data
for f in self.find_log_files('rseqc/read_gc'):
if f['f'].startswith('GC% read_count'):
gc = list... | python | {
"resource": ""
} |
q28211 | collect_data | train | def collect_data(parent_module):
""" Find Picard VariantCallingMetrics reports and parse their data """
data = dict()
for file_meta in parent_module.find_log_files('picard/variant_calling_metrics', filehandles=True):
s_name = None
for header, value in table_in(file_meta['f'], pre_header_str... | python | {
"resource": ""
} |
q28212 | table_in | train | def table_in(filehandle, pre_header_string):
""" Generator that assumes a table starts the line after a given string """
in_histogram = False
next_is_header = False
headers = list()
for line in stripped(filehandle):
if not in_histogram and line.startswith(pre_header_string):
| python | {
"resource": ""
} |
q28213 | derive_data | train | def derive_data(data):
""" Based on the data derive additional data """
for s_name, values in data.items():
# setup holding variable
# Sum all variants that have been called
total_called_variants = 0
for value_name in ['TOTAL_SNPS', 'TOTAL_COMPLEX_INDELS', 'TOTAL_MULTIALLELIC_S... | python | {
"resource": ""
} |
q28214 | compare_variants_label_plot | train | def compare_variants_label_plot(data):
""" Return HTML for the Compare variants plot"""
keys = OrderedDict()
keys['total_called_variants_known'] = {'name': 'Known Variants'}
keys['total_called_variants_novel'] = {'name': 'Novel Variants'}
pconfig = {
| python | {
"resource": ""
} |
q28215 | MultiqcModule.quast_general_stats_table | train | def quast_general_stats_table(self):
""" Take the parsed stats from the QUAST report and add some to the
General Statistics table at the top of the report """
headers = OrderedDict()
headers['N50'] = {
'title': 'N50 ({})'.format(self.contig_length_suffix),
'descr... | python | {
"resource": ""
} |
q28216 | MultiqcModule.quast_contigs_barplot | train | def quast_contigs_barplot(self):
""" Make a bar plot showing the number and length of contigs for each assembly """
# Prep the data
data = dict()
categories = []
for s_name, d in self.quast_data.items():
nums_by_t = dict()
for k, v in d.items():
... | python | {
"resource": ""
} |
q28217 | MultiqcModule.quast_predicted_genes_barplot | train | def quast_predicted_genes_barplot(self):
"""
Make a bar plot showing the number and length of predicted genes
for each assembly
"""
# Prep the data
# extract the ranges given to quast with "--gene-thresholds"
prefix = '# predicted genes (>= '
suffix = ' b... | python | {
"resource": ""
} |
q28218 | MultiqcModule.clipandmerge_general_stats_table | train | def clipandmerge_general_stats_table(self):
""" Take the parsed stats from the ClipAndMerge report and add it to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['percentage'] = {
| python | {
"resource": ""
} |
q28219 | plot_basic_hist | train | def plot_basic_hist(samples, file_type, **plot_args):
""" Create line graph plot for basic histogram data for 'file_type'.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_type]
"""
sumy = sum([int(samples[sample]['data'][x][0])
... | python | {
"resource": ""
} |
q28220 | BaseRecalibratorMixin.parse_gatk_base_recalibrator | train | def parse_gatk_base_recalibrator(self):
""" Find GATK BaseRecalibrator logs and parse their data """
report_table_headers = {
'#:GATKTable:Arguments:Recalibration argument collection values used in this run': 'arguments',
'#:GATKTable:Quantized:Quality quantization map': 'qualit... | python | {
"resource": ""
} |
q28221 | BaseRecalibratorMixin.add_quality_score_vs_no_of_observations_section | train | def add_quality_score_vs_no_of_observations_section(self):
""" Add a section for the quality score vs number of observations line plot """
sample_data = []
data_labels = []
for rt_type_name, rt_type in recal_table_type._asdict().items():
sample_tables = self.gatk_base_recali... | python | {
"resource": ""
} |
q28222 | MultiqcModule.parse_bbt | train | def parse_bbt(self, fh):
""" Parse the BioBloom Tools output into a 3D dict """
parsed_data = OrderedDict()
headers = None
for l in fh:
s = l.split("\t")
| python | {
"resource": ""
} |
q28223 | MultiqcModule.parse_fqscreen | train | def parse_fqscreen(self, f):
""" Parse the FastQ Screen output into a 3D dict """
parsed_data = OrderedDict()
reads_processed = None
nohits_pct = None
for l in f['f']:
if l.startswith('%Hit_no_genomes:') or l.startswith('%Hit_no_libraries:'):
nohits_pc... | python | {
"resource": ""
} |
q28224 | MultiqcModule.fqscreen_plot | train | def fqscreen_plot (self):
""" Makes a fancy custom plot which replicates the plot seen in the main
FastQ Screen program. Not useful if lots of samples as gets too wide. """
categories = list()
getCats = True
data = list()
p_types = OrderedDict()
p_types['multiple... | python | {
"resource": ""
} |
q28225 | MultiqcModule.parse_minionqc_report | train | def parse_minionqc_report(self, s_name, f):
'''
Parses minionqc's 'summary.yaml' report file for results.
Uses only the "All reads" stats. Ignores "Q>=x" part.
'''
try:
# Parsing as OrderedDict is slightly messier with YAML
# http://stackoverflow.com/a/210... | python | {
"resource": ""
} |
q28226 | MultiqcModule.headers_to_use | train | def headers_to_use(self):
'''
Defines features of columns to be used in multiqc table
'''
headers = OrderedDict()
headers['total.reads'] = {
'title': 'Total reads',
'description': 'Total number of reads',
'format': '{:,.0f}',
'scal... | python | {
"resource": ""
} |
q28227 | MultiqcModule.table_qALL | train | def table_qALL(self):
""" Table showing stats for all reads """
self.add_section (
name = 'Stats: All reads',
anchor = 'minionqc-stats-qAll',
description = 'MinIONQC statistics for all reads',
plot = table.plot(
self.minionqc_data,
... | python | {
"resource": ""
} |
q28228 | MultiqcModule.table_qfiltered | train | def table_qfiltered(self):
""" Table showing stats for q-filtered reads """
description = 'MinIONQC statistics for quality filtered reads. ' + \
'Quailty threshold used: {}.'.format(', '.join(list(self.q_threshold_list)))
if len(self.q_threshold_list) > 1:
de... | python | {
"resource": ""
} |
q28229 | RmdupReportMixin.parse_samtools_rmdup | train | 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 ' '
... | python | {
"resource": ""
} |
q28230 | MultiqcModule.parse_summary | train | def parse_summary(self, contents):
"""Parses summary file into a dictionary of counts."""
lines = contents.strip().split('\n')
data = {}
for row in lines[1:]:
| python | {
"resource": ""
} |
q28231 | MultiqcModule.add_stats_table | train | def add_stats_table(self):
"""Adds stats to general table."""
totals = {sample: sum(counts.values())
for sample, counts in self.data.items()}
percentages = {sample: {k: (v / totals[sample]) * 100
for k, v in counts.items()}
... | python | {
"resource": ""
} |
q28232 | MultiqcModule.add_stats_plot | train | def add_stats_plot(self):
"""Plots alignment stats as bargraph."""
keys = OrderedDict()
keys['species_a'] = {'color': '#437bb1', 'name': 'Species a'}
keys['species_b'] = {'color': '#b1084c', 'name': 'Species b'}
keys['ambiguous'] = {'color': '#333333', 'name': 'Ambiguous'}
... | python | {
"resource": ""
} |
q28233 | MultiqcModule.parse_htseq_report | train | def parse_htseq_report (self, f):
""" Parse the HTSeq Count log file. """
keys = [ '__no_feature', '__ambiguous', '__too_low_aQual', '__not_aligned', '__alignment_not_unique' ]
parsed_data = dict()
assigned_counts = 0
for l in f['f']:
s = l.split("\t")
if ... | python | {
"resource": ""
} |
q28234 | MultiqcModule.htseq_stats_table | train | def htseq_stats_table(self):
""" Take the parsed stats from the HTSeq Count 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',... | python | {
"resource": ""
} |
q28235 | MultiqcModule.htseq_counts_chart | train | def htseq_counts_chart (self):
""" Make the HTSeq Count assignment rates plot """
cats = OrderedDict()
cats['assigned'] = { 'name': 'Assigned' }
cats['ambiguous'] = { 'name': 'Ambiguous' }
cats['alignment_not_unique'] = { 'name': 'Alignment Not Unique' }
cats['no... | python | {
"resource": ""
} |
q28236 | MultiqcModule.parse_selfsm | train | def parse_selfsm(self, f):
""" Go through selfSM file and create a dictionary with the sample name as a key, """
#create a dictionary to populate from this sample's file
parsed_data = dict()
# set a empty variable which denotes if the headers have been read
headers = None
# for each line in the file
for l... | python | {
"resource": ""
} |
q28237 | MultiqcModule.hisat2_general_stats_table | train | def hisat2_general_stats_table(self):
""" Take the parsed stats from the HISAT2 report and add it to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['overall_alignment_rate'] = {
'title': '% Aligned',
| python | {
"resource": ""
} |
q28238 | BaseMultiqcModule.add_section | train | def add_section(self, name=None, anchor=None, description='', comment='', helptext='', plot='', content='', autoformat=True, autoformat_type='markdown'):
""" Add a section to the module report output """
# Default anchor
if anchor is None:
if name is not None:
nid = ... | python | {
"resource": ""
} |
q28239 | BaseMultiqcModule.ignore_samples | train | def ignore_samples(self, data):
""" Strip out samples which match `sample_names_ignore` """
try:
if isinstance(data, OrderedDict):
newdata = OrderedDict()
elif isinstance(data, dict):
newdata = dict()
else:
return data
... | python | {
"resource": ""
} |
q28240 | parse_single_report | train | def parse_single_report(f):
""" Parse a samtools idxstats idxstats """
parsed_data = OrderedDict()
for l in f.splitlines():
| python | {
"resource": ""
} |
q28241 | MultiqcModule.parse_logs | train | def parse_logs(self, f):
"""Parse a given HiCExplorer log file from hicBuildMatrix."""
data = {}
for l in f.splitlines():
# catch empty lines
if len(l) == 0:
continue
s = l.split("\t")
data_ = []
# catch lines with descr... | python | {
"resource": ""
} |
q28242 | MultiqcModule.hicexplorer_basic_statistics | train | def hicexplorer_basic_statistics(self):
"""Create the general statistics for HiCExplorer."""
data = {}
for file in self.mod_data:
max_distance_key = 'Max rest. site distance'
total_pairs = self.mod_data[file]['Pairs considered'][0]
try:
self.mo... | python | {
"resource": ""
} |
q28243 | MultiqcModule.hicexplorer_create_plot | train | def hicexplorer_create_plot(self, pKeyList, pTitle, pId):
"""Create the graphics containing information about the read quality."""
keys = OrderedDict()
for i, key_ in enumerate(pKeyList):
keys[key_] = {'color': self.colors[i]}
data = {}
for data_ in self.mod_data:... | python | {
"resource": ""
} |
q28244 | MultiqcModule.parse_clusterflow_logs | train | def parse_clusterflow_logs(self, f):
""" Parse Clusterflow logs """
module = None
job_id = None
pipeline_id = None
for l in f['f']:
# Get pipeline ID
module_r = re.match(r'Module:\s+(.+)$', l)
if module_r:
module = module_r.gro... | python | {
"resource": ""
} |
q28245 | MultiqcModule.clusterflow_commands_table | train | def clusterflow_commands_table (self):
""" Make a table of the Cluster Flow commands """
# I wrote this when I was tired. Sorry if it's incomprehensible.
desc = '''Every Cluster Flow run will have many different commands.
MultiQC splits these by whitespace, collects by the tool nam... | python | {
"resource": ""
} |
q28246 | MultiqcModule._replace_variable_chunks | train | def _replace_variable_chunks(self, cmds):
""" List through a list of command chunks. Return a single list
with any variable bits blanked out. """
cons_cmd = None
while cons_cmd is None:
for cmd in cmds:
if cons_cmd is None:
cons_cmd = cmd[... | python | {
"resource": ""
} |
q28247 | MultiqcModule._guess_cmd_name | train | def _guess_cmd_name(self, cmd):
""" Manually guess some known command names, where we can
do a better job than the automatic parsing. """
# zcat to bowtie
if cmd[0] == 'zcat' and 'bowtie' in cmd:
| python | {
"resource": ""
} |
q28248 | MultiqcModule.clusterflow_pipelines_section | train | def clusterflow_pipelines_section(self):
""" Generate HTML for section about pipelines, generated from
information parsed from run files. """
data = dict()
pids_guessed = ''
for f,d in self.clusterflow_runfiles.items():
pid = d.get('pipeline_id', 'unknown')
... | python | {
"resource": ""
} |
q28249 | MultiqcModule.sortmerna_detailed_barplot | train | def sortmerna_detailed_barplot (self):
""" Make the HighCharts HTML to plot the sortmerna rates """
# Specify the order of the different possible categories
keys = OrderedDict()
metrics = set()
for sample in self.sortmerna:
for key in self.sortmerna[sample]:
... | python | {
"resource": ""
} |
q28250 | parse_reports | train | def parse_reports(self):
""" Find RSeQC inner_distance frequency reports and parse their data """
# Set up vars
self.inner_distance = dict()
self.inner_distance_pct = dict()
# Go through files and parse data
for f in self.find_log_files('rseqc/inner_distance'):
if f['s_name'] in self.i... | python | {
"resource": ""
} |
q28251 | MultiqcModule.lane_stats_table | train | def lane_stats_table(self):
""" Return a table with overview stats for each bcl2fastq lane for a single flow cell """
headers = OrderedDict()
headers['total_yield'] = {
'title': '{} Total Yield'.format(config.base_count_prefix),
'description': 'Number of bases ({})'.forma... | python | {
"resource": ""
} |
q28252 | MultiqcModule.get_bar_data_from_undetermined | train | def get_bar_data_from_undetermined(self, flowcells):
""" Get data to plot for undetermined barcodes.
"""
bar_data = defaultdict(dict)
# get undetermined barcodes for each lanes
for lane_id, lane in flowcells.items():
try:
for barcode, count in islice(l... | python | {
"resource": ""
} |
q28253 | MultiqcModule.kallisto_general_stats_table | train | def kallisto_general_stats_table(self):
""" Take the parsed stats from the Kallisto report and add it to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['fragment_length'] = {
'title': 'Frag Length',
'description': 'Estimated av... | python | {
"resource": ""
} |
q28254 | MultiqcModule.parse_hicpro_stats | train | def parse_hicpro_stats(self, f, rsection):
""" Parse a HiC-Pro stat file """
s_name = self.clean_s_name(os.path.basename(f['root']), os.path.dirname(f['root']))
if s_name not in self.hicpro_data.keys():
self.hicpro_data[s_name] = {}
| python | {
"resource": ""
} |
q28255 | MultiqcModule.hicpro_mapping_chart | train | 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']... | python | {
"resource": ""
} |
q28256 | MultiqcModule.hicpro_pairing_chart | train | def hicpro_pairing_chart (self):
""" Generate Pairing chart """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['Unique_paired_alignments'] = { 'color': '#005ce6', 'name': 'Uniquely Aligned' }
keys['Low_qual_pairs'] = { 'color': '#b97b35', 'nam... | python | {
"resource": ""
} |
q28257 | MultiqcModule.hicpro_filtering_chart | train | def hicpro_filtering_chart (self):
""" Generate the HiC-Pro filtering plot """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['Valid_interaction_pairs_FF'] = { 'color': '#ccddff', 'name': 'Valid Pairs FF' }
keys['Valid_interaction_pairs_RR'] =... | python | {
"resource": ""
} |
q28258 | MultiqcModule.hicpro_contact_chart | train | def hicpro_contact_chart (self):
""" Generate the HiC-Pro interaction plot """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['cis_shortRange'] = { 'color': '#0039e6', 'name': 'Unique: cis <= 20Kbp' }
keys['cis_longRange'] = { 'color': '#809ff... | python | {
"resource": ""
} |
q28259 | MultiqcModule.hicpro_capture_chart | train | 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 interac... | python | {
"resource": ""
} |
q28260 | plotCorrelationMixin.parse_plotCorrelation | train | def parse_plotCorrelation(self):
"""Find plotCorrelation output"""
self.deeptools_plotCorrelationData = dict()
for f in self.find_log_files('deeptools/plotCorrelationData', filehandles=False):
parsed_data, samples = self.parsePlotCorrelationData(f)
for k, v in parsed_data... | python | {
"resource": ""
} |
q28261 | MultiqcModule.parse_featurecounts_report | train | def parse_featurecounts_report (self, f):
""" Parse the featureCounts log file. """
file_names = list()
parsed_data = dict()
for l in f['f'].splitlines():
thisrow = list()
s = l.split("\t")
if len(s) < 2:
continue
if s[0] =... | python | {
"resource": ""
} |
q28262 | MultiqcModule.featurecounts_stats_table | train | 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': '% Assign... | python | {
"resource": ""
} |
q28263 | MultiqcModule.featureCounts_chart | train | def featureCounts_chart (self):
""" Make the featureCounts assignment rates plot """
# Config for the plot
config = {
'id': 'featureCounts_assignment_plot',
'title': 'featureCounts: Assignments',
'ylab': '# Reads',
| python | {
"resource": ""
} |
q28264 | smooth_line_data | train | def smooth_line_data(data, numpoints, sumcounts=True):
"""
Function to take an x-y dataset and use binning to
smooth to a maximum number of datapoints.
"""
smoothed = {}
for s_name, d in data.items():
# Check that we need to smooth this data
if len(d) <= numpoints:
s... | python | {
"resource": ""
} |
q28265 | parse_reports | train | def parse_reports(self):
"""
Find Picard ValidateSamFile reports and parse their data based on wether we
think it's a VERBOSE or SUMMARY report
"""
# Get data
data = _parse_reports_by_type(self)
if data:
# Filter to strip out ignored sample names (REQUIRED)
data = ... | python | {
"resource": ""
} |
q28266 | _parse_reports_by_type | train | def _parse_reports_by_type(self):
""" Returns a data dictionary
Goes through logs and parses them based on 'No errors found', VERBOSE or SUMMARY type.
"""
data = dict()
for file_meta in self.find_log_files('picard/sam_file_validation', filehandles=True):
sample = file_meta['s_name']
... | python | {
"resource": ""
} |
q28267 | _histogram_data | train | def _histogram_data(iterator):
""" Yields only the row contents that contain the histogram entries """
histogram_started = False
header_passed = False
for l in iterator:
if '## HISTOGRAM' in l:
| python | {
"resource": ""
} |
q28268 | _add_data_to_general_stats | train | def _add_data_to_general_stats(self, data):
"""
Add data for the general stats in a Picard-module specific manner
"""
headers = _get_general_stats_headers()
self.general_stats_headers.update(headers)
header_names = ('ERROR_count', 'WARNING_count', 'file_validation_status')
general_dat... | python | {
"resource": ""
} |
q28269 | _generate_overview_note | train | def _generate_overview_note(pass_count, only_warning_count, error_count, total_count):
""" Generates and returns the HTML note that provides a summary of validation status. """
note_html = ['<div class="progress">']
pbars = [
[ float(error_count), 'danger', 'had errors' ],
[ float(only_warn... | python | {
"resource": ""
} |
q28270 | _generate_detailed_table | train | def _generate_detailed_table(data):
"""
Generates and retuns the HTML table that overviews the details found.
"""
headers = _get_general_stats_headers()
# Only add headers for errors/warnings we have found
for problems in data.values():
for problem in problems:
if proble... | python | {
"resource": ""
} |
q28271 | MultiqcModule.busco_plot | train | def busco_plot (self, lin):
""" Make the HighCharts HTML for the BUSCO plot for a particular lineage """
data = {}
for s_name in self.busco_data:
if self.busco_data[s_name].get('lineage_dataset') == lin:
data[s_name] = self.busco_data[s_name]
plot_keys = ['c... | python | {
"resource": ""
} |
q28272 | MultiqcModule.trimmomatic_barplot | train | def trimmomatic_barplot (self):
""" Make the HighCharts HTML to plot the trimmomatic rates """
# Specify the order of the different possible categories
keys = OrderedDict()
keys['surviving'] = { 'color': '#437bb1', 'name': 'Surviving Reads' }
keys['both_surviving'] ... | python | {
"resource": ""
} |
q28273 | MultiqcModule.parse_peddy_summary | train | def parse_peddy_summary(self, f):
""" Go through log file looking for peddy output """
parsed_data = dict()
headers = None
for l in f['f'].splitlines():
s = l.split("\t")
if headers is None:
s[0] = s[0].lstrip('#')
| python | {
"resource": ""
} |
q28274 | MultiqcModule.parse_peddy_csv | train | def parse_peddy_csv(self, f, pattern):
""" Parse csv output from peddy """
parsed_data = dict()
headers = None
s_name_idx = None
for l in f['f'].splitlines():
s = l.split(",")
if headers is None:
headers = s
try:
... | python | {
"resource": ""
} |
q28275 | MultiqcModule.peddy_general_stats_table | train | def peddy_general_stats_table(self):
""" Take the parsed stats from the Peddy report and add it to the
basic stats table at the top of the report """
family_ids = [ x.get('family_id') for x in self.peddy_data.values() ]
headers = OrderedDict()
headers['family_id'] = {
... | python | {
"resource": ""
} |
q28276 | MultiqcModule.add_barplot | train | def add_barplot(self):
""" Generate the Samblaster bar plot. """
cats = OrderedDict()
cats['n_nondups'] = {'name': 'Non-duplicates'}
cats['n_dups'] = {'name': 'Duplicates'}
pconfig = {
'id': 'samblaster_duplicates',
| python | {
"resource": ""
} |
q28277 | MultiqcModule.parse_samblaster | train | def parse_samblaster(self, f):
""" Go through log file looking for samblaster output.
If the
Grab the name from the RG tag of the preceding bwa command """
dups_regex = "samblaster: (Removed|Marked) (\d+) of (\d+) \((\d+.\d+)%\) read ids as duplicates"
input_file_regex = "samblas... | python | {
"resource": ""
} |
q28278 | MultiqcModule._short_chrom | train | def _short_chrom(self, chrom):
"""Plot standard chromosomes + X, sorted numerically.
Allows specification from a list of chromosomes via config
for non-standard genomes.
"""
default_allowed = set(["X"])
allowed_chroms = set(getattr(config, "goleft_indexcov_config", {}).g... | python | {
"resource": ""
} |
q28279 | MultiqcModule.parse_conpair_logs | train | def parse_conpair_logs(self, f):
""" Go through log file looking for conpair concordance or contamination output
One parser to rule them all. """
conpair_regexes = {
'concordance_concordance': r"Concordance: ([\d\.]+)%",
'concordance_used_markers': r"Based on (\d+)/\d+ m... | python | {
"resource": ""
} |
q28280 | MultiqcModule.conpair_general_stats_table | train | def conpair_general_stats_table(self):
""" Take the parsed stats from the Conpair report and add it to the
basic stats table at the top of the report """
headers = {}
headers['concordance_concordance'] = {
'title': 'Concordance',
'max': 100,
'min': 0,... | python | {
"resource": ""
} |
q28281 | plotPCAMixin.parse_plotPCA | train | def parse_plotPCA(self):
"""Find plotPCA output"""
self.deeptools_plotPCAData = dict()
for f in self.find_log_files('deeptools/plotPCAData', filehandles=False):
parsed_data = self.parsePlotPCAData(f)
for k, v in parsed_data.items():
if k in self.deeptools_... | python | {
"resource": ""
} |
q28282 | mqc_load_userconfig | train | def mqc_load_userconfig(paths=()):
""" Overwrite config defaults with user config files """
# Load and parse installation config file if we find it
mqc_load_config(os.path.join( os.path.dirname(MULTIQC_DIR), 'multiqc_config.yaml'))
# Load and parse a user config file if we find it
mqc_load_config(... | python | {
"resource": ""
} |
q28283 | mqc_load_config | train | def mqc_load_config(yaml_config):
""" Load and parse a config file if we find it """
if os.path.isfile(yaml_config):
try:
with open(yaml_config) as f:
new_config = yaml.safe_load(f)
logger.debug("Loading config settings from: {}".format(yaml_config))
... | python | {
"resource": ""
} |
q28284 | mqc_add_config | train | def mqc_add_config(conf, conf_path=None):
""" Add to the global config with given MultiQC config dict """
global fn_clean_exts, fn_clean_trim
for c, v in conf.items():
if c == 'sp':
# Merge filename patterns instead of replacing
sp.update(v)
logger.debug("Added to... | python | {
"resource": ""
} |
q28285 | update_dict | train | def update_dict(d, u):
""" Recursively updates nested dict d from nested dict u
"""
for key, val in u.items():
if isinstance(val, collections.Mapping):
| python | {
"resource": ""
} |
q28286 | _parse_preseq_logs | train | def _parse_preseq_logs(f):
""" Go through log file looking for preseq output """
lines = f['f'].splitlines()
header = lines.pop(0)
data_is_bases = False
if header.startswith('TOTAL_READS EXPECTED_DISTINCT'):
pass
elif header.startswith('TOTAL_BASES EXPECTED_DISTINCT'):
data_is_... | python | {
"resource": ""
} |
q28287 | mqc_colour_scale.get_colour | train | def get_colour(self, val, colformat='hex'):
""" Given a value, return a colour within the colour scale """
try:
# Sanity checks
val = re.sub("[^0-9\.]", "", str(val))
if val == '':
val = self.minval
val = float(val)
val = max(val, self.minval)
val = min(val, self.maxval)
domain_nums = list... | python | {
"resource": ""
} |
q28288 | MultiqcModule.parse_tophat_log | train | def parse_tophat_log (self, raw_data):
""" Parse the Tophat alignment log file. """
if 'Aligned pairs' in raw_data:
# Paired end data
regexes = {
'overall_aligned_percent': r"([\d\.]+)% overall read mapping rate.",
'concordant_aligned_percent': r"... | python | {
"resource": ""
} |
q28289 | MultiqcModule.tophat_general_stats_table | train | def tophat_general_stats_table(self):
""" Take the parsed stats from the Tophat report and add it to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['overall_aligned_percent'] = {
'title': '% Aligned',
'description': 'overall re... | python | {
"resource": ""
} |
q28290 | MultiqcModule.cutadapt_length_trimmed_plot | train | def cutadapt_length_trimmed_plot (self):
""" Generate the trimming length plot """
description = 'This plot shows the number of reads with certain lengths of adapter trimmed. \n\
Obs/Exp shows the raw counts divided by the number expected due to sequencing errors. A defined peak \n\
may... | python | {
"resource": ""
} |
q28291 | MultiqcModule.bowtie2_general_stats_table | train | def bowtie2_general_stats_table(self):
""" Take the parsed stats from the Bowtie 2 report and add it to the
basic stats table at the top of the report """
headers = OrderedDict()
headers['overall_alignment_rate'] = {
'title': '% Aligned',
| python | {
"resource": ""
} |
q28292 | MultiqcModule.parseJSON | train | def parseJSON(self, f):
""" Parse the JSON output from DamageProfiler and save the summary statistics """
try:
parsed_json = json.load(f['f'])
except Exception as e:
print(e)
log.warn("Could not parse DamageProfiler JSON: '{}'".format(f['fn']))
ret... | python | {
"resource": ""
} |
q28293 | MultiqcModule.lgdistplot | train | def lgdistplot(self,dict_to_use,orientation):
"""Generate a read length distribution plot"""
data = dict()
for s_name in dict_to_use:
try:
data[s_name] = {int(d): int (dict_to_use[s_name][d]) for d in dict_to_use[s_name]}
except KeyError:
... | python | {
"resource": ""
} |
q28294 | MultiqcModule.threeprime_plot | train | def threeprime_plot(self):
"""Generate a 3' G>A linegraph plot"""
data = dict()
dict_to_add = dict()
# Create tuples out of entries
for key in self.threepGtoAfreq_data:
pos = list(range(1,len(self.threepGtoAfreq_data.get(key))))
#Multiply values by 100 to... | python | {
"resource": ""
} |
q28295 | MultiqcModule.parse_fastqc_report | train | def parse_fastqc_report(self, file_contents, s_name=None, f=None):
""" Takes contents from a fastq_data.txt file and parses out required
statistics and data. Returns a dict with keys 'stats' and 'data'.
Data is for plotting graphs, stats are for top table. """
# Make the sample name fro... | python | {
"resource": ""
} |
q28296 | MultiqcModule.fastqc_general_stats | train | def fastqc_general_stats(self):
""" Add some single-number stats to the basic statistics
table at the top of the report """
# Prep the data
data = dict()
for s_name in self.fastqc_data:
bs = self.fastqc_data[s_name]['basic_statistics']
data[s_name] = {
... | python | {
"resource": ""
} |
q28297 | MultiqcModule.get_status_cols | train | def get_status_cols(self, section):
""" Helper function - returns a list of colours according to the FastQC
status of this module for each sample. """
colours = dict()
for s_name in self.fastqc_data:
| python | {
"resource": ""
} |
q28298 | TagDirReportMixin.homer_tagdirectory | train | def homer_tagdirectory(self):
""" Find HOMER tagdirectory logs and parse their data """
self.parse_gc_content()
self.parse_re_dist()
self.parse_tagLength_dist()
self.parse_tagInfo_data() | python | {
"resource": ""
} |
q28299 | TagDirReportMixin.parse_gc_content | train | def parse_gc_content(self):
"""parses and plots GC content and genome GC content files"""
# Find and parse GC content:
for f in self.find_log_files('homer/GCcontent', filehandles=True):
# Get the s_name from the parent directory
s_name = os.path.basename(f['root'])
... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.