view imgt_loader.sh @ 12:70c8234acaf3 draft default tip

Uploaded
author davidvanzessen
date Tue, 23 Jun 2015 07:52:44 -0400
parents 3287f7b9c47d
children
line wrap: on
line source

#!/bin/bash
input=$1
output=$2
name=$3
dir="$(cd "$(dirname "$0")" && pwd)"
mkdir -p $PWD/$name/files
f=$(file $input)
zip7Type="7-zip archive"
tarType="tar archive"
bzip2Type="bzip2 compressed"
gzipType="gzip compressed"
zipType="Zip archive"
rarType="RAR archive"
zxType="XZ compressed data"

if [[ "$f" == *"$zip7Type"* ]]; then
	echo "7-zip"
	echo "Trying: 7za e $input -o$PWD/files/"
	7za e $input -o$PWD/$name/files
fi

if [[ "$f" == *"$tarType"* ]]
then
	echo "tar archive"
	echo "Trying: tar -xvf $input -C $PWD/files/"
	tar -xvf $input -C $PWD/$name/files
fi

if [[ "$f" == *"$bzip2Type"* ]]
then
	echo "bzip2 compressed data"
	echo "Trying: tar -jxf $input -C $PWD/files/"
	tar -jxf $input -C $PWD/$name/files
fi

if [[ "$f" == *"$gzipType"* ]]
then
	echo "gzip compressed data"
	echo "Trying: tar xvzf $input -C $PWD/files/"
	tar xvzf $input -C $PWD/$name/files
fi

if [[ "$f" == *"$zipType"* ]]
then
	echo "Zip archive"
	echo "Trying: unzip $input -d $PWD/files/"
	unzip $input -d $PWD/$name/files > $PWD/unziplog.log
fi

if [[ "$f" == *"$rarType"* ]]
then
	echo "RAR archive"
	echo "Trying: unrar e $input $PWD/files/"
	unrar e $input $PWD/$name/files
fi

if [[ "$f" == *"$zxType"* ]]
then
	echo "ZX archive"
	echo "Trying: tar -xJf $input -C $PWD/$name/files/"
	tar -xJf $input -C $PWD/$name/files/
fi


find $PWD/$name/files -iname "1_*" -exec cat {} + > $PWD/$name/summ.txt
find $PWD/$name/files -iname "5_*" -exec cat {} + > $PWD/$name/aa.txt
find $PWD/$name/files -iname "6_*" -exec cat {} + > $PWD/$name/junction.txt

python $dir/imgt_loader.py --summ $PWD/$name/summ.txt --aa $PWD/$name/aa.txt --junction $PWD/$name/junction.txt --output $output