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

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

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

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

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

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

