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


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

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

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

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

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

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

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

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

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

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

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

