Ucsc

From genomewiki
Revision as of 12:55, 11 August 2006 by Max (talk | contribs)
Jump to navigationJump to search
  • You need a script putfile for this to work. Putfile has to output the filename to stdout. I've defined putfile in my .bashrc like this:

putfile() { scp $1 me@myownserver.org:homepage/crap; echo 'myownserver.org:homepage/crap/'$1; }

  • you need bedRange in your path for this to work
#!/bin/bash
BROWSER=firefox

if test $# -eq 0 
  then  
          echo ucsc: open ucsc browser with given custom-track-file 
          echo       '(uses putfile,bedRegion)'
          echo SYNTAX:
          echo   ucsc '<filename> [org] [site] [range]'
          echo  
          echo  org is something like hg17, mm7, ...
          echo  (org defaults to hg17)
          echo  server can be on of ucsc,duke,kate,kent
          echo  (server defaults to ucsc)
          echo  range can be something like chr1:1-2000
          echo  range defaults to the maximum region covered by the bed file
          echo
          echo EXAMPLE:
          echo   ucsc test.bed 
          echo   ucsc test.bed human
           
          exit 1
fi        

ORG=$2
SITE=$3
REGION=$4

if test -z "$SITE" 
then
        SITE=ucsc
fi

case $SITE in 
ucsc)
        URL=http://genome.ucsc.edu
        ;;
duke)
        URL=http://genome-mirror.duhs.duke.edu
        ;;
kate)
        URL=http://hgwdev-kate.cse.ucsc.edu
        ;;
kent)
        URL=http://hgwdev-kent.cse.ucsc.edu
        ;;
esac

###

if test -z "$ORG" 
then
    ORG="hg17"
fi

if [ "$REGION" == "" ]; then
    REGION=`bedRegion $1` 
    if [ "$?" == "1" ]; then
        echo Region=$REGION
        echo error: Could not determine the position to display, please call the
        echo script like this: ucsc test.bed hg17 ucsc chr1:1-1000
        exit 1
    fi
fi

FILENAME=`basename $1`
echo Uploading file $1 
#ncftpput -u $USER -p $PASS $SERVER $UPLOADPATH $1 > /dev/null
file=`putfile $1`
#echo Opening UCSC Browser for file $1 
echo http://$SERVER$DOWNLOADPATH$FILENAME
"$BROWSER" "$URL/cgi-bin/hgTracks?db=$ORG&position=$REGION&hgt.customText=$file"
echo "$URL/cgi-bin/hgTracks?db=$ORG&position=$REGION&hgt.customText=$file" &