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

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

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

