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

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

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

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

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

