| 1 | package Bio::DOOP::Util::Filt; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | =head1 NAME | ||||||||||
| 7 | |||||||||||
| 8 | Bio::DOOP::Util::Filt - Filter a cluster list | ||||||||||
| 9 | |||||||||||
| 10 | =head1 VERSION | ||||||||||
| 11 | |||||||||||
| 12 | Version 0.3 | ||||||||||
| 13 | |||||||||||
| 14 | =cut | ||||||||||
| 15 | |||||||||||
| 16 | 2 | our $VERSION = '0.3'; | |||||||||
| 17 | |||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||
| 19 | |||||||||||
| 20 | use Bio::DOOP::DOOP; | ||||||||||
| 21 | |||||||||||
| 22 | @list = ("81001020","81001110","81001200","80100006"); | ||||||||||
| 23 | $db = Bio::DOOP::DBSQL->connect("username","passwd","doop-chordate-1_4","localhost"); | ||||||||||
| 24 | $filt = Bio::DOOP::Util::Filt->new_by_list($db,\@list,500); | ||||||||||
| 25 | |||||||||||
| 26 | @res = @{$filt->filt_by_goid("0046872")}; | ||||||||||
| 27 | for(@res){ | ||||||||||
| 28 | print $_->get_cluster_id,"\n"; | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | =head1 DESCRIPTION | ||||||||||
| 32 | |||||||||||
| 33 | This object filters a clusterlist. It is useful to find a smaller cluster set from a | ||||||||||
| 34 | large mofext or fuzznuc search result. | ||||||||||
| 35 | |||||||||||
| 36 | =head1 AUTHORS | ||||||||||
| 37 | |||||||||||
| 38 | Tibor Nagy, Godollo, Hungary and Endre Sebestyen, Martonvasar, Hungary | ||||||||||
| 39 | |||||||||||
| 40 | =head1 METHODS | ||||||||||
| 41 | |||||||||||
| 42 | =head2 new | ||||||||||
| 43 | |||||||||||
| 44 | Creates a new filter object from a cluster object array. | ||||||||||
| 45 | |||||||||||
| 46 | =cut | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 49 | 0 | my $self = {}; | |||||||||
| 50 | 0 | my $dummy = shift; | |||||||||
| 51 | 0 | my $db = shift; | |||||||||
| 52 | 0 | my $clarray = shift; | |||||||||
| 53 | 0 | my $prom = shift; | |||||||||
| 54 | |||||||||||
| 55 | 0 | $self->{CLARRAY} = $clarray; | |||||||||
| 56 | 0 | $self->{DB} = $db; | |||||||||
| 57 | 0 | $self->{PROM} = $prom; | |||||||||
| 58 | |||||||||||
| 59 | 0 | bless $self; | |||||||||
| 60 | 0 | return($self); | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | =head2 new_by_list | ||||||||||
| 64 | |||||||||||
| 65 | Creates a new filter class from a cluster id array. | ||||||||||
| 66 | |||||||||||
| 67 | =cut | ||||||||||
| 68 | |||||||||||
| 69 | 0 | ▶ | sub new_by_list { | ||||||||
|
Subroutine
new_by_list: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 70 | 0 | my $self = {}; | |||||||||
| 71 | 0 | my $dummy = shift; | |||||||||
| 72 | 0 | my $db = shift; | |||||||||
| 73 | 0 | my $clarray_id = shift; | |||||||||
| 74 | 0 | my $prom = shift; | |||||||||
| 75 | 0 | my @clarray; | |||||||||
| 76 | |||||||||||
| 77 | 0 | for my $id (@{$clarray_id}){ | |||||||||
| 78 | 0 | my $cl = Bio::DOOP::Cluster->new($db,$id,$prom); | |||||||||
| 79 | 0 | ▶ | if ($cl == -1){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 0 | next; | |||||||||
| 81 | } | ||||||||||
| 82 | 0 | push @clarray,$cl; | |||||||||
| 83 | } | ||||||||||
| 84 | |||||||||||
| 85 | 0 | $self->{CLARRAY} = \@clarray; | |||||||||
| 86 | 0 | $self->{DB} = $db; | |||||||||
| 87 | 0 | $self->{PROM} = $prom; | |||||||||
| 88 | |||||||||||
| 89 | 0 | bless $self; | |||||||||
| 90 | 0 | return($self); | |||||||||
| 91 | } | ||||||||||
| 92 | |||||||||||
| 93 | =head2 new_by_id | ||||||||||
| 94 | |||||||||||
| 95 | Creates a new filter class from a cluster primary id array. | ||||||||||
| 96 | |||||||||||
| 97 | =cut | ||||||||||
| 98 | |||||||||||
| 99 | 0 | ▶ | sub new_by_id { | ||||||||
|
Subroutine
new_by_id: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 100 | 0 | my $self = {}; | |||||||||
| 101 | 0 | my $dummy = shift; | |||||||||
| 102 | 0 | my $db = shift; | |||||||||
| 103 | 0 | my $clarray_id = shift; | |||||||||
| 104 | 0 | my @clarray; | |||||||||
| 105 | |||||||||||
| 106 | 0 | for my $id (@{$clarray_id}){ | |||||||||
| 107 | 0 | my $cl = Bio::DOOP::Cluster->new_by_id($db,$id); | |||||||||
| 108 | 0 | ▶ | if ($cl == -1){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 109 | 0 | next; | |||||||||
| 110 | } | ||||||||||
| 111 | 0 | push @clarray,$cl; | |||||||||
| 112 | } | ||||||||||
| 113 | |||||||||||
| 114 | 0 | $self->{CLARRAY} = \@clarray; | |||||||||
| 115 | 0 | $self->{DB} = $db; | |||||||||
| 116 | |||||||||||
| 117 | 0 | bless $self; | |||||||||
| 118 | 0 | return($self); | |||||||||
| 119 | } | ||||||||||
| 120 | |||||||||||
| 121 | =head2 filt_by_goid | ||||||||||
| 122 | |||||||||||
| 123 | Filter the cluster list by GO ids. | ||||||||||
| 124 | |||||||||||
| 125 | @filtered = @{$filt->filt_by_goid("0006523")}; | ||||||||||
| 126 | |||||||||||
| 127 | =cut | ||||||||||
| 128 | |||||||||||
| 129 | 0 | ▶ | sub filt_by_goid { | ||||||||
|
Subroutine
filt_by_goid: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||
| 130 | 0 | my $self = shift; | |||||||||
| 131 | 0 | my $goid = shift; | |||||||||
| 132 | |||||||||||
| 133 | 0 | my @cl = @{$self->{CLARRAY}}; | |||||||||
| 134 | 0 | my @ret; | |||||||||
| 135 | |||||||||||
| 136 | 0 | CLUSTER:for my $cl (@cl){ | |||||||||
| 137 | 0 | my @seqs = @{$cl->get_all_seqs}; | |||||||||
| 138 | 0 | for my $seq (@seqs){ | |||||||||
| 139 | 0 | my $goids = $seq->get_xref_value("go_id"); | |||||||||
| 140 | 0 | ▶ | if ($goids == -1){next} | ||||||||
|
Branch: 1 branch
| |||||||||||
| 141 | 0 | for my $id (@{$goids}){ | |||||||||
| 142 | 0 | ▶ | if ($id eq $goid){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 143 | 0 | push @ret,$cl; | |||||||||
| 144 | 0 | next CLUSTER; | |||||||||
| 145 | } | ||||||||||
| 146 | } | ||||||||||
| 147 | } | ||||||||||
| 148 | } | ||||||||||
| 149 | |||||||||||
| 150 | 0 | return(\@ret); | |||||||||
| 151 | } | ||||||||||
| 152 | |||||||||||
| 153 | 2 | 1; | |||||||||