| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bio::MLST::FilterAlleles; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: Filter Alleles |
|
3
|
|
|
|
|
|
|
$Bio::MLST::FilterAlleles::VERSION = '2.1.1706216'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
13
|
|
|
13
|
|
83367
|
use strict; |
|
|
13
|
|
|
|
|
17
|
|
|
|
13
|
|
|
|
|
312
|
|
|
6
|
13
|
|
|
13
|
|
45
|
use warnings; |
|
|
13
|
|
|
|
|
11
|
|
|
|
13
|
|
|
|
|
275
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
13
|
|
|
13
|
|
38
|
use Exporter qw(import); |
|
|
13
|
|
|
|
|
13
|
|
|
|
13
|
|
|
|
|
1761
|
|
|
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
|
255
|
my ($column_heading) = @_; |
|
29
|
354
|
50
|
|
|
|
326
|
if(defined($column_heading)) |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
354
|
|
|
|
|
3396
|
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
|
570
|
my ($alleles) = @_; |
|
42
|
2
|
|
|
|
|
3
|
my @alleles_to_keep = (); |
|
43
|
2
|
|
|
|
|
3
|
for my $allele (@$alleles) { |
|
44
|
5
|
100
|
|
|
|
46
|
push( @alleles_to_keep, $allele ) unless is_metadata($allele); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
2
|
|
|
|
|
8
|
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.1706216 |
|
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 |