Speaking of viewing URLs in browsers, is it possible to view them in the
windows version of Artemis? I couldn't find 'results_to_netscape' in
etc/, and even though I copyied it there and enabled sanger_options I
never got the 'Send to browser' option. Do you know how to do it?

Regards,
Marcus



On Mon, 2003-09-15 at 12:21, Marcus Claesson wrote:
> Hi all,
> 
> I started using the 'results_to_netscape' function that enables web
> browsing of results from the external artemis tools (from the run menu),
> but couldn't get it to work fully. The URLs to the SRS server had to be
> updated and manipulated further in a way the made the
> 'results_to_netscape' quite complicated. Instead I chose to use Entrez
> retrieval system at NCBI. For those interested I attach the changed
> 'results_to_netscape' code here:
> 
> #!/bin/sh -
> 
> # This script will send a file to netscape with database IDs linked to
> ENTREZ
> # To enable this in Artemis, sanger_options must be set to true in the
> options file.
> 
> NETSCAPE=/usr/local/bin/netscape      
>                                                                                      
>                 
> if [ -f "$DIANA_ENVIRONMENT_FILE" ]
> then
>    . $DIANA_ENVIRONMENT_FILE
> fi
> 
> if [ $# = 0 ]
> then
>     echo no argument given 1>&2
>     exit 1
> fi
> 
> file_arg=$1
> 
> unique_bit=$$.`hostname`
> 
> if [ -f ./$file_arg ]
> then
>     # the file is in the current directory - we need the full path so
> netscape
>     # can find the file
>     new_file=$PWD/$file_arg.$unique_bit.html
> else
>     new_file=$file_arg.$unique_bit.html
> fi
> 
> cat <<EOF > $new_file
> <HTML>
>  <HEAD>
>   <TITLE>
>   Results for $file_arg
>  </TITLE>
>  </HEAD>
>  <BODY>
> <PRE>
> EOF
> 
> perl -e '
> BEGIN {
> 
>   $BLAST_START_LINE = "Sequences producing High-scoring Segment Pairs|"
> . 
>     "Sequences producing significant alignments:";
>   $FASTA_START_LINE = "The best scores are";
> 
>   # the list of IDs we have seen so far
>   @ids = ();
> 
>   # the list of IDs we have made anchors for so far
>   @anchored_ids = ();
> 
> }
> 
> sub hyperlink_to_anchor
> {
>   $id = shift;
>   qq(<a href="#$id">$id</a>);
> }
> 
> sub hyperlink_id
> {
>   $id = shift;
>   $r = qq#<A TARGET=_blank
> HREF=\"http:\/\/www.ncbi.nlm.nih.gov\/entrez\/viewer.fcgi?val=$id\">$id<\/A>#;
>   return $r
> }
> 
> $file_name = $ARGV[0];
> 
> if ($file_name =~ /\.gz$/) {
>   open IN_FILE, "gzip -d < $file_name |" or die "failed to open
> $file_name\n";
> } else {
>   open IN_FILE, "$file_name" or die "failed to open $file_name\n";
> }
> 
> while (<IN_FILE>) {
> 
>   s/(http\:\/\/([\S.\/]+))/<a href=\"$1\">$1<\/a>/gi;
>   
>   # ignore header lines
>   if (1..m/$BLAST_START_LINE|$FASTA_START_LINE/) {
>     print;
>     next;
>   }
> 
>   if (@ids && /^\s*$/) {
>     $summary_finished = 1;
>   }
> 
>    if (/\w+\|([^|]+)\|/) {
>      $id = $1;
>    }
> 
>     if ($summary_finished) {
>       if ((grep {$_ eq $id} @ids) && (!grep {$_ eq $id} @anchored_ids))
> {
>         # not anchored yet so make it an anchor
>         if (s/\b$id\b/"<a name=\"$id\">" . (hyperlink_id($id)) .
> "<\/a>"/e) {
>           push @anchored_ids, $id;
>         }
>       }
>     } else {
>       if (!grep {$_ eq $id} @ids) {
>         push @ids, $id;
>       }
> 
>       s/$id/hyperlink_to_anchor($id)/ei;
> 
>       if (!s/ $id/" " . hyperlink_id($id)/ei) {
>         # if the id occurs once in the line put a link at end of line
>         s/$/"  NCBI:" . hyperlink_id($id)/e;
>       }
>     }
>   print;
> }
> 
> ' $file_arg >> $new_file
> 
> cat <<EOF >> $new_file;
> </PRE>
>   </BODY>
> </HTML>
> EOF
> 
> # delete it at some point
> echo "rm -f $new_file " | at now + 36 hours
> 
> if $NETSCAPE -remote "openURL($new_file)"
> then
>     exit 0
> else
>     echo starting new netscape 
>     # netscape isn't running - so start it
>     ($NETSCAPE &)&
> 
>     # now send the URL.  we do things this way so that the script
> doesn't exit
>     # until netscape has successfully shown the URL
> 
>     sleep 1
> 
>     # don't exit the script until the file is successfully displayed or
> until
>     # 40 seconds is up
>     for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
>     do
>         if $NETSCAPE -remote "openURL($new_file)" 
>         then
>             exit 0
>         else
>             sleep 2
>         fi
>     done
> 
>     exit 1
> fi
> 
> 

Reply via email to