FastParsers/Uclust.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 97.6% 42 / 43 CC 4 SCAR 9.2
CC
4
Cov
100%
BUILD
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« FastParsers/Hmmer/Table.pm ↑ Summary FastParsers/Hmmer/Standard/Target.pm »
1 package Bio::FastParsers::Uclust;
2 # ABSTRACT: Front-end class for UCLUST parser
3 # CONTRIBUTOR: Amandine BERTRAND <amandine.bertrand@doct.uliege.be>
4 7 $Bio::FastParsers::Uclust::VERSION = '0.221230';
5 7 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 ▶use Tie::IxHash;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 7 extends 'Bio::FastParsers::Base';
13  
14  
15 # public attributes (inherited)
16  
17  
18 7 with 'Bio::FastParsers::Roles::Clusterable';
19  
20  
21 1 ▶sub BUILD {
Subroutine BUILD: called CC=4 SCAR=13.9
Pod undocumented
22 1 my $self = shift;
23  
24 1 my $infile = $self->filename;
25 1 open my $in, '<', $infile;
26  
27 1 tie my %members_for, 'Tie::IxHash';
28  
29 LINE:
30 1 ▶ while (my $line = <$in>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline $in)) 73 1 74
31 73 chomp $line;
32 73 my ($type, @fields) = split /\t/xms, $line;
33  
34 # https://www.drive5.com/usearch/manual/opt_uc.html
35 # Field Description
36 # - Record type S, H, C or N (see table below).
37 # 0 Cluster number (0-based).
38 # 1 Sequence length (S, N and H) or cluster size (C).
39 # 2 For H records, percent identity with target.
40 # 3 For H records, the strand: + or - for nucleotides, . for proteins.
41 # 4 Not used, parsers should ignore this field. Included for backwards compatibility.
42 # 5 Not used, parsers should ignore this field. Included for backwards compatibility.
43 # 6 Compressed alignment or the symbol '=' (equals sign). The = indicates that the query is 100% identical to the target sequence (field 10).
44 # 7 Label of query sequence (always present).
45 # 8 Label of target sequence (H records only).
46  
47 73 ▶ if ($type eq 'C') {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'C') { } 22 51 73
elsif ($type eq 'H') { } 29 22 51
48 22 push @{ $members_for{ $fields[7] } }, ();
49 }
50 elsif ($type eq 'H') {
51 29 push @{ $members_for{ $fields[8] } }, $fields[7];
52 }
53 }
54  
55 # store representative and member sequence ids
56 1 $self->_set_members_for( \%members_for );
57  
58 1 return;
59 }
60  
61 7 __PACKAGE__->meta->make_immutable;
62 7 1;
63  
64 __END__
« FastParsers/Hmmer/Table.pm ↑ Summary FastParsers/Hmmer/Standard/Target.pm »