#!/bin/csh
#
# This UCSF Generation and Cleanup script was created by AGNuS 2.0.
#


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

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

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

