diff --git a/.gitignore b/.gitignore index ab3fd51e..1c261e19 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,7 @@ workflows/rnaseq/downstream/rnaseq_cache workflows/rnaseq/downstream/rnaseq_files workflows/rnaseq/downstream/rnaseq.html *.xlsx +*.html ._* Rplots.pdf /lib/include/* diff --git a/lib/common.py b/lib/common.py index 829cc129..51e3e161 100644 --- a/lib/common.py +++ b/lib/common.py @@ -15,6 +15,8 @@ from lib import utils from snakemake.shell import shell from snakemake.io import expand +from collections import defaultdict +import pandas as pd # List of possible keys in config that are to be interpreted as paths PATH_KEYS = [ @@ -912,3 +914,50 @@ def gff2gtf(gff, gtf): shell('gzip -d -S .gz.0.tmp {gff} -c | gffread - -T -o- | gzip -c > {gtf}') else: shell('gffread {gff} -T -o- | gzip -c > {gtf}') + +def validate_counts(): + # Validate region counts using pysam + # Get counts for these user defined regions in config.yaml: + # expression_barchart_mqc: + # cold: chr2L:574291-575734 + # hop: chr2L:295122-297449 + + # Load the config.yaml file + with open("workflows/rnaseq/config/config.yaml", "r") as file: + config = yaml.safe_load(file) + + # Access 'expression_barchart_multiqc' + expression_barchart_multiqc = config.get("expression_barchart_multiqc") + # Initialize an empty dictionary to store the regions + regions = {} + + # Loop through each item in expression_barchart_multiqc + for key, value in expression_barchart_multiqc.items(): + # Split the value to extract chromosome, start, and end positions + chromosome, positions = value.split(':') + start, end = map(int, positions.split('-')) + # Assign the tuple to the regions dictionary + regions[key] = (chromosome, start, end) + + # Load size factors + size_factors_df = pd.read_csv("workflows/rnaseq/data/rnaseq_aggregation/size_factors.tsv", sep='\t', index_col='samplename') + size_factors_dict = size_factors_df['sizeFactors'].to_dict() + known_truth_size_factors = {'sample1': 0.8978351212725632, 'sample2': 0.803021738695754, 'sample3': 1.1635520481783863, 'sample4': 1.128217861246003} + + # Initialize a defaultdict to store normalized counts for each sample and region + normalized_counts = defaultdict(dict) + raw_counts = defaultdict(dict) + + known_truth_raw_counts = {'sample1': {'cold': 329, 'hop': 2977}, 'sample2': {'cold': 547, 'hop': 1847}, 'sample3': {'cold': 405, 'hop': 4024}, 'sample4': {'cold': 290, 'hop': 3693}} + # Loop through each sample and region normalized counts + for sample in ['sample1', 'sample2', 'sample3', 'sample4']: + size_factor = size_factors_df.loc[sample, 'sizeFactors'] + for region in regions.keys(): + # Normalize the count by dividing by the size factor + normalized_counts[sample][region] = float(known_truth_raw_counts[sample][region]) / float(size_factor) + + with open("workflows/rnaseq/data/rnaseq_aggregation/expression_barchart_mqc.yaml", "r") as file: + expr_mqc = yaml.safe_load(file) + expr_mqc = expr_mqc.get("data") + + return(expr_mqc, normalized_counts, size_factors_dict, known_truth_size_factors) diff --git a/lib/multiqc.py b/lib/multiqc.py new file mode 100644 index 00000000..c0e7a0f3 --- /dev/null +++ b/lib/multiqc.py @@ -0,0 +1,285 @@ +import yaml +import pandas as pd +import numpy as np +from collections import defaultdict +import os +import math + + +def lcdbwf_samplename(x): + """ + Processes sample names by removing specific substrings and extracting relevant parts. + + Parameters + ---------- + x : list of str + A list of sample name strings. + + Returns + ------- + list of str + A list of processed sample names. + """ + + processed_names = [] + for name in x: + # Remove unnecessary substrings and split to obtain the core sample name + name = name.replace('data/rnaseq_samples/', '').replace('.cutadapt.bam', '') + name_parts = name.split('/') + processed_names.append(name_parts[0]) + return processed_names + + +def process_featurecounts(fc_path, sampletable_path, output_path, sample_func=lcdbwf_samplename, subset_counts=False): + """ + Processes a feature counts table and matches it with a sample table. + + Parameters + ---------- + fc_path : str + Path to the feature counts file. + sampletable_path : str + Path to the sample table TSV file. + output_path : str + Path to save the processed counts DataFrame. + sample_func : function, optional + Function to process sample names from counts data. Default is `lcdbwf_samplename`. + subset_counts : bool, optional + If True, subsets counts to samples present in the sample table. Default is False. + + Returns + ------- + None + """ + + # Load counts, set 'Geneid' as index, remove metadata columns, and process sample names + m = pd.read_csv(fc_path, sep='\t', comment='#').set_index('Geneid').iloc[:, 5:] + x = sample_func(m.columns.tolist()) + sampletable = pd.read_csv(sampletable_path, sep='\t') + samplenames = sampletable.iloc[:, 0].tolist() + + # Identify samples mismatched between counts and sampletable + counts_not_sampletable = set(x) - set(samplenames) + sampletable_not_counts = set(samplenames) - set(x) + + # Handle mismatches and subset counts if specified + if counts_not_sampletable: + if not subset_counts: + raise ValueError( + f"The following samples are in the counts data but not in the sample table. " + f"Consider using subset_counts=True to remove them from the counts: " + f"{', '.join(counts_not_sampletable)}" + ) + else: + indices_to_keep = [i for i, name in enumerate(x) if name in samplenames] + x = [name for name in x if name in samplenames] + m = m.iloc[:, indices_to_keep] + + if sampletable_not_counts: + raise ValueError( + f"The following samples are in the sample table but not in the counts data. " + f"Check sample_func? {', '.join(sampletable_not_counts)}" + ) + + # Align columns in m to sampletable order and save to output path + m.columns = x + m = m[samplenames] + m.to_csv(output_path, sep='\t') + + +def geometric_mean(arr): + """ + Calculates the geometric mean of non-zero elements of an array. + + Parameters + ---------- + arr : Array of values. + + Returns + ------- + float + Geometric mean of non-zero elements in the array. + """ + return np.exp(np.mean(np.log(arr))) + + +def estimate_sizefactors(counts_path, sizefactors_path, sigfigs = 6): + """ + Estimates size factors for normalization using the median of ratios of counts to geometric means. + + Parameters + ---------- + counts_path : str + Path to the processed counts TSV file. + sizefactors_path : str + Path to save the estimated size factors as a TSV file. + + Returns + ------- + None + """ + + # Load counts, remove rows with zeros, and compute geometric means for each gene + counts_df = pd.read_csv(counts_path, sep='\t', index_col=0) + counts_df = counts_df[counts_df > 0].dropna() + geometric_means = counts_df.apply(geometric_mean, axis=1) + + # Compute size factors by taking median of ratios of counts to geometric means + ratios = counts_df.div(geometric_means, axis=0) + sizefactors_df = ratios.apply(np.median, axis=0) + + # Format size factors as DataFrame, reorder columns, and save + sizefactors_df = pd.DataFrame(sizefactors_df, columns=['sizeFactors']) + sizefactors_df['samplename'] = sizefactors_df.index + sizefactors_df = sizefactors_df[['samplename', 'sizeFactors']].reset_index(drop=True) + # Round size factors to 6 decimal places + sizefactors_df['sizeFactors'] = sizefactors_df['sizeFactors'].apply(lambda x: round(x, 6)) + sizefactors_df.to_csv(sizefactors_path, sep='\t', header=True, index=False) + + +def normalize_user_region_counts_list(sizefactors_path, counts): + """ + Normalize counts for specified regions using size factors. + + Parameters + ---------- + sizefactors_path : str + Path to the size factors TSV file. + counts : list of str + List of paths to counts files for different regions. + + Returns + ------- + defaultdict + Nested dictionary with normalized counts by sample and region. + """ + + sizefactors_df = pd.read_csv(sizefactors_path, sep='\t', index_col='samplename') + normalized_counts = defaultdict(dict) + + for file_path in counts: + parts = file_path.strip().split(os.sep) + sample = parts[-2] + region = parts[-1].replace('.counts.txt', '') + + with open(file_path) as infile: + count = int(infile.read()) + + size_factor = sizefactors_df.loc[sample, 'sizeFactors'] + # Normalize and round counts to 3 decimal places + normalized_counts[sample][region] = round(float(count) / float(size_factor), 3) + + return normalized_counts + + +def make_regions_counts_yaml(sizefactors_path, counts_list, regions, yaml_path): + """ + Generates a YAML file with normalized counts for specified regions for visualization in MultiQC. + + Parameters + ---------- + sizefactors_path : str + Path to the size factors TSV file. + counts : list of str + List of paths to counts files for different regions. + regions : list of str + Configured region names + yaml_path : str + Path to save the generated YAML file. + + Returns + ------- + None + """ + normalized_counts = normalize_user_region_counts_list(sizefactors_path, counts_list) + data = {sample: regions_data for sample, regions_data in normalized_counts.items()} + y = { + 'id': 'expression_barchart', + 'section_name': 'Normalized Counts in User Defined Regions', + 'description': f"The user-defined regions are: {', '.join(regions)}", + 'plot_type': 'bargraph', + 'pconfig': { + 'id': 'user_regions_counts_plot', + 'title': f"Normalized counts in {', '.join(regions)}", + 'ylab': 'Normalized Counts', + 'xlab': 'Samples' + }, + 'data': data + } + + with open(yaml_path, 'w') as outfile: + yaml.dump(y, outfile, default_flow_style=False) + + +def normalize_featurecounts(counts_path, sizefactors_path, output_path): + """ + Normalizes the processed featurecounts table by size factors for each sample. + + Parameters + ---------- + counts_path : str + Path to the counts TSV file. + sizefactors_path : str + Path to the size factors TSV file. + output_path : str + Path to save the normalized counts TSV file. + + Returns + ------- + None + """ + + # Read counts and size factors + counts_df = pd.read_csv(counts_path, sep='\t', index_col=0) + sizefactors_df = pd.read_csv(sizefactors_path, sep='\t', index_col='samplename') + + # Normalize each sample's counts by its size factor + for sample in counts_df.columns: + if sample in sizefactors_df.index: + counts_df[sample] = round(counts_df[sample] / sizefactors_df.loc[sample, 'sizeFactors'], 3) + else: + raise ValueError(f"Size factor for sample '{sample}' not found in sizefactors file: '{sizefactors_path}'.") + + # Save the normalized counts table + counts_df.to_csv(output_path, sep='\t') + +def get_regions(config, c, final_targets): + """ + Reads regions and their start and stop positions from config. + Saves the user configured loci to a dictionary and uses the dictionary + to make a list of region names. Updates final targets to include the expression + multiqc module. + + Parameters + __________ + config : dictionary + config object from config/config.yaml + c : what is c + object of dictionary of target paths + final_targets : list of strings + list of paths to targets + + Returns + _______ + Tuple of + REGIONS : list of str + region names defined in config + REGION_DICT : dict of str + region names and chrom:start-stop + final_targets : list of str + target output files + """ + + final_targets.append(c.targets['expression_mqc_yaml']) + REGION_DICTS = [] + for name, coord in config['expression_barchart_multiqc'].items(): + chrom, positions = coord.strip().split(':') + start, end = positions.strip().split('-') + start = int(start) + end = int(end) + REGION_DICTS.append({'name': name, 'chrom': chrom, 'start': start, 'end': end}) + + REGIONS = [region['name'] for region in REGION_DICTS] + + return (REGIONS, REGION_DICTS, final_targets) + diff --git a/lib/test_suite.py b/lib/test_suite.py index 21b9c052..39c7b6d3 100644 --- a/lib/test_suite.py +++ b/lib/test_suite.py @@ -2,9 +2,26 @@ import pprint from textwrap import dedent from . import common - +from . import multiqc +import yaml +import pandas as pd +from pandas.testing import assert_frame_equal def test_config_loading(tmpdir): + """ + Test the loading of configuration files, including inclusion and overriding of parameters + from multiple YAML files and directories. + + Parameters + ---------- + tmpdir : LocalPath + Temporary directory provided by pytest for testing file-based workflows. + + Raises + ------ + AssertionError + If the loaded configuration does not match the expected dictionary. + """ f0 = tmpdir.mkdir('subdir').join('file0.yaml') dir_to_include = tmpdir.join('subdir') f0.write(dedent(''' @@ -13,7 +30,6 @@ def test_config_loading(tmpdir): tag_from_directory: fasta: url: "https://from_directory" - # Will get overwritten by a specific file tag_from_file: fasta: @@ -35,7 +51,6 @@ def test_config_loading(tmpdir): indexes: - bowtie2 ''')) - f2 = tmpdir.join('file1.yaml') f2.write(dedent(''' references: @@ -46,9 +61,7 @@ def test_config_loading(tmpdir): tag_from_config: fasta: url: "https://from_file" - ''')) - f3 = tmpdir.join('file3.yaml') f3.write(dedent(''' references_dir: "/data" @@ -57,7 +70,6 @@ def test_config_loading(tmpdir): tag_from_config: fasta: url: "https://from_config" - include_references: - {dir_to_include} - {f2} @@ -86,3 +98,109 @@ def test_config_loading(tmpdir): }, } + +def test_multiqc_expr_module(tmpdir): + """ + Test the MultiQC expression module for generating `expression_barchart_mqc.yaml`. + + Parameters + ---------- + tmpdir : LocalPath + Temporary directory provided by pytest for testing file-based workflows. + + Raises + ------ + AssertionError + If the generated YAML file does not match the expected structure and values. + """ + known_truth_raw_counts = {'sample1': {'cold': 329, 'hop': 2977}, 'sample2': {'cold': 547, + 'hop': 1847}, 'sample3': {'cold': 405, 'hop': 4024}, 'sample4': + {'cold': 290, 'hop': 3693}} + known_truth_sizefactors = {'sample1': 0.898, 'sample2': 0.803, + 'sample3': 1.164, 'sample4': 1.128} + featurecounts_path = '../test/test_configs/test_featurecounts.txt' + sampletable_path = '../test/test_configs/test_sampletable.tsv' + processed_fc_path = tmpdir.mkdir('mqc_test').join('processed_featurecounts.tsv') + sizefactors_path = tmpdir.join('sizefactors.tsv') + yaml_path = tmpdir.join('expression_barchart_mqc.yaml') + + multiqc.process_featurecounts(featurecounts_path, sampletable_path, processed_fc_path) + multiqc.estimate_sizefactors(processed_fc_path, sizefactors_path) + counts_file_paths = populate_counts_files(known_truth_raw_counts, tmpdir) + multiqc.make_regions_counts_yaml(sizefactors_path, counts_file_paths, known_truth_raw_counts['sample1'].keys(), yaml_path) + test_yaml = yaml.safe_load(open(yaml_path, "r")) + + snakefile_yaml = { + "data": { + "sample1": {"cold": 366.437, "hop": 3315.754}, + "sample2": {"cold": 681.177, "hop": 2300.062}, + "sample3": {"cold": 348.072, "hop": 3458.376}, + "sample4": {"cold": 257.043, "hop": 3273.304}, + }, + "description": "The user-defined regions are: cold, hop", + "id": "expression_barchart", + "pconfig": { + "id": "user_regions_counts_plot", + "title": "Normalized counts in cold, hop", + "xlab": "Samples", + "ylab": "Normalized Counts", + }, + "plot_type": "bargraph", + "section_name": "Normalized Counts in User Defined Regions", + } + + assert test_yaml == snakefile_yaml + + +def populate_counts_files(known_truth_raw_counts, tmpdir): + """ + Populate temporary files with raw count data for each sample and region. + + Parameters + ---------- + known_truth_raw_counts : dict + Dictionary containing raw counts for each sample and region. + tmpdir : LocalPath + Temporary directory provided by pytest. + + Returns + ------- + list of str + List of file paths to the populated count files. + """ + counts_file_paths = [] + for sample, regions in known_truth_raw_counts.items(): + for region, count in regions.items(): + subdir = tmpdir.join(sample) + subdir.ensure(dir=True) + file_path = subdir.join(f"{region}.counts.txt") + file_path.write(str(count)) + counts_file_paths.append(str(file_path)) + return counts_file_paths + + +def test_process_featurecounts(tmpdir): + """ + Test processing and normalization of feature counts using the MultiQC module. + + Parameters + ---------- + tmpdir : LocalPath + Temporary directory provided by pytest. + + Raises + ------ + AssertionError + If the processed and normalized feature counts do not match the expected values. + """ + featurecounts_path = '../test/test_configs/test_featurecounts.txt' + sampletable_path = '../test/test_configs/test_sampletable.tsv' + processed_fc_path = tmpdir.mkdir('mqc_test').join('processed_featurecounts.tsv') + sizefactors_path = tmpdir.join('sizefactors.tsv') + normalized_path = tmpdir.join('normalized_featurecounts.tsv') + multiqc.process_featurecounts(featurecounts_path, sampletable_path, processed_fc_path) + multiqc.estimate_sizefactors(processed_fc_path, sizefactors_path) + multiqc.normalize_featurecounts(processed_fc_path, sizefactors_path, normalized_path) + test_normalized_fc = pd.read_csv(normalized_path, sep='\t') + snakefile_normalized_fc = pd.read_csv('../test/test_configs/normalized_counts.tsv', sep='\t') + assert_frame_equal(test_normalized_fc, snakefile_normalized_fc, atol=1e-3) diff --git a/test/lcdb-wf-test b/test/lcdb-wf-test index df59b24c..a70e7544 100755 --- a/test/lcdb-wf-test +++ b/test/lcdb-wf-test @@ -36,7 +36,6 @@ You can always see the CI tests (currently in .circleci/config.yml at the top-level of the repo) for how this tool is used. """ - import os import shlex from textwrap import dedent @@ -99,6 +98,7 @@ class Runner(object): %(prog)s data --kind all %(prog)s unit_tests --pytest + %(prog)s unit_tests --validate-mqc %(prog)s unit_tests --r-test %(prog)s rnaseq --run-workflow %(prog)s rnaseq --trackhub @@ -115,6 +115,9 @@ class Runner(object): # Run the pytest unit tests on the lib/ %(prog)s unit_tests --pytest + # Validate the multiqc.html expression barchart exists and its normalized counts are correct + %(prog)s unit_tests --validate-mqc + # Run tests on lcdbwf R package %(prog)s unit_tests --r-test @@ -301,6 +304,11 @@ class Runner(object): action="store_true", help="Run pytest unit tests and module doctests on lib/ directory", ) + parser.add_argument( + "--validate-mqc", + action="store_true", + help="Confirm the multiqc.html contains the expression barchart and its normalized counts are valid", + ) parser.add_argument( "--url-check", action="store_true", @@ -312,7 +320,6 @@ class Runner(object): help="""Run devtools::test on the lcdbwf R package. Activates the conda environment specified by --env-r just before running.""", ) - parser.add_argument( "--ensure-docs", action="store_true", @@ -324,6 +331,40 @@ class Runner(object): if args.pytest: print_header("pytest") sp.run(["pytest", "--doctest-modules", "lib"], check=True, cwd=TOPLEVEL) + if args.validate_mqc: + print_header("Validating multiqc.html expression barchart module") + + # Check for 'expression_barchart' in MultiQC HTML file + result = sp.run( + ["grep", "-q", "#expression_barchart", "workflows/rnaseq/data/rnaseq_aggregation/multiqc.html"], + stdout=sp.PIPE, + stderr=sp.PIPE, + text=True + ) + + if result.returncode == 0: + print("Validation successful: 'expression_barchart' found in multiqc.html") + else: + print("Validation failed: 'expression_barchart' not found in multiqc.html") + sys.exit(1) + + sys.path.insert(0, str(TOPLEVEL)) + from lib.common import validate_counts + expr_mqc, normalized_counts, size_factors_dict, known_truth_size_factors = validate_counts() + + # Validate Snakefile determined normalized counts of user defined regions + if expr_mqc == normalized_counts: + print("User specified region normalized counts validated") + else: + print("User specified region normalized counts invalid") + sys.exit(1) + + # Validate Snakefile determined size factors + if size_factors_dict == known_truth_size_factors: + print("Size factors validated") + else: + print("Size factors invalid") + sys.exit(1) if args.url_check: print_header("url check") diff --git a/test/test_configs/normalized_counts.tsv b/test/test_configs/normalized_counts.tsv new file mode 100644 index 00000000..2a2e9825 --- /dev/null +++ b/test/test_configs/normalized_counts.tsv @@ -0,0 +1,168 @@ +Geneid sample1 sample2 sample3 sample4 +FBgn0031208 10.024 59.774 6.016 0.886 +FBgn0002121 1674.027 1607.677 2364.312 2397.586 +FBgn0031209 18.934 46.076 29.221 36.34 +FBgn0263584 25.617 41.095 36.956 30.136 +FBgn0051973 115.834 59.774 491.598 585.88 +FBgn0267987 0.0 2.491 7.735 15.954 +FBgn0266878 1.114 1.245 2.578 3.545 +FBgn0266879 0.0 0.0 1.719 2.659 +FBgn0067779 257.286 322.532 307.679 327.951 +FBgn0266322 239.465 216.681 209.703 263.247 +FBgn0031213 712.826 834.348 643.719 705.537 +FBgn0031214 8.91 18.679 9.454 17.727 +FBgn0002931 54.576 58.529 45.55 48.749 +FBgn0031216 525.709 369.853 538.008 582.334 +FBgn0031217 485.613 232.87 337.759 323.519 +FBgn0026787 439.947 275.21 303.381 329.724 +FBgn0005278 4858.354 3776.982 4597.99 6952.557 +FBgn0031228 1234.08 1122.012 1216.963 1109.715 +FBgn0031219 153.703 49.812 47.269 40.772 +FBgn0031220 49.007 683.667 275.879 302.247 +FBgn0025683 3402.63 2164.324 2626.44 3332.689 +FBgn0266304 1160.57 886.651 1062.265 1201.009 +FBgn0001142 1558.193 8656.052 3935.363 4019.613 +FBgn0265074 1.114 9.962 4.297 0.886 +FBgn0265075 0.0 11.208 3.438 1.773 +FBgn0051976 0.0 0.0 0.0 0.0 +FBgn0051975 0.0 0.0 0.0 0.0 +FBgn0051974 572.488 224.153 1553.003 2266.406 +FBgn0031224 208.279 277.701 201.968 178.157 +FBgn0259818 32.3 28.642 71.333 62.045 +FBgn0031227 74.624 72.227 68.755 64.704 +FBgn0031229 339.706 336.23 290.49 297.815 +FBgn0053635 59.031 97.133 58.442 35.454 +FBgn0016977 902.17 658.762 1515.188 2078.499 +FBgn0031231 357.527 246.569 283.614 296.928 +FBgn0031232 15.593 3.736 34.377 23.045 +FBgn0031233 235.01 302.607 217.438 221.588 +FBgn0266557 1586.038 745.932 1546.128 1929.592 +FBgn0265151 0.0 0.0 0.0 0.0 +FBgn0265153 8.91 2.491 2.578 2.659 +FBgn0265152 17.821 7.472 23.205 24.818 +FBgn0263465 0.0 0.0 0.0 0.0 +FBgn0031235 25.617 41.095 15.47 16.841 +FBgn0265149 1.114 1.245 13.751 6.204 +FBgn0283652 77.965 99.624 55.004 56.727 +FBgn0031238 150.362 127.02 131.494 136.498 +FBgn0031239 20.048 24.906 36.096 39.0 +FBgn0265150 3.341 4.981 6.016 0.886 +FBgn0031240 38.983 189.285 35.237 40.772 +FBgn0086912 119.176 74.718 239.783 240.202 +FBgn0086856 165.955 107.095 214.859 215.384 +FBgn0086855 219.417 198.002 191.655 155.998 +FBgn0003444 219.417 215.436 179.622 180.816 +FBgn0031244 161.5 166.87 230.329 239.315 +FBgn0031245 2421.38 1798.207 865.453 877.49 +FBgn0267995 1119.359 844.311 301.662 312.883 +FBgn0267996 613.699 402.231 262.128 280.088 +FBgn0025686 268.423 104.605 97.976 70.022 +FBgn0031247 151.475 193.021 194.233 237.543 +FBgn0017457 249.489 278.946 268.144 238.429 +FBgn0024352 1588.265 1140.691 1702.545 1602.527 +FBgn0020622 726.191 513.062 684.112 585.88 +FBgn0004611 232.782 199.247 288.771 301.36 +FBgn0263872 0.0 0.0 0.0 0.0 +FBgn0031248 4338.214 27608.21 453.783 519.403 +FBgn0031249 47301.564 19165.104 7655.868 8634.856 +FBgn0053127 2242.06 620.157 1868.417 2590.811 +FBgn0264086 34.528 198.002 44.691 54.954 +FBgn0051921 25.617 112.077 26.643 19.5 +FBgn0031250 366.437 1224.126 242.361 291.61 +FBgn0266907 227.213 662.497 133.213 141.817 +FBgn0266906 122.517 351.173 95.398 109.908 +FBgn0000061 112.493 51.057 132.353 194.111 +FBgn0263871 1.114 0.0 0.859 0.886 +FBgn0031251 110.265 104.605 261.269 141.817 +FBgn0003278 158.158 54.793 208.843 243.747 +FBgn0264855 1130.497 734.725 729.662 691.356 +FBgn0263933 398.737 331.249 341.197 397.973 +FBgn0031252 55.69 72.227 25.783 30.136 +FBgn0002593 14674.188 17816.448 15984.675 16505.675 +FBgn0031253 95.786 178.077 73.912 56.727 +FBgn0031254 6.683 8.717 0.0 1.773 +FBgn0031255 4.455 2.491 0.859 1.773 +FBgn0004583 356.413 333.739 256.112 271.224 +FBgn0263870 0.0 0.0 0.0 0.886 +FBgn0015924 1610.541 1839.302 811.309 723.264 +FBgn0031256 1039.166 313.815 428.859 341.246 +FBgn0262510 0.0 0.0 0.0 0.0 +FBgn0031257 17.821 34.868 17.189 12.409 +FBgn0031258 198.255 148.19 135.791 147.135 +FBgn0027592 200.482 232.87 235.486 218.929 +FBgn0003963 211.62 70.982 169.309 228.679 +FBgn0043364 808.612 605.214 1123.285 1176.191 +FBgn0267991 0.0 0.0 0.0 1.773 +FBgn0267992 0.0 2.491 0.0 0.0 +FBgn0010602 829.774 688.649 648.016 641.72 +FBgn0031260 2864.669 779.555 1020.152 951.944 +FBgn0005660 164.841 144.454 254.393 242.861 +FBgn0031261 128.086 127.02 132.353 132.067 +FBgn0260933 1255.242 3057.201 1385.413 1231.145 +FBgn0031263 1335.435 2901.539 1439.557 1224.054 +FBgn0031264 399.851 38.604 580.12 280.974 +FBgn0031265 307.406 220.417 423.703 396.2 +FBgn0021874 151.475 108.341 146.964 145.362 +FBgn0031266 393.168 225.399 432.297 424.563 +FBgn0031267 134.769 234.116 133.213 140.044 +FBgn0031268 188.231 346.192 180.482 128.521 +FBgn0013323 2.228 14.944 1.719 0.0 +FBgn0023489 0.0 0.0 2.578 0.886 +FBgn0010323 0.0 2.491 3.438 7.977 +FBgn0267827 0.0 1.245 0.859 0.0 +FBgn0031270 38.983 95.888 28.361 27.477 +FBgn0263657 0.0 2.491 0.0 0.0 +FBgn0263658 0.0 0.0 0.859 0.0 +FBgn0040106 1.114 0.0 0.0 0.0 +FBgn0266032 0.0 0.0 0.0 0.0 +FBgn0266033 0.0 0.0 0.0 0.0 +FBgn0040107 0.0 0.0 0.0 0.0 +FBgn0031273 0.0 1.245 1.719 0.0 +FBgn0266909 0.0 0.0 0.0 0.0 +FBgn0000497 226.099 200.493 39.534 54.068 +FBgn0266323 1.114 1.245 0.0 0.0 +FBgn0267993 0.0 0.0 0.0 0.886 +FBgn0011244 22.276 201.738 8.594 9.75 +FBgn0026438 24.503 43.585 54.145 35.454 +FBgn0031275 16.707 9.962 22.345 31.909 +FBgn0265825 0.0 1.245 0.0 0.0 +FBgn0031276 5.569 7.472 34.377 46.09 +FBgn0040725 1.114 7.472 6.016 10.636 +FBgn0031277 77.965 260.267 221.735 171.953 +FBgn0041250 0.0 0.0 0.859 0.0 +FBgn0031279 161.5 73.472 115.165 141.817 +FBgn0000442 192.686 56.038 103.992 139.158 +FBgn0266797 0.0 0.0 0.0 0.0 +FBgn0051658 12.252 16.189 18.048 23.932 +FBgn0086130 141.451 115.813 176.185 163.975 +FBgn0031281 74.624 113.322 67.896 63.817 +FBgn0031282 122.517 133.247 79.928 93.953 +FBgn0031283 6.683 19.925 5.157 4.432 +FBgn0031284 108.038 97.133 76.49 58.499 +FBgn0015621 77.965 112.077 69.614 85.976 +FBgn0031285 1802.113 3490.564 1522.063 1630.89 +FBgn0031286 70.169 63.51 105.711 113.453 +FBgn0010583 271.765 255.286 286.193 321.746 +FBgn0020304 356.413 637.591 763.18 758.719 +FBgn0264869 28.959 42.34 79.928 50.522 +FBgn0031287 67.941 125.775 61.879 49.636 +FBgn0020545 556.895 627.629 693.566 937.762 +FBgn0031288 11.138 17.434 0.859 1.773 +FBgn0266884 14.479 2.491 8.594 9.75 +FBgn0031289 38.983 12.453 9.454 15.068 +FBgn0029095 200.482 191.776 201.108 186.134 +FBgn0086031 1.114 1.245 0.859 3.545 +FBgn0020305 183.775 112.077 171.028 174.612 +FBgn0053526 879.894 556.647 1265.092 1235.577 +FBgn0031292 18.934 47.321 8.594 8.864 +FBgn0002936 2.228 0.0 2.578 1.773 +FBgn0266887 67.941 51.057 0.859 0.0 +FBgn0002563 427730.039 173863.232 16213.285 22352.063 +FBgn0003916 3.341 12.453 107.43 129.408 +FBgn0266799 0.0 0.0 0.0 0.0 +FBgn0264870 1.114 0.0 0.0 0.0 +FBgn0046113 131.427 56.038 212.281 122.317 +FBgn0028481 18.934 52.302 38.675 29.25 +FBgn0266036 0.0 0.0 0.0 0.0 +FBgn0267428 2.228 6.226 10.313 5.318 +FBgn0069969 21.162 53.548 36.096 31.909 diff --git a/test/test_configs/test_featurecounts.txt b/test/test_configs/test_featurecounts.txt new file mode 100644 index 00000000..bac6c5d5 --- /dev/null +++ b/test/test_configs/test_featurecounts.txt @@ -0,0 +1,169 @@ +# Program:featureCounts v2.0.3; Command:"featureCounts" "-s2" "-T" "8" "-a" "references_data/dmel/test/annotation/dmel_test.gtf" "-o" "data/rnaseq_aggregation/featurecounts.txt" "data/rnaseq_samples/sample3/sample3.cutadapt.markdups.bam" "data/rnaseq_samples/sample1/sample1.cutadapt.markdups.bam" "data/rnaseq_samples/sample2/sample2.cutadapt.markdups.bam" "data/rnaseq_samples/sample4/sample4.cutadapt.markdups.bam" +Geneid Chr Start End Strand Length data/rnaseq_samples/sample3/sample3.cutadapt.markdups.bam data/rnaseq_samples/sample1/sample1.cutadapt.markdups.bam data/rnaseq_samples/sample2/sample2.cutadapt.markdups.bam data/rnaseq_samples/sample4/sample4.cutadapt.markdups.bam +FBgn0031208 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 7529;7529;7529;8193;8193;8229;8668 8116;8116;8116;9484;8589;9484;9484 +;+;+;+;+;+;+ 1880 7 9 48 1 +FBgn0002121 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 9839;9839;9839;9839;9839;9839;9839;9839;9839;9839;9839;11410;11410;11410;11410;11410;11410;11410;11410;11410;11410;11779;11779;11779;11779;11779;11779;11779;11779;11779;11779;11779;12286;12286;12286;12286;12286;12286;12286;12286;12286;12286;12286;13520;13520;13520;13520;13520;13520;13520;13520;13520;13520;13520;13683;13683;13683;13683;13683;13683;13683;13683;13683;13683;13683;14933;14933;14933;14933;14933;14933;14933;14933;14933;14933;14933;17053;17053;17053;17053;17053;17053;17053;18026;18261;18261;19880;19880;19880;19880;19880;19880;19880;19885;20831;21066;21066;21066;21066;21066;21066;21136;21136;21136;21349 11344;11344;11344;11344;11344;11344;11344;11344;11344;11344;11344;11518;11518;11518;11518;11518;11518;11518;11518;11518;11518;12221;12221;12221;12221;12221;12221;12221;12221;12221;12221;12221;12928;12928;12928;12928;12928;12928;12928;12928;12928;12928;12928;13625;13625;13625;13625;13625;13625;13625;13625;13625;13625;13625;14874;14874;14874;14874;14874;14874;14874;14874;14874;14874;14874;15711;15711;15711;15711;15711;15711;15711;15711;15711;15711;15711;17212;17212;17212;17212;17212;17212;17212;18168;18570;18570;20020;20015;20015;20020;20020;20015;20020;20020;20973;21376;21376;21376;21376;21200;21376;21376;21376;21376;21376 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 5986 2751 1503 1291 2705 +FBgn0031209 chr2L;chr2L;chr2L;chr2L;chr2L 21823;22743;22994;23929;24747 22687;22935;23873;24210;25155 -;-;-;-;- 2629 34 17 37 41 +FBgn0263584 chr2L;chr2L 21952;22998 22941;24237 +;+ 2230 43 23 33 34 +FBgn0051973 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 25402;25402;25402;25402;25402;25402;25402;25402;26766;26766;26766;26766;26766;26766;26766;26766;27053;27053;27053;27053;27053;27053;27053;27053;28015;28015;28015;28015;28015;28015;28015;28411;28733;28733;28733;28733;28733;28733;28733;28733;28982;28982;28982;28982;28982;28982;28982;28982;30394;30394;33845;33845;33845;33845;33845;34558;34558;34558;34558;34558;34558;34558;34720;34720;34720;34720;34720;34720;34720;35746;35746;35746;38535;38535;38535;38535;38535;38535;38535;38535;39301;39301;39301;39301;39301;39301;39301;39301;58081;58081;58081;58081;58081;58081;58081;58081;58249;58249;58959;59190;59190;59190;59190;59190;59190;65346 26688;26688;26688;26688;26688;26688;26688;26688;26964;26964;26964;26964;26964;26964;26964;26964;27490;27490;27490;27490;27490;27490;27490;27490;28240;28240;28240;28240;28240;28240;28240;28639;28926;28926;28926;28926;28926;28926;28926;28926;29068;29068;29068;29068;29068;29068;29068;29068;33270;33270;34288;34288;34288;34288;34288;34604;34604;34604;34604;34604;34604;34604;35212;35212;35212;35212;35212;34912;35212;38298;38298;38298;38731;38731;38731;38731;38731;38731;38731;38731;39857;39857;39857;39857;39857;39857;39857;39857;58182;58193;58182;58182;58182;58182;58176;58182;58350;58731;59268;59268;59268;59268;59268;59268;59268;65404 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 10793 572 104 48 661 +FBgn0267987 chr2L 54817 55767 + 951 9 0 2 18 +FBgn0266878 chr2L 65999 66242 + 244 3 1 1 4 +FBgn0266879 chr2L 66318 66524 + 207 2 0 0 3 +FBgn0067779 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 66482;66676;67043;67043;67043;67043;67389;67389;67389;67569;67569;67569;67569;67569;67892;67892;67892;67892;67892;68085;68085;68085;68085;68085;70607;70607;70607;70607;70607 66612;67003;67137;67507;67111;67507;67507;67507;67507;67762;67762;67762;67762;67762;68023;68023;68023;68023;68023;70549;70549;70549;70549;70549;71390;71390;71081;71390;71081 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 4499 358 231 259 370 +FBgn0266322 chr2L;chr2L;chr2L 71039;71039;73755 73642;73836;73836 -;-;- 2798 244 215 174 297 +FBgn0031213 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 71757;71950;72387;73485;73485;73820;74129;74903;74903;74903;74903;74903;75078;75078;75078;75078;75078 71804;72081;72977;73692;73692;73897;74572;75018;75018;75018;75018;75018;76211;76211;76211;76211;76211 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 2751 749 640 670 796 +FBgn0031214 chr2L;chr2L 76348;77642 77583;77783 +;+ 1378 11 8 15 20 +FBgn0002931 chr2L;chr2L;chr2L;chr2L 82421;82984;87020;87020 84277;84277;87387;87387 -;-;-;- 2225 53 49 47 55 +FBgn0031216 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 94739;94989;95132;95354;97884;98527;99785;100572;100762;101016;101249;101876 94892;95070;95301;97833;98470;99723;100516;100703;100942;101194;101619;102086 +;+;+;+;+;+;+;+;+;+;+;+ 6476 626 472 297 657 +FBgn0031217 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 102380;102380;103006;103006;103516;103878 102906;102906;103434;103434;104142;104142 +;+;+;+;+;+ 1583 393 436 187 365 +FBgn0026787 chr2L;chr2L;chr2L;chr2L;chr2L 103962;105005;105391;105512;105969 104947;105336;105455;105915;106732 -;-;-;-;- 2551 353 395 221 372 +FBgn0005278 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 106903;107761;107761;107761;107761;107765;107937;107937;107937;108089;108133;108133;108588;108588;108588;108588;108588;108588;108588;108588;108588;108588;108588;109594;110406;110406;110406;110406;110406;110406;110406;110406;110406;110406;110406;110406;110755;110755;110755;110755;110755;110755;110755;110755;110755;110755;110755;110755;111005;111005;111005;111005;111907;111907;111907;111907;111907;111907;111907;112690;112690;112690;112690;112690;112690;112690;112690;112690;112690;112690;113434;113434;113434;113434;113434;113434;113434;113434;113434;113434;113434 107000;107956;107838;107838;107838;107838;108226;108101;108101;108226;108346;108226;108809;108809;108809;108809;108809;108809;108809;108809;108809;108809;108809;109793;110483;110483;110483;110483;110483;110483;110483;110483;110483;110483;110483;110483;110877;110877;110877;110877;110877;111337;110877;110877;110877;110877;110877;110877;111117;111117;111117;111117;112019;112019;112019;112019;112019;112019;112019;113369;113369;113369;113369;113369;113369;113369;113369;113369;113369;113369;114432;114432;114432;114432;114210;114432;114432;114210;114432;114210;114432 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 3559 5350 4362 3033 7844 +FBgn0031228 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 114726;114726;114726;155089;155089;155250;155335;155335;155335;155335;155335;155466;155546;155546;155567;155567;155638;155638;155858;155858;155858;155858;155858;155858;155858;155858;155858;155858 114991;114991;114991;155784;155178;155784;155410;155784;155429;155429;155429;155784;155784;155784;155784;155784;155784;155784;156030;156030;156030;156030;156030;156030;156030;156030;156030;156030 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 1135 1416 1108 901 1252 +FBgn0031219 chr2L;chr2L 115365;115365 116488;116182 -;- 1124 55 138 40 46 +FBgn0031220 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 116970;117079;117079;117079;117079;117079;117079;117079;117174;117820;117820;117820;117820;117820;117820;117820;117820;117820;118136;118136;118136;118136;118136;118136;118136;118136;118136;118361;118361;118361;118361;118361;118361;118361;118361;118361;118931;118931;118931;118931;118931;118931;118931;118931;118931;119134;119134;119134;119134;119134;119134;119134;119134;119134;119288;119288;119288;119288;119288;119288;119288;119431;119431;119431;119431;119431;119431;119431;119431;119828;119828;119828;119828;119828;119828;119828;119828;119828;120168;120421;120421;120421;120421;120421;120511;121633 117759;117759;117759;117759;117759;117759;117759;117759;117759;118076;118076;118076;118076;118076;118076;118076;118076;118076;118304;118304;118304;118304;118304;118304;118304;118304;118304;118874;118874;118874;118874;118874;118874;118874;118874;118874;119076;119076;119076;119076;119076;119076;119076;119076;119076;119375;119235;119235;119235;119235;119235;119235;119235;119235;119375;119375;119375;119375;119375;119375;119554;119554;119554;119554;119554;119554;119554;119554;119554;120265;120080;120080;120080;121754;120631;120080;120080;120080;120364;120631;120631;120631;120631;120742;120631;121754 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 4224 321 44 549 341 +FBgn0025683 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 122624;122624;122624;122624;123081;123081;123694;123694;123694;123694;123856;123856;123856;123856;124087;124087;124087;124087;125077;125077;125077;125077;126110;126110;126110;126110;128800;128800;128800;128800;130508;130508 122994;123629;122994;123629;123629;123629;123794;123794;123794;123794;124024;124024;124024;124024;124920;124920;124920;124920;125266;125266;125266;125266;126227;126227;126227;126227;128942;129245;128942;129245;130791;130791 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 3148 3056 3055 1738 3760 +FBgn0266304 chr2L;chr2L;chr2L 122837;123140;123325 123072;123258;124031 +;+;+ 1062 1236 1042 712 1355 +FBgn0001142 chr2L;chr2L;chr2L;chr2L;chr2L 132077;132077;132077;132476;132476 132255;134472;132255;133995;134472 +;+;+;+;+ 2396 4579 1399 6951 4535 +FBgn0265074 chr2L 135402 136128 + 727 5 1 8 1 +FBgn0265075 chr2L;chr2L 136144;136273 136216;136701 +;+ 502 4 0 9 2 +FBgn0051976 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 138384;138384;138669;138669;139256;139256;139442;139442;139741;140114 138590;138590;139198;139198;139385;139385;139687;139588;139954;140992 -;-;-;-;-;-;-;-;-;- 2206 0 0 0 0 +FBgn0051975 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 138384;138669;139256;139442;139446;139741;139741;140114;140114 138590;139198;139385;139687;139687;139954;139954;140992;140992 -;-;-;-;-;-;-;-;- 2206 0 0 0 0 +FBgn0051974 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 141077;141077;141077;141396;141396;141396;141662;141671;141671;142724 141340;141340;141340;141609;141609;141609;143091;142572;142662;143091 -;-;-;-;-;-;-;-;-;- 1908 1807 514 180 2557 +FBgn0031224 chr2L 143323 144227 + 905 235 187 223 201 +FBgn0259818 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 144231;144231;147349;147355;147511;147511;147765;147765;147995;147995;148092;148092;148338;148338;148879;148879;151115;151115 145910;145910;147454;147454;147710;147710;147936;147936;148037;148037;148173;148173;148825;148825;149226;149226;153300;153300 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 5305 83 29 23 70 +FBgn0031227 chr2L;chr2L 153539;155128 155059;155305 -;- 1699 80 67 58 73 +FBgn0031229 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 156029;156149;156423;156423;156736;156736 156348;156348;156552;156552;157666;157666 +;+;+;+;+;+ 1381 338 305 270 336 +FBgn0053635 chr2L;chr2L 157836;158436 158375;158664 -;- 769 68 53 78 40 +FBgn0016977 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 159032;159032;159032;159032;159032;160009;162592;162592;162592;162592;164159;175361;175361;175361;182820;182820;182820;183761;183761;183761;183761;183761;183761;183761;183761;185152;185152;185152;185152;185152;185152;185152;185152;186193;186193;186193;186193;186193;186193;186193;186193;186910;186910;187482;187482;187482;187482;187482;187482;187482;187482;199637;199637;199637;199637;199637;199637;199637;199637;199903;199903;199903;199903;199903;200120;200120;200120;200120;200120;200120;200120;200120;200376;200376;200376;200376;200376;200376;200376;200376;200742;200742;200742;200742;200742;200742;200742;200742;201127;201127;201127;201127;201127;201127;201127;201127 159819;159823;159819;159819;159819;163001;163001;163001;163001;163001;164234;175447;175447;175447;183419;182913;183419;185082;185082;185082;185082;185082;185082;185082;185082;186123;186123;186123;186123;186123;186123;186123;186123;187016;186855;187016;187016;187016;186855;187016;187016;187016;187016;199575;199575;199575;199575;199575;199575;199575;199575;199743;199743;199743;199743;199743;199743;199743;199743;199983;199983;199983;199983;199983;200315;200315;200315;200315;200315;200315;200315;200315;200675;200675;200675;200675;200675;200675;200675;200675;201061;201061;201061;201061;201061;201061;201061;201061;201588;203250;203397;203250;201588;203250;201588;201588 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 23035 1763 810 529 2345 +FBgn0031231 chr2L;chr2L 203779;203993 203891;204782 +;+ 903 330 321 198 335 +FBgn0031232 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 204743;204743;205272;205272;206001;206001;206700;207231 205212;205212;205943;205943;206050;206050;206797;207297 -;-;-;-;-;-;-;- 1357 40 14 3 26 +FBgn0031233 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 207179;207406;207406;207711;207711;207711;208729;208729;208729 207631;207631;207631;208608;208608;208608;210506;210725;210506 +;+;+;+;+;+;+;+;+ 3348 253 211 243 250 +FBgn0266557 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 210735;210735;210735;210735;210735;210735;215034;215034;215034;215034;215034;215034;215773;215773;215773;215773;215773;215773;216077;216077;216077;216077;216077;216077;216345;216345;216345;216345;216345;216345;216632;216632;216632;216632;216632;216632;221506;226116;226116;226116;226116;227372;227372;227372;227372;227372;228133;228133;228133;228133;229173;229173;229173;229173;229930;230538;230538;230538;230538;230538;230758;230758;230758;230758;230758;231948;231963;231963;231963;231963;232292;232292;232292;232292;232292;233997;233997;233997;233997;233997;234237;234237;234237;234237;234237;242244;242244;242244;242244;242244;250757;250757;250757;250757;250757 214942;214942;214942;214942;214942;214942;215676;215676;215676;215676;215676;215676;216007;216007;216007;216007;216007;216007;216275;216275;216275;216275;216275;216275;216573;216573;216573;216573;216573;216573;218885;218885;218885;218885;218885;218885;221962;226508;226508;226508;226508;227547;227547;227547;227547;228281;228281;228281;228281;228281;229382;229382;229382;229382;229977;230627;230627;230627;230627;230627;231034;231034;231034;231034;231034;232101;232101;232101;232101;232101;232379;232379;232379;232379;232379;234174;234174;234174;234174;234174;242143;242143;242143;242143;242143;242744;242744;242744;242925;242744;250823;250823;250823;250823;250823 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 19229 1799 1424 599 2177 +FBgn0265151 chr2L 219651 220050 + 400 0 0 0 0 +FBgn0265153 chr2L 223519 224708 + 1190 3 8 2 3 +FBgn0265152 chr2L 228037 228588 + 552 27 16 6 28 +FBgn0263465 chr2L 232166 232253 - 88 0 0 0 0 +FBgn0031235 chr2L;chr2L 232487;233217 233154;234208 +;+ 1660 18 23 33 19 +FBgn0265149 chr2L 248909 249812 + 904 16 1 1 7 +FBgn0283652 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 251039;251163;251527;251527;251856;251856;251979;251979;252227;252227 251464;251464;251801;251801;251924;251924;252166;252166;252373;252373 -;-;-;-;-;-;-;-;-;- 1105 64 70 80 64 +FBgn0031238 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 252589;252589;252589;253220;253220;253220;253446;253446;253446;253956;253956;253956;254562;271629;271629 253145;253145;253145;253385;253385;253385;253890;253890;253890;254397;254424;254397;254750;271744;271744 -;-;-;-;-;-;-;-;-;-;-;-;-;-;- 1942 153 135 102 154 +FBgn0031239 chr2L;chr2L 259949;263466 267505;267505 -;- 7557 42 18 20 44 +FBgn0265150 chr2L;chr2L 262203;262645 262597;263003 +;+ 754 7 3 4 1 +FBgn0031240 chr2L;chr2L;chr2L 269088;269458;270661 269389;270606;271626 +;+;+ 2417 41 35 152 46 +FBgn0086912 chr2L;chr2L 271912;272555 272506;273715 -;- 1756 279 107 60 271 +FBgn0086856 chr2L;chr2L 273836;273937 274694;274766 +;+ 931 250 149 86 243 +FBgn0086855 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 274740;274740;274740;274740;275319;275319;275319;275319;276739;276739;276739;276739;276959;276959;276959;276974 275251;275251;275251;275251;276497;276497;276497;276497;276903;276903;276897;276903;277212;278234;277212;277212 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 3132 223 197 159 176 +FBgn0003444 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 277582;277930;278643;279185;279870;280110 277863;278323;279124;279805;280040;282167 +;+;+;+;+;+ 4008 209 197 173 204 +FBgn0031244 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 281670;281971;281971;282654;282654;282654 282505;282505;282505;283195;283269;283195 -;-;-;-;-;- 1452 268 145 134 270 +FBgn0031245 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 283385;283385;283385;283662;284748;284748;284748;284748;285433;286307;290813;290813;291607;291661 284210;284210;284210;284210;284968;284968;284968;284968;285726;286531;291031;291031;291795;291795 -;-;-;-;-;-;-;-;-;-;-;-;-;- 1974 1007 2174 1444 990 +FBgn0267995 chr2L 283807 284255 + 449 351 1005 678 353 +FBgn0267996 chr2L;chr2L 286383;286753 286662;288292 +;+ 1820 305 551 323 316 +FBgn0025686 chr2L;chr2L 287252;287252 289144;288932 -;- 1893 114 241 84 79 +FBgn0031247 chr2L;chr2L 292419;292717 292660;293222 +;+ 748 226 136 155 268 +FBgn0017457 chr2L;chr2L;chr2L;chr2L 292959;293353;294441;294441 294372;294372;294681;294681 -;-;-;- 1655 312 224 224 269 +FBgn0024352 chr2L;chr2L;chr2L;chr2L 295122;295346;295704;296977 295280;295628;296811;297449 +;+;+;+ 2023 1981 1426 916 1808 +FBgn0020622 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 297880;297880;299033;299033;301706;301706;302026;302026;302026 298403;298403;299918;299918;301944;305233;303934;305233;305233 +;+;+;+;+;+;+;+;+ 4938 796 652 412 661 +FBgn0004611 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 305935;305935;305935;310200;310200;310200;317743;317743;317743;317743;317743;317743;325678;325678;325678;325678;325678;325678;334120;334120;334120;334120;334120;334120;335415;335415;335415;335415;335415;335415;336018;336018;336018;336018;336018;336018;336349;336349;336349;336349;336349;336349;337016;337016;337016;337016;337016;337938;337938;337938;337938;337938;337938;339207;339207;339207;339207;339207;339207;340710;340710;340710;340710;340710;340710;342579;342579;342579;342579;342579;342579;342866;342866;342866;342866;342866;342866;344024;344024;344024;344039;344042;344042;344555;344555;344555;344576;344576;344576;345009;345009;345009;345009;345009;345009;345215;345215;345215;345215;345215;345215;355384 306389;306389;306389;310605;310605;310605;318120;318120;318120;318120;318120;318120;325824;325824;325824;325824;325824;325824;334257;334257;334257;334257;334257;334257;335548;335548;335548;335548;335548;335548;336203;336203;336203;336203;336203;336203;336546;336546;336546;336546;336546;336546;337198;337198;337198;337198;337198;338118;338118;338118;338118;338118;338118;339441;339441;339441;339441;339441;339441;340855;340855;340855;340855;340855;340855;342792;342792;342792;342792;342792;342792;343729;343729;343729;343729;343729;343729;344489;344489;344489;344489;344489;344489;344947;344947;344947;344947;344947;344947;345153;345153;345153;345153;345153;345153;347927;346255;346255;347936;346541;346255;355566 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 7774 336 209 160 340 +FBgn0263872 chr2L;chr2L;chr2L 308537;308537;308997 308842;309348;309348 -;-;- 812 0 0 0 0 +FBgn0031248 chr2L 318362 319259 - 898 528 3895 22170 586 +FBgn0031249 chr2L 320279 321248 - 970 8908 42469 15390 9742 +FBgn0053127 chr2L 322101 323091 + 991 2174 2013 498 2923 +FBgn0264086 chr2L;chr2L;chr2L 325522;327429;328593 326061;329761;329761 -;-;- 2873 52 31 159 62 +FBgn0051921 chr2L 329910 332335 - 2426 31 23 90 22 +FBgn0031250 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 355565;355565;355565;356367;356367;356367;356891;356891;356891;357423;357423;357423;357816;357816 356312;356312;356312;356837;356837;356837;357191;357191;357191;357874;357766;357748;357874;357874 -;-;-;-;-;-;-;-;-;-;-;-;-;- 1972 282 329 983 329 +FBgn0266907 chr2L 355663 356891 + 1229 155 204 532 160 +FBgn0266906 chr2L 357329 358174 + 846 111 110 282 124 +FBgn0000061 chr2L;chr2L;chr2L;chr2L;chr2L 378112;384511;385701;386308;386703 378481;384894;385746;386576;387439 +;+;+;+;+ 1806 154 101 41 219 +FBgn0263871 chr2L 396120 396571 + 452 1 1 0 1 +FBgn0031251 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 396595;396595;399848;399848;400523;400523;400725;400725;401007;401007 398866;398866;400456;400456;400667;400667;400942;400942;402198;402054 -;-;-;-;-;-;-;-;-;- 4436 304 99 84 160 +FBgn0003278 chr2L;chr2L;chr2L 404285;404536;406095 404473;406035;407969 +;+;+ 3564 243 142 44 275 +FBgn0264855 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 408030;408876;409532;409532;409790;409790;410127;410127;411129;411129;411782;411782;412447;412447;412725;413396;414443 409465;409465;409736;409736;410073;410073;411060;411060;411718;411718;412237;412237;412658;412658;412885;413654;414777 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 4872 849 1015 590 780 +FBgn0263933 chr2L;chr2L;chr2L 415067;415512;416789 415446;416710;418536 +;+;+ 3327 397 358 266 449 +FBgn0031252 chr2L 418434 419652 - 1219 30 50 58 34 +FBgn0002593 chr2L;chr2L;chr2L;chr2L 419952;419952;420292;420292 420146;420146;420864;420697 +;+;+;+ 768 18599 13175 14307 18622 +FBgn0031253 chr2L 420895 421450 - 556 86 86 143 64 +FBgn0031254 chr2L;chr2L 421771;422243 422188;422489 +;+ 665 0 6 7 2 +FBgn0031255 chr2L;chr2L;chr2L;chr2L 422873;423916;424824;425073 423845;424763;425012;425321 +;+;+;+ 2259 1 4 2 2 +FBgn0004583 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 431227;431227;438380;438380;438582;438582;443082;443082;443226;443226;446642;446642 431899;432117;438516;438516;438727;438727;443161;443161;446583;446583;448701;448701 +;+;+;+;+;+;+;+;+;+;+;+ 6672 298 320 268 306 +FBgn0263870 chr2L 439539 440104 + 566 0 0 0 1 +FBgn0015924 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 448254;448254;448716;448716;448716;449230;449230;449230;449230;449230;449435;449435;449435;449435;449435;450666;450666;450666;450666;450666;451230;452577;452577;452577;452577;452798;452987 449170;449170;449170;449170;449170;449320;449320;449320;449320;449320;450540;450540;450540;450540;450540;450878;450878;450878;450878;450878;451302;452736;452736;453024;452752;453024;453024 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 2848 944 1446 1477 816 +FBgn0031256 chr2L;chr2L 453108;454330 454270;454654 +;+ 1488 499 933 252 385 +FBgn0262510 chr2L;chr2L 454754;454989 454929;455313 +;+ 501 0 0 0 0 +FBgn0031257 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 455531;455531;455531;456086;456086;456086;456289;456289;456289;456539;456539;456539;456797;456797;456797;456973;457400;457400;457400;457615;457628;457628 455827;455827;455827;456223;456223;456223;456468;456468;456468;456729;456729;456729;456897;457338;457338;457338;457562;457562;457562;458745;458745;458745 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 2642 20 16 28 14 +FBgn0031258 chr2L;chr2L;chr2L;chr2L 458876;458876;471398;471398 464941;464941;472200;471555 -;-;-;- 6869 158 178 119 166 +FBgn0027592 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 473013;473223;474054;475036;475233;475916;476078 473165;473994;474765;475178;475851;476015;476170 +;+;+;+;+;+;+ 2592 274 180 187 247 +FBgn0003963 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 476220;476220;489517;490835;523466;523736;525392;525392;525392;525392;525392;536023;536023;536023;536023;536023;537037;537037;537037;537037;537037;537549;537549;537549;537549;537549;537863;537863;537863;537863;537863;539310;539310;539310;539310;539310;539518;539518;539518;539518;539518 476331;476331;491358;491358;524059;524059;525436;525436;525436;525436;525436;536966;536966;536966;536966;536966;537431;537431;537431;537431;537431;537749;537749;537749;537749;537749;539249;539249;539249;539249;539249;539452;539452;539452;539452;539452;540560;540532;540532;540560;540532 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 6706 197 190 57 258 +FBgn0043364 chr2L;chr2L;chr2L;chr2L;chr2L 476446;476446;476446;479087;479407 478204;479688;478204;479688;479688 -;-;-;-;- 3243 1307 726 486 1327 +FBgn0267991 chr2L;chr2L 490835;491879 492649;492649 +;+ 1815 0 0 0 2 +FBgn0267992 chr2L 500873 502236 - 1364 0 0 2 0 +FBgn0010602 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 540599;541237;541393;541393;541709;542430;542430;542430;542430 541168;542379;542346;542350;542350;542580;542580;542580;542580 -;-;-;-;-;-;-;-;- 1864 754 745 553 724 +FBgn0031260 chr2L;chr2L;chr2L 542786;543416;544333 543349;544266;544653 -;-;- 1736 1187 2572 626 1074 +FBgn0005660 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 544925;546533;547016;547016;547016;547978;547978;547978;547978;549026;551158;551158;551158 546479;547900;547900;547900;547900;548218;548218;548218;548218;549502;552454;552454;552923 -;-;-;-;-;-;-;-;-;-;-;-;- 5407 296 148 116 274 +FBgn0031261 chr2L;chr2L;chr2L;chr2L 545129;545371;545816;546565 545306;545564;546443;547096 +;+;+;+ 1532 154 115 102 149 +FBgn0260933 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 553742;553742;554336;554336;555510;555510;557722;557722;557943;557943;558616;559563 554274;554274;555446;555446;557665;557665;557882;557882;558541;558541;559079;560310 -;-;-;-;-;-;-;-;-;-;-;- 5772 1612 1127 2455 1389 +FBgn0031263 chr2L;chr2L 559612;560097 560037;560523 +;+ 853 1675 1199 2330 1381 +FBgn0031264 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 560568;560568;560568;560568;563254;563259;563277 563189;563189;563347;563189;563347;563819;563347 -;-;-;-;-;-;- 3252 675 359 31 317 +FBgn0031265 chr2L 564163 566472 + 2310 493 276 177 447 +FBgn0021874 chr2L;chr2L;chr2L;chr2L 566366;566498;566680;567089 566438;566624;567030;568121 -;-;-;- 1584 171 136 87 164 +FBgn0031266 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 568340;568340;568599;568599;569348;569348 568433;568433;569290;569290;572716;572907 +;+;+;+;+;+ 4346 503 353 181 479 +FBgn0031267 chr2L 573033 574264 - 1232 155 121 188 158 +FBgn0031268 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 574291;574508;574634;574780;574780;575144;575144 574355;574698;574698;575090;575090;575734;575734 +;+;+;+;+;+;+ 1158 210 169 278 145 +FBgn0013323 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 575711;575711;575711;576081;576081;576081;576514;576514 576022;576022;576022;576404;576550;576404;576550;576896 -;-;-;-;-;-;-;- 1128 2 2 12 0 +FBgn0023489 chr2L;chr2L;chr2L 577486;578155;578484 578033;578420;579549 +;+;+ 1880 3 0 0 1 +FBgn0010323 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 583540;583544;583544;587830;592272;592272;593588;593588 584445;584445;584445;588047;592633;592633;594685;594685 -;-;-;-;-;-;-;- 2584 4 0 2 9 +FBgn0267827 chr2L;chr2L;chr2L;chr2L 588048;588148;588647;588647 588579;588579;588784;588784 +;+;+;+ 670 1 0 1 0 +FBgn0031270 chr2L;chr2L;chr2L;chr2L 602813;602813;603074;603074 602949;603006;603562;604430 +;+;+;+ 1551 33 35 77 31 +FBgn0263657 chr2L 605914 606412 + 499 0 0 2 0 +FBgn0263658 chr2L 608340 609134 - 795 1 0 0 0 +FBgn0040106 chr2L 620298 621201 - 904 0 1 0 0 +FBgn0266032 chr2L 623107 623665 + 559 0 0 0 0 +FBgn0266033 chr2L 623900 624323 - 424 0 0 0 0 +FBgn0040107 chr2L 624617 625556 + 940 0 0 0 0 +FBgn0031273 chr2L 625652 628200 + 2549 2 0 1 0 +FBgn0266909 chr2L 628729 629052 + 324 0 0 0 0 +FBgn0000497 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 640013;640306;644437;644437;647989;647989;648479;648479;648991;648991;649934;649934;652786;652786;654247;654247;655274;655274;656712;656712;705871;705871;714275;714275 644314;644314;645716;645716;648361;648361;648886;648886;649765;649765;650293;650293;653288;653288;654700;654700;655866;655866;657384;657384;707867;707867;714983;714983 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 12427 46 203 161 61 +FBgn0266323 chr2L;chr2L 710568;714859 710667;715307 +;+ 549 0 1 1 0 +FBgn0267993 chr2L;chr2L 721985;724081 724015;724833 -;- 2784 0 0 0 1 +FBgn0011244 chr2L 728362 730564 + 2203 10 20 162 11 +FBgn0026438 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 737212;737212;737212;738321;738321;738321;738508;738508;738508;739445;739445;739445;740357;740357;740357;740800;740800;740800;743338;743338;744084;744196 738268;738268;738268;738435;738435;738435;738837;738837;738837;740014;740014;740014;740690;740690;740690;740964;740964;741791;743623;743623;744395;744395 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 3996 63 22 35 40 +FBgn0031275 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 749945;750609;750609;752731;752731;752731;752800;752800;752800;752800;754487;754487;754487;754487;754487;754487;754487;755021;755021;755021;755021;755021;755021;755021;755662;755829;755829;755829;755829;755829;755829;756334;756668;756668;756668;756668;756668;756668;757128;757128;757128;757128;757128;757128;757128;757800;757800;757800;757800;757800;757800;758847;758847;758847;758847;758847;758847;759231;759231;759231;759231;759231;759231;759679;759679;759679;759679;759679;759679 750400;750803;750803;753730;753730;753730;753730;753730;753730;753730;754630;754630;754630;754630;754630;754630;754630;755296;755296;755296;755296;755296;755296;755296;756080;756080;756080;756080;756080;756080;756080;757030;757030;757030;757030;757030;757030;757030;757429;757429;757429;757520;757429;757429;757429;757938;757938;757938;757938;757938;757938;759122;759122;759122;759122;759122;759122;759549;759549;759549;759549;759549;759549;762142;762142;762399;762142;762142;762142 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 7035 26 15 8 36 +FBgn0265825 chr2L 772514 773093 + 580 0 0 1 0 +FBgn0031276 chr2L 773547 774017 + 471 40 5 6 52 +FBgn0040725 chr2L 776536 776941 + 406 7 1 6 12 +FBgn0031277 chr2L 779173 779655 + 483 258 70 209 194 +FBgn0041250 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 780482;781276;782124;782124;782238;782238;782495;782495 782048;782048;782181;782181;782441;782441;782885;782885 +;+;+;+;+;+;+;+ 2220 1 0 0 0 +FBgn0031279 chr2L;chr2L;chr2L 784336;784336;786510 786427;786158;788776 +;+;+ 4359 134 145 59 160 +FBgn0000442 chr2L;chr2L;chr2L;chr2L;chr2L 786153;786479;786733;788242;790489 786422;786664;788178;788612;790798 -;-;-;-;- 2583 121 173 45 157 +FBgn0266797 chr2L 799856 800323 + 468 0 0 0 0 +FBgn0051658 chr2L;chr2L;chr2L;chr2L 810577;810809;811089;811259 810758;811021;811203;811531 +;+;+;+ 783 21 11 13 27 +FBgn0086130 chr2L;chr2L 811584;812562 812496;813380 +;+ 1732 205 127 93 185 +FBgn0031281 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 813314;813314;813951;813951;814243;814243;815275;815275;815475;815475 813893;813893;814184;814184;815221;815221;815421;815412;815950;815950 -;-;-;-;-;-;-;-;-;- 2416 79 67 91 72 +FBgn0031282 chr2L;chr2L 815993;815993 818096;817032 +;+ 2104 93 110 107 106 +FBgn0031283 chr2L;chr2L 816994;817244 817182;817950 -;- 896 6 6 16 5 +FBgn0031284 chr2L;chr2L 818079;818704 818643;819508 -;- 1370 89 97 78 66 +FBgn0015621 chr2L 819964 821209 + 1246 81 70 90 97 +FBgn0031285 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 821289;821422;821422;821422;822858;822858;822858;823637;823637;823637;823637;824191;824219 821659;823569;821659;821659;823569;823569;823569;824137;824337;824337;824137;824337;824337 +;+;+;+;+;+;+;+;+;+;+;+;+ 2982 1771 1618 2803 1840 +FBgn0031286 chr2L 824329 825861 - 1533 123 63 51 128 +FBgn0010583 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 825969;825969;825969;825969;829305;829305;829422;829457;830145;830145;830145;830145;830738;830738;830738;830738;831177;831177;831177;831177;831714;831714;831714;831714 826507;826507;826507;826507;829971;829971;829971;829971;830349;830349;830349;830349;831083;831083;831083;831083;831626;831626;831626;831626;833241;832331;833241;833241 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 3735 333 244 205 363 +FBgn0020304 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 833584;833584;833584;833587;834867;834974;834974;834974;834974;835353;835353;835353;835353;835353;835704;835704;836546;836546;836546;836546;836546;842614;842614;849899;849899;849899 834583;834583;834583;834583;835290;835290;835290;835290;835290;835547;835547;835547;835547;835547;836171;836171;837378;837378;837378;837378;837378;842943;842943;851071;851071;851071 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 4423 888 320 512 856 +FBgn0264869 chr2L 850702 851163 + 462 93 26 34 57 +FBgn0031287 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 851251;851316;851718;851718;852499;852499;852628;852628 851659;851659;852442;852442;852571;852571;852730;852730 -;-;-;-;-;-;-;- 1310 72 61 101 56 +FBgn0020545 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 852768;852848;853192;853192;853545;853545 853005;853005;853278;853278;854539;854539 +;+;+;+;+;+ 1320 807 500 504 1058 +FBgn0031288 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 855337;855471;855471;855687;855687;855687;855868;855868;855868 855623;855623;855623;855810;855810;855810;856236;856639;856236 +;+;+;+;+;+;+;+;+ 1183 1 10 14 2 +FBgn0266884 chr2L 857403 860079 + 2677 10 13 2 11 +FBgn0031289 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 860197;860309;860764;860764;861429;861429 860409;860409;861357;861357;861806;861806 +;+;+;+;+;+ 1185 11 35 10 17 +FBgn0029095 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 861849;861849;861849;862319;862319;862319;862563;862563;862563;864195;864195;864195;864398;864398;864398;864877;865827;867814;868032 862258;862258;862258;862498;862498;862498;864134;864134;864134;864338;864338;864338;864794;864794;864794;865060;865861;868013;868354 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 3445 234 180 154 210 +FBgn0086031 chr2L 865366 865493 - 128 1 1 1 4 +FBgn0020305 chr2L 868673 869857 - 1185 199 165 90 197 +FBgn0053526 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 870465;870465;870465;871095;871341;871341;871341;871641;871641;871641;871641;871806;871806;871806;871806;872208;872208;872208;872208;875038;875038 871576;870552;870552;871274;871576;871576;871576;871738;871738;871738;871738;872080;872080;872080;872080;874149;874149;873539;873539;877038;877038 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 5428 1472 790 447 1394 +FBgn0031292 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 877172;878181;878392;878392;878838;878838;879865;879865;880974;880974;881648;881648;882048;882048;882660;882660;883096;883096;883365;883365;884052;884052;884256;884256;884442;884442;884722;884722;884908;884908 878334;878334;878773;878773;879799;879799;880914;880914;881585;881585;881947;881947;882604;882604;883039;883039;883297;883297;883991;883991;884185;884185;884388;884388;884652;884652;884846;884846;885141;885141 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 7072 10 17 38 10 +FBgn0002936 chr2L;chr2L 877302;877970 877871;878270 +;+ 871 3 2 0 2 +FBgn0266887 chr2L 897453 898050 - 598 1 61 41 0 +FBgn0002563 chr2L;chr2L;chr2L;chr2L 898500;898644;899010;899010 898941;898941;901316;901316 +;+;+;+ 2749 18865 384031 139616 25218 +FBgn0003916 chr2L 901491 901654 - 164 125 3 10 146 +FBgn0266799 chr2L 904029 904347 + 319 0 0 0 0 +FBgn0264870 chr2L 912981 913305 - 325 0 1 0 0 +FBgn0046113 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 914086;914338;914553;914800;915058;915325;915508;915815;916282;916707;917467 914279;914493;914615;915003;915269;915447;915750;916231;916653;917387;917805 +;+;+;+;+;+;+;+;+;+;+ 3004 247 118 45 138 +FBgn0028481 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 922793;922793;930065;950492;950492;951587;951587;952256;952256;953396;953396;956249;956249;956404;956404;956860;956860;957052;957052;957279;957279 923219;923219;930423;950578;950578;952142;952142;953333;953333;953510;953510;956334;956334;956792;956792;956944;956944;957209;957209;958098;958098 +;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+;+ 4160 45 17 42 33 +FBgn0266036 chr2L;chr2L;chr2L;chr2L;chr2L;chr2L 987807;987807;989417;989772;990870;990870 989104;989357;990311;990311;991300;991300 -;-;-;-;-;- 2877 0 0 0 0 +FBgn0267428 chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R 326768;348382;432220;438894;495144;495604;547232;578872;579044;642100;673574;705374 326939;348500;432460;439012;495329;495799;547363;578991;579217;642363;673836;705848 +;+;+;+;+;+;+;+;+;+;+;+ 2461 12 2 5 6 +FBgn0069969 chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R;chr2R 924636;926097;926097;926097;926097;926735;926735;926735;926735;926735;926972;926972;926972;926972;926972;927186;927186;927186;927186;927186;927356;927356;927356;927356;927356;927781;929051;929051;929051;946776;949871;949871;949871;951127;951127;951127;951127 926682;926682;926682;926682;926682;926902;926902;926902;926902;926902;927127;927127;927127;927127;927127;927297;927297;927297;927297;927297;927570;927570;927570;927570;927570;927986;929292;929292;929292;946843;949946;949946;949946;951252;951252;951252;951252 -;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;-;- 3416 42 19 43 36 diff --git a/test/test_configs/test_sampletable.tsv b/test/test_configs/test_sampletable.tsv new file mode 100644 index 00000000..fad727e7 --- /dev/null +++ b/test/test_configs/test_sampletable.tsv @@ -0,0 +1,5 @@ +samplename group layout orig_filename +sample1 control SE data/example_data/rnaseq_sample1PE_1.fq.gz +sample2 control SE data/example_data/rnaseq_sample2.fq.gz +sample3 treatment SE data/example_data/rnaseq_sample3.fq.gz +sample4 treatment SE data/example_data/rnaseq_sample4.fq.gz diff --git a/workflows/rnaseq/Snakefile b/workflows/rnaseq/Snakefile index e979cfdc..7889aab3 100644 --- a/workflows/rnaseq/Snakefile +++ b/workflows/rnaseq/Snakefile @@ -1,12 +1,11 @@ import sys - sys.path.insert(0, srcdir('../..')) import os from textwrap import dedent import yaml import tempfile import pandas as pd -from lib import common, utils, helpers, aligners +from lib import common, utils, helpers, aligners, multiqc from lib.utils import autobump, gb, hours from lib.patterns_targets import RNASeqConfig @@ -33,7 +32,7 @@ SAMPLES = c.sampletable.iloc[:, 0].values wildcard_constraints: n = '[1,2]', sample = '|'.join(SAMPLES) - + def wrapper_for(path): return 'file:' + os.path.join('../..','wrappers', 'wrappers', path) @@ -44,21 +43,42 @@ def wrapper_for(path): # ---------------------------------------------------------------------------- # See "patterns and targets" in the documentation for what's going on here. -final_targets = utils.flatten(( - utils.flatten(c.targets['fastqc']), - [c.targets['fastq_screen']], - [c.targets['rrna_percentages_table']], - [c.targets['multiqc']], - utils.flatten(c.targets['featurecounts']), - utils.flatten(c.targets['markduplicates']), - utils.flatten(c.targets['salmon']), - utils.flatten(c.targets['kallisto']), - utils.flatten(c.targets['preseq']), - utils.flatten(c.targets['rseqc']), - utils.flatten(c.targets['collectrnaseqmetrics']), - utils.flatten(c.targets['bigwig']), - utils.flatten(c.targets['samtools']), -)) +targets_list = [ + c.targets['fastqc'], + c.targets['fastq_screen'], + c.targets['rrna_percentages_table'], + c.targets['multiqc'], + c.targets['featurecounts'], + c.targets['markduplicates'], + c.targets['salmon'], + c.targets['kallisto'], + c.targets['preseq'], + c.targets['rseqc'], + c.targets['collectrnaseqmetrics'], + c.targets['bigwig'], + c.targets['sizefactors'], + c.targets['counts'], + c.targets['normalized_counts'], + [c.targets['expression_mqc_yaml']] if config.get('expression_barchart_multiqc') else [] +] +final_targets = utils.flatten(targets_list) + +# Read region loci from config if any regions are specified +if config.get('expression_barchart_multiqc'): + REGIONS, REGION_DICTS, final_targets = multiqc.get_regions(config, c, final_targets) + wildcard_constraints: + region="|".join(REGIONS) + + def get_region_by_name(name): + for region in REGION_DICTS: + if region['name'] == name: + return region + raise ValueError(f'Region {name} not found in config') + +# This empty list will toggle OFF the MultiQC yaml data generation rules +else: + REGIONS = [] + if config.get('merged_bigwigs', None): final_targets.extend(utils.flatten(c.targets['merged_bigwig'])) @@ -139,6 +159,161 @@ if 'orig_filename' in c.sampletable.columns: rule symlink_targets: input: c.targets['fastq'] + +rule process_featurecounts: + """ + Use the featureCounts table to make a counts matrix with samplename columns and gene rows. + """ + input: + featurecounts=c.targets['featurecounts'], + sampletable=config['sampletable'] + output: + c.targets['counts'] + log: + 'logs/process_featurecounts.log' + threads: 1 + resources: + mem_mb=100, + runtime=1 + run: + multiqc.process_featurecounts(input.featurecounts[0], input.sampletable, output[0]) + + +rule sizefactors: + """ + Use the median ratio of counts to geometic means to estimate a size factor normalization coefficient + for each sample. + """ + input: + counts=c.targets['counts'] + output: + sizefactors=c.targets['sizefactors'] + log: + 'logs/sizefactors.log' + threads: 1 + resources: + mem_mb=100, + runtime=1 + run: + multiqc.estimate_sizefactors(input.counts[0], output.sizefactors[0]) + + +rule normalize_featurecounts: + """ + Use size factors and the counts matrix to make a size factor normalized counts matrix. + """ + input: + counts=c.targets['counts'], + sizefactors=c.targets['sizefactors'] + output: + c.targets['normalized_counts'] + log: + "logs/normalize_counts.log" + threads: 1 + resources: + mem_mb=100, + runtime=1 + run: + multiqc.normalize_featurecounts(input.counts[0], input.sizefactors[0], output[0]) + + +if REGIONS: + rule filter_single_mapping_reads: + """ + Filter BAM file to include only single-mapping reads. + """ + input: + bam=c.patterns['markduplicates']['bam'] + output: + bam='data/rnaseq_samples/{sample}/{region}.bam' + log: + 'logs/filter_single_mapping_{sample}_{region}.log' + threads: 1 + resources: + mem_mb=100, + runtime=1 + shell: + """ + samtools view -h {input.bam} | grep -P "(NH:i:1|^@)" | samtools view -Sb - > {output.bam} 2> {log} + """ + + + rule bam_count_mqc: + """ + Count reads in a BAM file for a specific region + """ + input: + bam='data/rnaseq_samples/{sample}/{region}.bam', + bai='data/rnaseq_samples/{sample}/{region}.bam.bai' + output: + 'data/rnaseq_samples/{sample}/{region}_counts.txt' + params: + chrom=lambda wildcards: get_region_by_name(wildcards.region)['chrom'], + start=lambda wildcards: get_region_by_name(wildcards.region)['start'], + stop=lambda wildcards: get_region_by_name(wildcards.region)['end'] + log: + 'logs/bam_count_{sample}_{region}.log' + threads: 1 + resources: + mem_mb=gb(1), + runtime=autobump(hours=1) + shell: + 'samtools view -c {input.bam} {params.chrom}:{params.start}-{params.stop} > {output}' + + + rule generate_combined_region_yaml: + """ + Write the _mqc.yaml MultiQC input file that contains the configuration and data for the + MultiQC user defined region expression barchart. + """ + input: + sizefactors=c.targets['sizefactors'], + counts=lambda wildcards: expand( + 'data/rnaseq_samples/{sample}/{region}_counts.txt', + sample=SAMPLES, + region=REGIONS + ) + output: + c.targets['expression_mqc_yaml'] + params: + REGIONS + log: + 'logs/generate_combined_regions_yaml.log' + threads: 1 + resources: + mem_mb=100, + runtime=1 + run: + multiqc.make_regions_counts_yaml(input.sizefactors[0], input.counts, params[0], output[0]) + +else: + # No regions specified; no _mqc.yaml generated; dont pass an expression module yaml to MultiQC + c.targets['expression_mqc_yaml'] = [] + +if 'Run' in c.sampletable.columns and sum(c.sampletable['Run'].str.startswith('SRR')) > 0: + + # Convert the sampletable to be indexed by the first column, for + # convenience in generating the input/output filenames. + _st = c.sampletable.set_index(c.sampletable.columns[0]) + + rule fastq_dump: + output: + fastq=render_r1_r2(c.patterns['fastq']) + log: + r1_only(c.patterns['fastq'])[0] + '.log' + params: + is_paired=c.is_paired, + sampletable=_st, + # limit = 100000, # [TEST SETTINGS] + resources: + mem_mb=gb(1), + disk_mb=autobump(gb=1), + runtime=autobump(hours=2) + conda: + '../../wrappers/wrappers/fastq-dump/environment.yaml' + script: + wrapper_for('fastq-dump/wrapper.py') + # This can be set at the command line with --config strand_check_reads=1000 config.setdefault('strand_check_reads', 1e5) @@ -545,8 +720,8 @@ rule bam_index: bai='{prefix}.bam.bai' threads: 1 resources: - mem_mb=gb(2), - runtime=autobump(hours=2) + mem_mb=gb(1), + runtime=autobump(hours=1) shell: 'samtools index {input} {output}' @@ -684,6 +859,7 @@ rule multiqc: # NOTE: if you add more rules and want MultiQC to pick up the output, then # add outputs from those rules to the inputs here. input: + yaml=c.targets['expression_mqc_yaml'], files=( utils.flatten(c.targets['fastqc']) + utils.flatten(c.targets['rrna_percentages_yaml']) + @@ -705,7 +881,9 @@ rule multiqc: mem_mb=gb(2), runtime=autobump(hours=2) run: - analysis_directory = set([os.path.dirname(i) for i in input]) + analysis_directories = set([os.path.dirname(i) for i in input.files]) + yaml_directories = set([os.path.dirname(i) for i in input.yaml]) # Allows for a list of yamls or a single yaml + all_directories = ' '.join(analysis_directories.union(yaml_directories)) outdir = os.path.dirname(c.targets['multiqc'][0]) basename = os.path.basename(c.targets['multiqc'][0]) shell( @@ -716,11 +894,10 @@ rule multiqc: '--force ' '--filename {basename} ' '--config {input.config} ' - '{analysis_directory} ' + '{all_directories} ' '&> {log} ' ) - rule markduplicates: """ Mark or remove PCR duplicates with Picard MarkDuplicates @@ -951,7 +1128,7 @@ rule idxstats: bai=c.patterns['markduplicates']['bam'] + '.bai' output: txt=c.patterns['samtools']['idxstats'] - log: + log: c.patterns['samtools']['idxstats'] + '.log' resources: mem_mb=gb(16), diff --git a/workflows/rnaseq/config/config.yaml b/workflows/rnaseq/config/config.yaml index 7b0db18d..0d1b019f 100644 --- a/workflows/rnaseq/config/config.yaml +++ b/workflows/rnaseq/config/config.yaml @@ -51,6 +51,11 @@ merged_bigwigs: - sample3 - sample4 +# Arbitrarily named regions specified here will appear in a MultiQC stacked normalized expression barchart +expression_barchart_multiqc: + cold: chr2L:574291-575734 + hop: chr2L:295122-297449 + # See the reference config files in the top level of the repo, # include/reference_configs, for inspiration for more species. diff --git a/workflows/rnaseq/config/rnaseq_patterns.yaml b/workflows/rnaseq/config/rnaseq_patterns.yaml index 92b2a534..68b0b2ff 100644 --- a/workflows/rnaseq/config/rnaseq_patterns.yaml +++ b/workflows/rnaseq/config/rnaseq_patterns.yaml @@ -47,3 +47,7 @@ samtools: idxstats: 'data/rnaseq_samples/{sample}/idxstat_{sample}.txt' flagstat: 'data/rnaseq_samples/{sample}/{sample}.cutadapt.markdups.bam.flagstat' stats: 'data/rnaseq_samples/{sample}/{sample}.cutadapt.markdups.bam.stats' +sizefactors: 'data/rnaseq_aggregation/sizefactors.tsv' +expression_mqc_yaml: 'data/rnaseq_aggregation/expression_barchart_mqc.yaml' +counts: 'data/rnaseq_aggregation/counts.tsv' +normalized_counts: 'data/rnaseq_aggregation/normalized_counts.tsv'