#!/bin/csh
#
# This UCSF Generation and Cleanup script was created by AGNuS 2.1.
#


# Testing to delete ./pipe_conversion/
if (-e ./pipe_conversion/) then
	echo "Deleteing ./pipe_conversion/"
	rm -fr ./pipe_conversion/ 
endif

# Testing to delete ./pipe_processing/
if (-e ./pipe_processing/) then
	echo "Deleteing ./pipe_processing/"
	rm -fr ./pipe_processing/ 
endif

# Testing to delete ./pipe_rephasing/
if (-e ./pipe_rephasing/) then
	echo "Deleteing ./pipe_rephasing/"
	rm -fr ./pipe_rephasing/ 
endif

# Testing to delete ./pipe_rebasing/
if (-e ./pipe_rebasing/) then
	echo "Deleteing ./pipe_rebasing/"
	rm -fr ./pipe_rebasing/ 
endif

# Testing to delete ./hCCH_tocsy.rephase.pipe
if (-e ./hCCH_tocsy.rephase.pipe) then
	echo "Deleteing ./hCCH_tocsy.rephase.pipe"
	rm -fr ./hCCH_tocsy.rephase.pipe 
endif

# Testing to delete ./hCCH_tocsy.rebase.pipe
if (-e ./hCCH_tocsy.rebase.pipe) then
	echo "Deleteing ./hCCH_tocsy.rebase.pipe"
	rm -fr ./hCCH_tocsy.rebase.pipe 
endif

# Testing to delete ./hCCH_tocsy_xy.pipe
if (-e ./hCCH_tocsy_xy.pipe) then
	echo "Deleteing ./hCCH_tocsy_xy.pipe"
	rm -fr ./hCCH_tocsy_xy.pipe 
endif

# Testing to delete ./hCCH_tocsy_xz.pipe
if (-e ./hCCH_tocsy_xz.pipe) then
	echo "Deleteing ./hCCH_tocsy_xz.pipe"
	rm -fr ./hCCH_tocsy_xz.pipe 
endif

# Generate UCSF if ./hCCH_tocsy.pipe exists
if (-e ./hCCH_tocsy.pipe) then
	echo "Attempting to generate UCSF file ./hCCH_tocsy.ucsf"
	if ( { pipe2ucsf  ./hCCH_tocsy.pipe ./hCCH_tocsy.ucsf } ) then 
		if (-e ./Convert_hCCH_tocsy.csh ) then
			echo "ZZZZZZZZZZConversion_script_begin" >> ./hCCH_tocsy.ucsf
			cat ./Convert_hCCH_tocsy.csh >> ./hCCH_tocsy.ucsf
			echo "ZZZZZZZZZZConversion_script_end" >> ./hCCH_tocsy.ucsf
		endif
		if (-e ./Process_hCCH_tocsy.csh ) then
			echo "ZZZZZZZZZZProcessing_script_begin" >> ./hCCH_tocsy.ucsf
			cat ./Process_hCCH_tocsy.csh >> ./hCCH_tocsy.ucsf
			echo "ZZZZZZZZZZProcessing_script_end" >> ./hCCH_tocsy.ucsf
		endif
		echo "Deleteing ./hCCH_tocsy.pipe"
		rm -f ./hCCH_tocsy.pipe 
	endif
endif

