#!/bin/tcsh -ef
if ("$jdb" == "") then
    echo "env var jdb not set.  should be something like jackson20060125"
    exit 1
endif

# we can't get to the downloaded mysql db now because it's on another machine
#hgsql $jdb -BN -e 'select substring(accID,5) from ACC_Accession where prefixPart = "PIX:"' > pixIds.list

set sql = 'select substring(accID,5,30) from ACC_Accession where prefixPart = "PIX:"' 
query "$sql" "bcp" | sed -e 's/|//g' > pixIds.list

#cat pixIds.list

# start with a new list
rm -f pix-downloaded.list
if ( ! -d /san/sanvol1/scratch/visiGene/downloads/jackson/$jdb/ ) then
    mkdir /san/sanvol1/scratch/visiGene/downloads/jackson/$jdb/
endif    

set pixList = ( `cat pixIds.list` )
#echo $pix

while ( $#pixList != 0 )
    set pix = $pixList[1] 
    shift pixList
    if ( ! -e /gbdb/visiGene/full/inSitu/Mouse/jax/${pix}.jpg ) then
    	echo $pix
	getImage $pix
    endif	    
end
	
