# HG changeset patch
# User mvdbeek
# Date 1524937878 14400
# Node ID 7fd65542efc2ec5212fc21cd18681932620af7d6
# Parent 427f5dda88547006b1965e4c3f13cff16c82958d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/damidseq_average_score commit 14ffe107199084dcb9f4a9f693ef7b6be097a87b
diff -r 427f5dda8854 -r 7fd65542efc2 average_scores.xml
--- a/average_scores.xml Fri Apr 27 14:54:05 2018 -0400
+++ b/average_scores.xml Sat Apr 28 13:51:18 2018 -0400
@@ -11,32 +11,37 @@
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
+#set column = {'bed': 4, 'bedgraph': 3, 'gff': 5, 'gff3': 5, 'gtf': 5}[$input_files[0].ext]
+skiprows = 0
+with open('$files[0]') as first_file:
+ for i, line in enumerate(first_file):
+ if not line.startswith(('track', 'browser', '#')):
+ skiprows = i
+ break
d = {}
#for f in $files:
-d['$f'] = pd.read_csv('$f', usecols=[$column], sep="\t", skiprows=$skiprows, header=None, squeeze=True)
+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])
+ if i >= skiprows:
+ fields[$column] = str(mean[i - skiprows])
out.write("%s\n" % "\t".join(fields))
-
-
-
+
+