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


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

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

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

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

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

# Testing to delete ./sub/HNcoCACB_GFT_xz.pipe
if (-e ./sub/HNcoCACB_GFT_xz.pipe) then
	echo "Deleteing ./sub/HNcoCACB_GFT_xz.pipe"
	rm -fr ./sub/HNcoCACB_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/pipe_rephasing/
if (-e ./add/pipe_rephasing/) then
	echo "Deleteing ./add/pipe_rephasing/"
	rm -fr ./add/pipe_rephasing/ 
endif

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

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

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

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

# Testing to delete ./add/HNcoCACB_GFT_xz.pipe
if (-e ./add/HNcoCACB_GFT_xz.pipe) then
	echo "Deleteing ./add/HNcoCACB_GFT_xz.pipe"
	rm -fr ./add/HNcoCACB_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/HNcoCACB_GFT.pipe exists
if (-e ./add/HNcoCACB_GFT.pipe) then
	echo "Attempting to generate UCSF file ./add/HNcoCACB_GFT.ucsf"
	if ( { pipe2ucsf  ./add/HNcoCACB_GFT.pipe ./add/HNcoCACB_GFT.ucsf } ) then 
		if (-e ./add/Convert_HNcoCACB_GFT.csh ) then
			echo "ZZZZZZZZZZConversion_script_begin" >> ./add/HNcoCACB_GFT.ucsf
			cat ./add/Convert_HNcoCACB_GFT.csh >> ./add/HNcoCACB_GFT.ucsf
			echo "ZZZZZZZZZZConversion_script_end" >> ./add/HNcoCACB_GFT.ucsf
		endif
		if (-e ./add/Process_HNcoCACB_GFT.csh ) then
			echo "ZZZZZZZZZZProcessing_script_begin" >> ./add/HNcoCACB_GFT.ucsf
			cat ./add/Process_HNcoCACB_GFT.csh >> ./add/HNcoCACB_GFT.ucsf
			echo "ZZZZZZZZZZProcessing_script_end" >> ./add/HNcoCACB_GFT.ucsf
		endif
		echo "Deleteing ./add/HNcoCACB_GFT.pipe"
		rm -f ./add/HNcoCACB_GFT.pipe 
	endif
endif

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

