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

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

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

