ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/scripts/mgbl_probes.pl
Revision: 24
Committed: Tue Jul 26 21:46:39 2011 UTC (8 years, 4 months ago) by gpertea
File size: 1278 byte(s)
Log Message:
Line File contents
1 #!/usr/bin/perl
2 use strict;
3 #use Getopt::Std;
4 my $usage = q/Usage:
5 mgbl_probes.pl < mgblast_D4.output > self-hit-only.lst
6 /;
7
8 # mgblast2 -d mm9_exons.fa -i test_probes.fa -X1 -FF -D4 -W 44 > mgblast.tab
9
10 umask 0002;
11 #getopts('o:') || die($usage."\n");
12 #my $outlst=$Getopt::Std::opt_o;
13 my %h; # =>[has_self-hit, has_other-hit];
14 while (<>) {
15 chomp;
16 my @t=split("\t");
17 next unless $t[2]==1 && $t[3]==$t[1]; # && $t[2]==50 && int($t[7])==100
18 my $qid=$t[0];
19 my $strand=$t[11];
20 my $hid='|'.$t[4].'|';
21 my $d=$h{$qid};
22 unless ($d) {
23 $d=[0,0];
24 $h{$qid}=$d;
25 }
26 if (index($qid,$hid)>0) {
27 #print STDERR "looking for $hid in '$qid'\n";
28 #$htype='self_hit';
29 #$h{$qid}[0]++;
30 $d->[0]++;
31 }
32 else {
33 #$htype='other_hit';
34 #$h{$qid}[1]++;
35 $d->[1]++;
36 }
37 #print join("\t",$qid, $strand, @h, $htype)."\n";
38 }
39
40 foreach my $q ( keys(%h) ) {
41 my $d=$h{$q}; #print if it has a self hit but not other hits
42 print "$q\n" if $$d[0]>0 && $$d[1]==0;
43 }
44
45 # if ($outlst) {
46 # open(OUTLST, '>'.$outlst) || die ("Error creating file $outlst\n");
47 # foreach my $q ( keys(%h) ) {
48 # my $d=$h{$q}; #print if it has a self hit but not other hits
49 # print OUTLST "$q\t$$d[0]\n" if $$d[0]>0 && $$d[1]==0;
50 # }
51 # close(OUTLST);
52 # }

Properties

Name Value
svn:executable *