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

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

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

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

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

