line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
2
|
|
|
|
|
|
|
package Bio::Sketch; |
3
|
1
|
|
|
1
|
|
575
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
386
|
use Class::Interface qw/interface/; |
|
1
|
|
|
|
|
1556
|
|
|
1
|
|
|
|
|
100
|
|
6
|
|
|
|
|
|
|
&interface; # this actually declares the interface |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Note for developers who read source code: I am open to collaboration. |
9
|
|
|
|
|
|
|
# Wishlist: |
10
|
|
|
|
|
|
|
# * Integration to the BioPerl project |
11
|
|
|
|
|
|
|
# * Other Sketch software implementation, e.g., Finch |
12
|
|
|
|
|
|
|
# * Ability to write different formats |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 0.3; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=pod |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Sketch interface module |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=over |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=back |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
An interface module for Sketches, e.g., Mash |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use strict; |
31
|
|
|
|
|
|
|
use warnings; |
32
|
|
|
|
|
|
|
use Bio::Sketch::Mash; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Produce a sketch file file.fastq.gz.msh |
35
|
|
|
|
|
|
|
system("mash sketch file.fastq.gz"); |
36
|
|
|
|
|
|
|
# Read the sketch |
37
|
|
|
|
|
|
|
my $sketch = Bio::Sketch::Mash->new("file.fastq.gz.msh"); |
38
|
|
|
|
|
|
|
$sketch->writeJson("file.fastq.gz.json"); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=back |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=pod |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=over |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item Bio::Sketch->new("file.msh", \%options); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Create a new Sketch instance. One object per file. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Arguments: Sketch filename |
55
|
|
|
|
|
|
|
Hash of options |
56
|
|
|
|
|
|
|
Returns: Sketch object |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=back |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
0
|
1
|
|
sub new{}; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=pod |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=over |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item $sketch->sketch("file.fastq.gz"); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Sketch a raw reads or assembly file |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Arguments: Filename |
73
|
|
|
|
|
|
|
Returns: 1 for success or 0 for failure |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
0
|
1
|
|
sub sketch{;}; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item $sketch->dist($other); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Find the distance between two sketches |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Arguments: Bio::Sketch object |
90
|
|
|
|
|
|
|
Returns: Distance in a float |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=back |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
0
|
1
|
|
sub dist{;}; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=pod |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=over |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item $sketch->paste([$other, $other2...]); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Merge two sketches |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Arguments: List of Bio::Sketch objects |
107
|
|
|
|
|
|
|
Returns: Bio::Sketch object of merged sketches |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=back |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
0
|
1
|
|
sub paste{;}; |
114
|
|
|
|
|
|
|
|