Ucsc: Difference between revisions

From genomewiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
* 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:
* You need a script '''putfile''' for this to work. Putfile puts a file onto a server in a directory that is accessible via http. Putfile has to output the URL to stdout. I've defined putfile in my .bashrc like this:
putfile() { scp $1 me@myownserver.org:homepage/crap; echo 'http://myownserver.org/homepage/crap/'$1; }
putfile() { scp $1 me@myownserver.org:homepage/crap; echo 'http://myownserver.org/crap/'$1; }


* you need [[bedRegion]] in your path for this to work
* you need [[bedRegion]] in your path for this to work

Revision as of 23:41, 9 September 2006

  • You need a script putfile for this to work. Putfile puts a file onto a server in a directory that is accessible via http. Putfile has to output the URL to stdout. I've defined putfile in my .bashrc like this:

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

  • you need bedRegion in your path for this to work
#!/bin/bash
# max 10/05
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" &