Hi. I uploaded the fastq.gz file below to galaxy. I noticed that galaxy will convert it to fastq, so I didn't include gunzip before awk. (the code works in command line)
(I have tried adding gunzip -c before awk, like I do in command line, but galaxy will say "gzip: ...dat: not in gzip format )
wget https://www.encodeproject.org/files/ENCFF172GUS/@@download/ENCFF172GUS.fastq.gz
I wrote the script (see below) but it generated the error :
awk: (FILENAME=/data/galaxy_r17_05/database/files/000/dataset_193.dat FNR=5201) fatal: print to "standard output" failed (Broken pipe)
<tool id="getLength" name="Get the length of the FASTQ files">
<description></description>
<command>
awk '{if(NR%4==1) {print \$0}}' $input | head -n 1 | awk -F ":" '{print \$1}' | cut -c 2- | awk '{print length;}' | sort | uniq -c > $output
</command>
<inputs>
<param name="input" type="data" format="fastq" label="Input FASTQ file"/>
</inputs>
<outputs>
<data name="output" format="tabular" label="Get the file length on ${on_string}"/>
</outputs>
</tool>