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

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

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

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

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

