first tool integration with planemo, help needed



This is a complete beginner question and this probably belongs to the RTFM section. However, there is obviously a logic that I do not understand in galaxy xml.

What I want to do (independently of whether or not you can do that with existing tools in galaxy), is to give a list of bed files to my tool, and output a tab like:

#filename        #nb of lines
file1                  4645464
...                      ......
filen                  346354345

Here is my xml file:

<tool id="bedcounts_summary" name="Counts and summarizes line number for each bed file of a list" version="0.1.0">
      bash $__tool_directory__/ #for $key in $bedlist.keys() # $key $bedlist[$key] #end for                              
      >> $outputtab                                                                                                                          
      <param type="data_collection" format="bed" name="bedlist"/>
      <data name="outputtab" format="tabular"/>
        TODO: Fill in help.                                                                                                                  

Here is the bash script:



countslines=`wc -l < $bedfile`

echo -e "$bedfilename\t$countslines"

This is returning only the first line. I managed to have all lines using a simple echo but that is not the point, obviously.

If you can point to my logic/programming error that would be very helpful!




Do you want it to specifically be a tool?
bgruening’s awk tool in the main toolshed will readily do this.

I have a more feature rich version that is pending a PR to that linked repo that you might be interested in.



yes I would like to understand why it is not working, not to leave it unsolved. I might end using awk indeed.



by the way, I was able to do the same thing using:

  1. Line/Word/Character count of a dataset (Galaxy Version 1.0.0), taking care of not including the header
  2. Collapse Collection into single dataset in order of the collection (Galaxy Version 4.0), enabling the option “Append file name”

But if one see the mistake in the code above, it would be useful to know.