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


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

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

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

