view doSegmentation.sh @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents 4182672fd6f8
children
line wrap: on
line source
#!/bin/bash

if [ $# -lt 2 ] ; then
echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR"
exit 1
fi

retainstructure=0

while [ $# -gt 2 ] ; do
case $1 in
-d) retainstructure=1 ; shift 1 ; echo here;;
*) shift 1 ;;
esac
done

listfile="$1"
echo listfile "$listfile"
outputdir="$2"


while read infile; do
	if [ "$infile" -a -f "$infile" ]; then
		before="$(date +%s)"
		echo "_____________________________________________________"
		echo " "
		echo Processing file "$infile"
		echo " "
		if [ $retainstructure -eq 0 ]; then
			pathandfile=`basename "$infile"`
		else
			pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`"
			echo pathandfile "$pathandfile"
		fi
		outfile="$outputdir"/"$pathandfile".txt
		
		logfile=_logfiles/"$pathandfile".log
		chromafile=_chromadata/"$pathandfile".csv
		
		mkdir -p "`dirname "$outfile"`"
		
		echo "[sonic annotator] ..."
		VAMP_PATH=. ./sonic-annotator-unix -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> "$logfile" | cut -d ',' -f 2-  > "$chromafile" 
		infile="`echo "$infile" | sed "s/'/''/g"`"
		outfile="`echo "$outfile" | sed "s/'/''/g"`"
		chromafile="`echo "$chromafile" | sed "s/'/''/g"`"		
		matlab -nodisplay -nojvm -r run_segmentation\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> "$logfile"
		after="$(date +%s)"
		elapsed_seconds="$(expr $after - $before)"
		echo "  -->" time elapsed: $elapsed_seconds seconds
		echo " "
	else if [ ! "$infile" ]; then echo ...; fi
	fi		
done < "$listfile"