# HG changeset patch # User mvdbeek # Date 1524855245 14400 # Node ID 427f5dda88547006b1965e4c3f13cff16c82958d planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/damidseq_average_score commit 3f1b0838d9fd6256d61490c3b2b52936b9ce2123 diff -r 000000000000 -r 427f5dda8854 average_scores.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/average_scores.xml Fri Apr 27 14:54:05 2018 -0400 @@ -0,0 +1,49 @@ + + for fixed step interval files + + pandas + + + + +import pandas as pd + +#set files = [str(f) for f in $input_files] +#set column = 3 if $input_files[0].ext in ['bed', 'bedgraph'] else 5 +d = {} +#for f in $files: +d['$f'] = pd.read_csv('$f', usecols=[$column], sep="\t", skiprows=$skiprows, header=None, squeeze=True) +#end for +df = pd.DataFrame.from_dict(d) +mean = df.mean(axis=1) +with open('$averaged_output', 'w') as out, open('$files[0]') as first_file: + for i, line in enumerate(first_file): + fields = line.strip().split("\t") + if i >= $skiprows: + fields[$column] = str(mean[i - $skiprows]) + out.write("%s\n" % "\t".join(fields)) + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 427f5dda8854 test-data/1.bed --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/1.bed Fri Apr 27 14:54:05 2018 -0400 @@ -0,0 +1,20 @@ +X 23522161 23522595 0 +X 23522595 23522617 0 +X 23522617 23522667 0 +X 23522667 23522718 0 +X 23522718 23523060 0 +X 23523060 23523689 0 +X 23523689 23523745 0 +X 23523745 23524267 0 +X 23524267 23524356 -0.104752855109578 +X 23524356 23524568 -0.293877189116431 +X 23524568 23524641 -1.53013740012243 +X 23524641 23525198 -1.58606530197667 +X 23525198 23525317 -0.0307134820917063 +X 23525317 23525617 -0.00619522786809301 +X 23525617 23525880 -0.0548220080355809 +X 23525880 23525964 -0.154408546338667 +X 23525964 23526598 -0.0690303255876258 +X 23526598 23526813 -0.0154384717774205 +X 23526813 23526834 0 +X 23526834 23527211 0 diff -r 000000000000 -r 427f5dda8854 test-data/2.bed --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/2.bed Fri Apr 27 14:54:05 2018 -0400 @@ -0,0 +1,20 @@ +X 23522161 23522595 0 +X 23522595 23522617 0 +X 23522617 23522667 0 +X 23522667 23522718 0 +X 23522718 23523060 0 +X 23523060 23523689 0 +X 23523689 23523745 0 +X 23523745 23524267 0 +X 23524267 23524356 -0.0146345659674355 +X 23524356 23524568 -0.0422122702539344 +X 23524568 23524641 -0.192452892061725 +X 23524641 23525198 -0.200392807926829 +X 23525198 23525317 -0.0178237930863262 +X 23525317 23525617 -0.0110608256166981 +X 23525617 23525880 -0.0703964912539701 +X 23525880 23525964 -0.301695035600013 +X 23525964 23526598 -0.0461899200637665 +X 23526598 23526813 0 +X 23526813 23526834 0 +X 23526834 23527211 0 diff -r 000000000000 -r 427f5dda8854 test-data/averaged.bed --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/averaged.bed Fri Apr 27 14:54:05 2018 -0400 @@ -0,0 +1,20 @@ +X 23522161 23522595 0.0 +X 23522595 23522617 0.0 +X 23522617 23522667 0.0 +X 23522667 23522718 0.0 +X 23522718 23523060 0.0 +X 23523060 23523689 0.0 +X 23523689 23523745 0.0 +X 23523745 23524267 0.0 +X 23524267 23524356 -0.05969371053850675 +X 23524356 23524568 -0.1680447296851827 +X 23524568 23524641 -0.8612951460920775 +X 23524641 23525198 -0.8932290549517494 +X 23525198 23525317 -0.024268637589016248 +X 23525317 23525617 -0.008628026742395555 +X 23525617 23525880 -0.0626092496447755 +X 23525880 23525964 -0.22805179096933997 +X 23525964 23526598 -0.05761012282569615 +X 23526598 23526813 -0.00771923588871025 +X 23526813 23526834 0.0 +X 23526834 23527211 0.0