line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::MLST::FilterAlleles; |
2
|
|
|
|
|
|
|
# ABSTRACT: Filter Alleles |
3
|
|
|
|
|
|
|
$Bio::MLST::FilterAlleles::VERSION = '2.1.1630910'; |
4
|
|
|
|
|
|
|
|
5
|
14
|
|
|
14
|
|
162585
|
use strict; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
500
|
|
6
|
14
|
|
|
14
|
|
74
|
use warnings; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
516
|
|
7
|
|
|
|
|
|
|
|
8
|
14
|
|
|
14
|
|
60
|
use Exporter qw(import); |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
3030
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(only_keep_alleles is_metadata); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# A list of column headings in a profile file which |
12
|
|
|
|
|
|
|
# can be assumed not to be allele names. If this list |
13
|
|
|
|
|
|
|
# gets much longer we should have a rethink about |
14
|
|
|
|
|
|
|
# getting a whitelist of alleles either based on the |
15
|
|
|
|
|
|
|
# contents of the alleles directory or from the |
16
|
|
|
|
|
|
|
# config file downloaded from the internet. |
17
|
|
|
|
|
|
|
my @allele_blacklist = ( |
18
|
|
|
|
|
|
|
'CC', |
19
|
|
|
|
|
|
|
'Lineage', |
20
|
|
|
|
|
|
|
'ST', |
21
|
|
|
|
|
|
|
'clonal_complex', |
22
|
|
|
|
|
|
|
'mlst_clade', |
23
|
|
|
|
|
|
|
'species' |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub is_metadata |
27
|
|
|
|
|
|
|
{ |
28
|
354
|
|
|
354
|
0
|
322
|
my ($column_heading) = @_; |
29
|
354
|
50
|
|
|
|
455
|
if(defined($column_heading)) |
30
|
|
|
|
|
|
|
{ |
31
|
354
|
|
|
|
|
4171
|
return grep( /^$column_heading$/, @allele_blacklist ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else |
34
|
|
|
|
|
|
|
{ |
35
|
0
|
|
|
|
|
0
|
return 0; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub only_keep_alleles |
40
|
|
|
|
|
|
|
{ |
41
|
2
|
|
|
2
|
0
|
127
|
my ($alleles) = @_; |
42
|
2
|
|
|
|
|
6
|
my @alleles_to_keep = (); |
43
|
2
|
|
|
|
|
6
|
for my $allele (@$alleles) { |
44
|
5
|
100
|
|
|
|
12
|
push( @alleles_to_keep, $allele ) unless is_metadata($allele); |
45
|
|
|
|
|
|
|
} |
46
|
2
|
|
|
|
|
14
|
return \@alleles_to_keep; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=encoding UTF-8 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Bio::MLST::FilterAlleles - Filter Alleles |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
version 2.1.1630910 |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
FilterAlleles.pm - Filter header row from profile to remove non-alleles |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This software is Copyright (c) 2012 by Wellcome Trust Sanger Institute. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This is free software, licensed under: |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |