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

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

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

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

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

