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

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

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

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

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

