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

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

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

