From 81657a288a4c286873fa84724e7e0e1b5b4e7923 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Thu, 5 Apr 2018 17:58:19 +0200 Subject: [PATCH] Modify script to accept compressed genome files Former-commit-id: f816e3ce8b10e2ca3f1aa9ae969c24e699368e25 Former-commit-id: 16fb412552debdfd2172926e8a8b63be05257bdf --- detectors/normalize/tools/selectViridiplantae.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/detectors/normalize/tools/selectViridiplantae.sh b/detectors/normalize/tools/selectViridiplantae.sh index 895dd06..a75a6f3 100755 --- a/detectors/normalize/tools/selectViridiplantae.sh +++ b/detectors/normalize/tools/selectViridiplantae.sh @@ -1,8 +1,18 @@ #!/bin/bash -grep -A 1 ' ORGANISM' $* | \ + +( \ + for f in $* ; do \ + if [[ "$f" =~ \.gz$ ]] ; then \ + GREP=zgrep; \ + else \ + GREP=grep; \ + fi; \ + ${GREP} -H -A 1 ' ORGANISM' $f; \ + done \ +) | \ grep -B 1 Viridiplantae | \ gawk '{print $1}' | \ grep '\.gbk' | \ - sed -E 's/(^.*\.gbk).$/\1/' | \ + sed -E 's/(^.*\.gbk(.gz)?).$/\1/' | \ uniq \ No newline at end of file