Mercurial > repos > iuc > repmatch_gff3
changeset 1:e5c7fffdc078 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e7c1b37cf73425c6637b4e196fdeb290e042bc1
author | iuc |
---|---|
date | Tue, 26 Jul 2016 06:10:53 -0400 |
parents | a072f0f30ea3 |
children | d7f1312b3455 |
files | repmatch_gff3.xml repmatch_gff3_util.py repmatch_gff3_util.pyc test-data/magic.pdf test-data/statistics_histogram_out1.pdf |
diffstat | 5 files changed, 27 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/repmatch_gff3.xml Wed Dec 23 09:25:42 2015 -0500 +++ b/repmatch_gff3.xml Tue Jul 26 06:10:53 2016 -0400 @@ -77,20 +77,21 @@ <data name="output_matched_peaks" format="gff" label="Data MP: ${tool.name} on ${on_string}" /> </outputs> <tests> - <param name="input" value="closest_matched_pairs_input1.gff" ftype="gff" /> - <param name="input" value="largest_matched_pairs_input1.gff" ftype="gff" /> - <param name="method" value="closest" /> - <param name="distance" value="50" /> - <param name="replicates" value="2" /> - <param name="output_files" value="all" /> - <param name="step" value="0" /> - <param name="low_limit" value="-1000" /> - <param name="up_limit" value="1000" /> - <output name="output_statistics_table" file="statistics_table_out1.tabular" ftype="tabular" /> - <output name="output_statistics_histogram" file="statistics_histogram_out1.pdf" ftype="pdf" compare="sim_size" /> - <output name="output_detail" file="detail_out1.tabular" ftype="tabular" /> - <output name="output_unmatched_peaks" file="unmatched_peaks_out1.tabular" ftype="tabular" /> - <output name="output_matched_peaks" file="matched_peaks_out1.gff" ftype="gff" /> + <test> + <param name="input" value="closest_matched_pairs_input1.gff,largest_matched_pairs_input1.gff" ftype="gff" /> + <param name="method" value="closest" /> + <param name="distance" value="50" /> + <param name="replicates" value="2" /> + <param name="output_files" value="all" /> + <param name="step" value="0" /> + <param name="low_limit" value="-1000" /> + <param name="up_limit" value="1000" /> + <output name="output_statistics_table" file="statistics_table_out1.tabular" ftype="tabular" /> + <output name="output_statistics_histogram" file="magic.pdf" ftype="pdf" compare="contains" /> + <output name="output_detail" file="detail_out1.tabular" ftype="tabular" /> + <output name="output_unmatched_peaks" file="unmatched_peaks_out1.tabular" ftype="tabular" /> + <output name="output_matched_peaks" file="matched_peaks_out1.gff" ftype="gff" /> + </test> </tests> <help> **What it does**
--- a/repmatch_gff3_util.py Wed Dec 23 09:25:42 2015 -0500 +++ b/repmatch_gff3_util.py Tue Jul 26 06:10:53 2016 -0400 @@ -4,9 +4,10 @@ import shutil import sys import tempfile + import matplotlib matplotlib.use('Agg') -from matplotlib import pyplot +from matplotlib import pyplot # noqa: E402 # Graph settings Y_LABEL = 'Counts' @@ -172,9 +173,9 @@ return 0 sdata = sorted(data) if len(data) % 2 == 0: - return (sdata[len(data)//2] + sdata[len(data)//2-1]) / 2 + return (sdata[len(data) // 2] + sdata[len(data) // 2 - 1]) / 2 else: - return sdata[len(data)//2] + return sdata[len(data) // 2] def make_keys(peaks): @@ -219,8 +220,8 @@ xvals, yvals = freq.graph_series() # Go from high to low xvals.reverse() - pyplot.bar([x-0.4 + 0.8/len(freqs)*i for x in xvals], yvals, width=0.8/len(freqs), color=COLORS[i]) - pyplot.xticks(range(min(xvals), max(xvals)+1), map(str, reversed(range(min(xvals), max(xvals)+1)))) + pyplot.bar([x - 0.4 + 0.8 / len(freqs) * i for x in xvals], yvals, width=0.8 / len(freqs), color=COLORS[i]) + pyplot.xticks(range(min(xvals), max(xvals) + 1), map(str, reversed(range(min(xvals), max(xvals) + 1)))) pyplot.xlabel(X_LABEL) pyplot.ylabel(Y_LABEL) pyplot.subplots_adjust(left=ADJUST[0], right=ADJUST[1], top=ADJUST[2], bottom=ADJUST[3]) @@ -308,7 +309,7 @@ galaxy_hid = galaxy_hids[i] r = Replicate(galaxy_hid, dataset_path) replicates.append(r) - except Exception, e: + except Exception as e: stop_err('Unable to parse file "%s", exception: %s' % (dataset_path, str(e))) attrs = 'd%sr%s' % (distance, num_required) if up_limit != 1000: @@ -430,7 +431,7 @@ # Output matched_peaks (matched pairs). matched_peaks_output.writerow(gff_row(cname=group.chrom, start=group.midpoint, - end=group.midpoint+1, + end=group.midpoint + 1, source='repmatch', score=group.normalized_value(med), attrs={'median_distance': group.median_distance, @@ -439,19 +440,19 @@ if output_detail_file: matched_peaks = (group.chrom, group.midpoint, - group.midpoint+1, + group.midpoint + 1, group.normalized_value(med), group.num_replicates, group.median_distance, group.value_sum) for peak in group.peaks.values(): - matched_peaks += (peak.chrom, peak.midpoint, peak.midpoint+1, peak.value, peak.distance, peak.replicate.id) + matched_peaks += (peak.chrom, peak.midpoint, peak.midpoint + 1, peak.value, peak.distance, peak.replicate.id) detail_output.writerow(matched_peaks) if output_unmatched_peaks_file: for unmatched_peak in unmatched_peaks: unmatched_peaks_output.writerow((unmatched_peak.chrom, unmatched_peak.midpoint, - unmatched_peak.midpoint+1, + unmatched_peak.midpoint + 1, unmatched_peak.value, unmatched_peak.distance, unmatched_peak.replicate.id))