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

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

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

