ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/msatfinder/artview
Revision: 1.1.1.1 (vendor branch)
Committed: Mon Mar 7 15:34:42 2005 UTC (11 years, 5 months ago) by knirirr
Branch: MAIN
CVS Tags: HEAD, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
First import

Line File contents
1 #!/usr/bin/perl
2
3 ###########################################################
4 # SCRIPT NAME: artview #
5 # FUNCTION: load GENBANK data and .tab files into Artemis #
6 ###########################################################
7
8 # NB should be run in the genomes directory
9 # Do the following, if time and skill permit
10 # keep log of which sequences have been looked at
11
12 use strict;
13 use warnings;
14
15
16 my $genedir = `pwd`;
17 chomp($genedir);
18 $genedir = "$genedir/"; # where we store Genbank files and run the script
19 my $tab_dir ="Artemis/"; # where the Artemis files go
20 my $storefile = "$genedir" . "stored"; # a file containing the list of seen seqs
21 my @seen_sequence; # files seen on this occasion
22 my @stored; # files seen on previous occasions
23 my @tab_files; # the artemis feature tables
24 my $file_path; # path to original sequence file
25 my @view; # the files we will actually be looking at
26
27 # location of the Artemis binary
28 # if you don't fill a location in here,
29 # the script will attempt to find artemis
30 my $artemis = "";
31
32 if ($artemis eq "")
33 {
34 $artemis = `which artemis 2> /dev/null`; # return a null value if not on $PATH
35 chomp $artemis;
36
37 # in case the name is aliased
38 if ($artemis =~ /alias/)
39 {
40 $artemis = "artemis";
41 }
42 elsif ($artemis eq "")
43 {
44 print "You don't appear to have artemis installed or on your \$PATH.\n";
45 print "Please correct this and try again\n";
46 }
47 elsif ($artemis =~ /=/)
48 {
49 $artemis =~ /.+?=(.+)/;
50 $artemis = $1;
51 }
52 }
53 else
54 {
55 unless (-e $artemis)
56 {
57 print "The value given for the location of artemis ($artemis) appears to be incorrect.\n";
58 print "Please change this and try again.\n";
59 exit;
60 }
61
62 }
63
64 # get all the feature tables
65 opendir TABDIR, $tab_dir or die "Can't read $tab_dir! \n";
66 @tab_files = grep /\.tab/, readdir TABDIR;
67 chomp (@tab_files);
68 &trim (@tab_files);
69 closedir TABDIR;
70
71 # read the list of what's been seen, in case the last run
72 # was interrupted
73 if (-e $storefile)
74 {
75 open (STORE, "<$storefile") or die "Can't open $storefile file; stopped";
76 chomp(@stored = <STORE>);
77 &trim (@stored);
78 close STORE;
79 my $store;
80 foreach $store (@stored)
81 {
82 push (@seen_sequence, $store);
83 }
84 $store = join ("*", @stored);
85 my $tab;
86 foreach $tab (@tab_files)
87 {
88 {
89 push (@view, $tab);
90 }
91 }
92 print "Stored = @stored\n";
93 print "View = @view\n";
94 #exit;
95 open (STORE, ">$storefile") or die "Can't open $storefile; stopped";
96 }
97 else
98 {
99 print "Creating file $storefile \n";
100 open (STORE, ">$storefile") or die "Can't open $storefile file; stopped";
101 }
102
103 # this section loads the list of files to be viewed, one after
104 # the other, into Artemis. It also writes a list of those seen
105 foreach my $view (@view)
106 {
107 my $genbank = $view;
108 $genbank =~ s/\.tab/.gbk/;
109 print "Loading $view and associated repeat data into Artemis. Please wait.\n";
110 system("$artemis -quiet $tab_dir/$genbank +$tab_dir/$view") or warn "Artemis just died or was killed!\n";
111 push(@seen_sequence, $view);
112 print "Press x <return> to exit, or <return> to continue.\n";
113 chomp(my $quit = <STDIN>);
114 if ($quit =~ /^[Xx]/)
115 {
116 print "You have seen these files: \n";
117 print "@seen_sequence \n";
118 print STORE "@seen_sequence \n";
119 exit 0;
120 }
121 else
122 {
123 print "You have seen these files so far: \n";
124 print "@seen_sequence \n";
125 }
126 }
127 print "Finished. \n";
128
129 # subroutines
130 sub trim
131 {
132 my @out = @_;
133 for (@out)
134 {
135 s/^\s+//;
136 s/\s+$//;
137 }
138 }