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

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

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

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

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

