#!/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 ./TRHNcoCACB2h.rephase.pipe
if (-e ./TRHNcoCACB2h.rephase.pipe) then
	echo "Deleteing ./TRHNcoCACB2h.rephase.pipe"
	rm -fr ./TRHNcoCACB2h.rephase.pipe 
endif

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

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

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

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

