line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
2
|
|
|
|
|
|
|
package Bio::Sketch; |
3
|
1
|
|
|
1
|
|
618
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
5
|
1
|
|
|
1
|
|
466
|
use Class::Interface qw/interface/; |
|
1
|
|
|
|
|
1980
|
|
|
1
|
|
|
|
|
126
|
|
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.1; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=pod |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Sketch interface module |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
An interface module for Sketches, e.g., Mash |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use strict; |
27
|
|
|
|
|
|
|
use warnings; |
28
|
|
|
|
|
|
|
use Bio::Sketch::Mash; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Produce a sketch file file.fastq.gz.msh |
31
|
|
|
|
|
|
|
system("mash sketch file.fastq.gz"); |
32
|
|
|
|
|
|
|
# Read the sketch |
33
|
|
|
|
|
|
|
my $sketch = Bio::Sketch::Mash->new("file.fastq.gz.msh"); |
34
|
|
|
|
|
|
|
$sketch->writeJson("file.fastq.gz.json"); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item Bio::Sketch->new("file.msh", \%options); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Create a new Sketch instance. One object per file. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Arguments: Sketch filename |
47
|
|
|
|
|
|
|
Hash of options |
48
|
|
|
|
|
|
|
Returns: Sketch object |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=back |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
1
|
|
sub new{...;}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item $sketch->sketch("file.fastq.gz"); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Sketch a raw reads or assembly file |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Arguments: Filename |
63
|
|
|
|
|
|
|
Returns: 1 for success or 0 for failure |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=back |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
1
|
|
sub sketch{...;}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=pod |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item $sketch->dist($other); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Find the distance between two sketches |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Arguments: Bio::Sketch object |
78
|
|
|
|
|
|
|
Returns: Distance in a float |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=back |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
0
|
1
|
|
sub dist{...;}; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item $sketch->paste([$other, $other2...]); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Merge two sketches |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Arguments: List of Bio::Sketch objects |
93
|
|
|
|
|
|
|
Returns: Bio::Sketch object of merged sketches |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=back |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
1
|
|
sub paste{...;}; |
100
|
|
|
|
|
|
|
|