Files
galaxy/tools/filters/tailWrapper.xml
T
M BerntandMarius van den Beek 181b862250 Apply suggestions from code review
- add profile
- add requirement

Co-authored-by: Marius van den Beek <m.vandenbeek@gmail.com>
2021-05-04 13:47:29 +02:00

72 lines
2.1 KiB
XML

<tool id="Show tail1" name="Select last" version="1.0.1" profile="20.05">
<description>lines from a dataset</description>
<requirements>
<requirement type="package" version="8.31">coreutils</requirement>
</requirements>
<command detect_errors="exit_code"><![CDATA[
set -eo pipefail;
(
#if $header
head -n 1 '$input' &&
tail -n +2 '$input'
#else
cat '$input'
#end if
| tail -n $lineNum
) > '$out_file1'
]]></command>
<inputs>
<param name="lineNum" type="integer" value="10" min="1" label="Select last" help="lines"/>
<param name="input" type="data" format="txt" label="from"/>
<param name="header" type="boolean" label="Dataset has a header" help="if checked the header is kept and is not counted as a kept line"/>
</inputs>
<outputs>
<data name="out_file1" format_source="input" metadata_source="input"/>
</outputs>
<tests>
<test>
<param name="lineNum" value="10"/>
<param name="input" value="1.bed"/>
<output name="out_file1" file="eq-showtail.dat">
<assert_contents>
<not_has_text text="CCDS989.1_cds_0_0_chr1_147962193_r"/>
<has_n_lines n="10"/>
</assert_contents>
</output>
</test>
<test>
<param name="lineNum" value="10"/>
<param name="input" value="1.bed"/>
<param name="header" value="true"/>
<output name="out_file1">
<assert_contents>
<has_text text="CCDS989.1_cds_0_0_chr1_147962193_r"/>
<has_n_lines n="11"/>
</assert_contents>
</output>
</test>
</tests>
<help>
**What it does**
This tool outputs specified number of lines from the **end** of a dataset
-----
**Example**
- Input File::
chr7 57134 57154 D17003_CTCF_R7 356 -
chr7 57247 57267 D17003_CTCF_R4 207 +
chr7 57314 57334 D17003_CTCF_R5 269 +
chr7 57341 57361 D17003_CTCF_R7 375 +
chr7 57457 57477 D17003_CTCF_R3 188 +
- Show last two lines of above file. The result is::
chr7 57341 57361 D17003_CTCF_R7 375 +
chr7 57457 57477 D17003_CTCF_R3 188 +
</help>
</tool>