| 1 | package App::Dazz::Command::group; | ||||||||||||||||||||||||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use autodie; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use App::Dazz -command; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 11 | ▶ | use App::Dazz::Common; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use constant abstract => "group anchors by long reads"; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | sub opt_spec { | ||||||||||||||||||||||||||||||
|
Subroutine
opt_spec: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 12 | return ( | ||||||||||||||||||||||||||||||||
| 13 | 4 | [ "dir|d=s", "output directory", ], | |||||||||||||||||||||||||||||||
| 14 | [ "range|r=s", "ranges of anchors", { required => 1 }, ], | ||||||||||||||||||||||||||||||||
| 15 | [ "coverage|c=i", "minimal coverage", { default => 2 }, ], | ||||||||||||||||||||||||||||||||
| 16 | [ "max=i", "max distance", { default => 5000 }, ], | ||||||||||||||||||||||||||||||||
| 17 | [ "len|l=i", "minimal length of overlaps", { default => 1000 }, ], | ||||||||||||||||||||||||||||||||
| 18 | [ "idt|i=f", "minimal identity of overlaps", { default => 0.85 }, ], | ||||||||||||||||||||||||||||||||
| 19 | [ "keep", "don't remove multi-matched reads", ], | ||||||||||||||||||||||||||||||||
| 20 | [ 'oa=s', 'overlaps between anchors', ], | ||||||||||||||||||||||||||||||||
| 21 | [ "parallel|p=i", "number of threads", { default => 4 }, ], | ||||||||||||||||||||||||||||||||
| 22 | [ "verbose|v", "verbose mode", ], | ||||||||||||||||||||||||||||||||
| 23 | [ "png", "write a png file via graphviz", ], | ||||||||||||||||||||||||||||||||
| 24 | { show_defaults => 1, } | ||||||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | # 三代 reads 里有一个常见的错误, 即单一 ZMW 里的测序结果中, 接头序列部分的测序结果出现了较多的错误, | ||||||||||||||||||||||||||||||||
| 30 | # 因此并没有将接头序列去除干净, 形成的 subreads 里含有多份基因组上同一片段, 它们之间以接头序列为间隔. | ||||||||||||||||||||||||||||||||
| 31 | # | ||||||||||||||||||||||||||||||||
| 32 | # `dazz group` 命令默认会将这种三代的 reads 去除. `--keep` 选项会留下这种 reads, 这适用于组装好的三代序列. | ||||||||||||||||||||||||||||||||
| 33 | # | ||||||||||||||||||||||||||||||||
| 34 | # ```text | ||||||||||||||||||||||||||||||||
| 35 | # === | ||||||||||||||||||||||||||||||||
| 36 | # ------------> | ||||||||||||||||||||||||||||||||
| 37 | # ) | ||||||||||||||||||||||||||||||||
| 38 | # <---------- | ||||||||||||||||||||||||||||||||
| 39 | # === | ||||||||||||||||||||||||||||||||
| 40 | # ``` | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | 4 | ▶ | sub usage_desc { | ||||||||||||||||||||||||||||||
|
Subroutine
usage_desc: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 43 | 4 | return "dazz group [options] <dazz DB> <ovlp file>"; | |||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub description { | ||||||||||||||||||||||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 47 | 0 | my $desc; | |||||||||||||||||||||||||||||||
| 48 | 0 | $desc .= ucfirst(abstract) . ".\n"; | |||||||||||||||||||||||||||||||
| 49 | 0 | $desc .= "\tThis command relies on an existing dazz db.\n"; | |||||||||||||||||||||||||||||||
| 50 | 0 | return $desc; | |||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 4 | ▶ | sub validate_args { | ||||||||||||||||||||||||||||||
|
Subroutine
validate_args: called CC=9 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 54 | 4 | my ( $self, $opt, $args ) = @_; | |||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 4 | ▶ | if ( @{$args} != 2 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 57 | 2 | my $message = "This command need one or more input files.\n\tIt found"; | |||||||||||||||||||||||||||||||
| 58 | 2 | $message .= sprintf " [%s]", $_ for @{$args}; | |||||||||||||||||||||||||||||||
| 59 | 2 | $message .= ".\n"; | |||||||||||||||||||||||||||||||
| 60 | 2 | $self->usage_error($message); | |||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||
| 62 | 2 | for ( @{$args} ) { | |||||||||||||||||||||||||||||||
| 63 | 2 | ▶ | if ( !Path::Tiny::path($_)->is_file ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 64 | 2 | $self->usage_error("The input file [$_] doesn't exist."); | |||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ( !AlignDB::IntSpan->valid( $opt->{range} ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 69 | 0 | $self->usage_error("Invalid --range [$opt->{range}]\n"); | |||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ( $opt->{oa} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ( !Path::Tiny::path( $opt->{oa} )->is_file ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 74 | 0 | $self->usage_error("The overlap file [$opt->{oa}] doesn't exist.\n"); | |||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if ( !exists $opt->{dir} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 79 | $opt->{dir} | ||||||||||||||||||||||||||||||||
| 80 | 0 | = Path::Tiny::path( $args->[0] )->parent->child("group")->absolute->stringify; | |||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=61 SCAR=82.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 85 | 0 | my ( $self, $opt, $args ) = @_; | |||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | #@type Path::Tiny | ||||||||||||||||||||||||||||||||
| 88 | 0 | my $out_dir = Path::Tiny::path( $opt->{dir} ); | |||||||||||||||||||||||||||||||
| 89 | 0 | $out_dir->mkpath(); | |||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | # absolute paths before we chdir to $out_dir | ||||||||||||||||||||||||||||||||
| 92 | 0 | my $fn_dazz = Path::Tiny::path( $args->[0] )->absolute->stringify; | |||||||||||||||||||||||||||||||
| 93 | 0 | my $fn_ovlp = Path::Tiny::path( $args->[1] )->absolute->stringify; | |||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | #@type AlignDB::IntSpan | ||||||||||||||||||||||||||||||||
| 96 | 0 | my $anchor_range = AlignDB::IntSpan->new->add_runlist( $opt->{range} ); | |||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 99 | # Load overlaps and build links | ||||||||||||||||||||||||||||||||
| 100 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | # Anchors may match to multiple parts of a long read. | ||||||||||||||||||||||||||||||||
| 103 | # Multi-matched overlapps would create cyclic paths and ruin the graph. | ||||||||||||||||||||||||||||||||
| 104 | # Some of these matchs are real, but more are false positives. | ||||||||||||||||||||||||||||||||
| 105 | # If sequences from a ZMW are not splitted into subreads properly, then a multi-matched overlap | ||||||||||||||||||||||||||||||||
| 106 | # is identified. | ||||||||||||||||||||||||||||||||
| 107 | # === | ||||||||||||||||||||||||||||||||
| 108 | # ------------> | ||||||||||||||||||||||||||||||||
| 109 | # ) | ||||||||||||||||||||||||||||||||
| 110 | # <---------- | ||||||||||||||||||||||||||||||||
| 111 | # === | ||||||||||||||||||||||||||||||||
| 112 | 0 | my $multi_matched = AlignDB::IntSpan->new; # long_id | |||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | 0 | my $links_of = {}; # long_id => { anchor_id => overlap_on_long, } | |||||||||||||||||||||||||||||||
| 115 | 0 | my $strands_of = {}; # long_id => { anchor_id => strand_to_long } | |||||||||||||||||||||||||||||||
| 116 | { | ||||||||||||||||||||||||||||||||
| 117 | 0 | open my $in_fh, "<", $fn_ovlp; | |||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||
| 119 | 0 | my %multi_match_of; | |||||||||||||||||||||||||||||||
| 120 | my %seen_pair; | ||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | while ( my $line = <$in_fh> ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 123 | 0 | chomp $line; | |||||||||||||||||||||||||||||||
| 124 | 0 | my @fields = split "\t", $line; | |||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | next unless @fields == 13; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||
| 127 | 0 | my ( $f_id, $g_id, $ovlp_len, $ovlp_idt ) = @fields[ 0 .. 3 ]; | |||||||||||||||||||||||||||||||
| 128 | 0 | my ( $f_strand, $f_B, $f_E, $f_len ) = @fields[ 4 .. 7 ]; | |||||||||||||||||||||||||||||||
| 129 | 0 | my ( $g_strand, $g_B, $g_E, $g_len ) = @fields[ 8 .. 11 ]; | |||||||||||||||||||||||||||||||
| 130 | 0 | my $contained = $fields[12]; | |||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | # ignore self overlapping | ||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | next if $f_id eq $g_id; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||
| 135 | # ignore poor overlaps | ||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | next if $ovlp_idt < $opt->{idt}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | next if $ovlp_len < $opt->{len}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||
| 139 | # only want anchor-long overlaps | ||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | if ( $anchor_range->contains($f_id) and $anchor_range->contains($g_id) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$anchor_range->contains($f_id) and $anchor_range->contains($g_id)
MC/DC0%0/2
$anchor_range->contains($f_id) and $anchor_range->contains($g_id)
$anchor_range->contains($f_id)
$anchor_range->contains($g_id)
Truth table0%0/3
A and B
A= $anchor_range->contains($f_id)B= $anchor_range->contains($g_id)
| |||||||||||||||||||||||||||||||||
| 141 | 0 | next; | |||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ( !$anchor_range->contains($f_id) and !$anchor_range->contains($g_id) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$anchor_range->contains($f_id) or $anchor_range->contains($g_id)
MC/DC0%0/2
$anchor_range->contains($f_id) or $anchor_range->contains($g_id)
$anchor_range->contains($f_id)
$anchor_range->contains($g_id)
Truth table0%0/3
A or B
A= $anchor_range->contains($f_id)B= $anchor_range->contains($g_id)
| |||||||||||||||||||||||||||||||||
| 144 | 0 | next; | |||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||
| 147 | # record multi-matched | ||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if ( $anchor_range->contains($f_id) and !$anchor_range->contains($g_id) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$anchor_range->contains($f_id) and not $anchor_range->contains($g_id)
MC/DC0%0/2
$anchor_range->contains($f_id) and not $anchor_range->contains($g_id)
$anchor_range->contains($f_id)
not $anchor_range->contains($g_id)
Truth table0%0/3
A and not(B)
A= $anchor_range->contains($f_id)B= not $anchor_range->contains($g_id)
| |||||||||||||||||||||||||||||||||
| 149 | 0 | my $pair = join( "-", ( $f_id, $g_id ) ); | |||||||||||||||||||||||||||||||
| 150 | 0 | my $matched | |||||||||||||||||||||||||||||||
| 151 | = AlignDB::IntSpan->new->add_pair( App::Dazz::Common::beg_end( $g_B, $g_E, ) ); | ||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if ( !exists $multi_match_of{$pair} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 153 | 0 | $multi_match_of{$pair} = $matched; | |||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||
| 155 | else { | ||||||||||||||||||||||||||||||||
| 156 | 0 | my $i_set = $matched->intersect( $multi_match_of{$pair} ); | |||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | if ( $i_set->is_empty ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 158 | 0 | $multi_matched->add($g_id); | |||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||
| 160 | elsif ( $i_set->size | ||||||||||||||||||||||||||||||||
| 161 | / List::Util::max( $matched->size, $multi_match_of{$pair}->size ) < 0.9 ) | ||||||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||||||
| 163 | 0 | $multi_matched->add($g_id); | |||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||
| 168 | { # skip duplicated overlaps | ||||||||||||||||||||||||||||||||
| 169 | 0 | my $pair = join( "-", sort ( $f_id, $g_id ) ); | |||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | next if $seen_pair{$pair}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 171 | 0 | $seen_pair{$pair}++; | |||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if ( $anchor_range->contains($f_id) and !$anchor_range->contains($g_id) ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$anchor_range->contains($f_id) and not $anchor_range->contains($g_id)
MC/DC0%0/2
$anchor_range->contains($f_id) and not $anchor_range->contains($g_id)
$anchor_range->contains($f_id)
not $anchor_range->contains($g_id)
Truth table0%0/3
A and not(B)
A= $anchor_range->contains($f_id)B= not $anchor_range->contains($g_id)
| |||||||||||||||||||||||||||||||||
| 175 | 0 | my ( $beg, $end ) = App::Dazz::Common::beg_end( $g_B, $g_E, ); | |||||||||||||||||||||||||||||||
| 176 | 0 | $links_of->{$g_id}{$f_id} = AlignDB::IntSpan->new->add_pair( $beg, $end ); | |||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||
| 178 | # $f_strand is always 0 | ||||||||||||||||||||||||||||||||
| 179 | 0 | $strands_of->{$g_id}{$f_id} = $g_strand; | |||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||
| 181 | ▶ | elsif ( $anchor_range->contains($g_id) and !$anchor_range->contains($f_id) ) { | |||||||||||||||||||||||||||||||
|
Condition0%0/3
$anchor_range->contains($g_id) and not $anchor_range->contains($f_id)
MC/DC0%0/2
$anchor_range->contains($g_id) and not $anchor_range->contains($f_id)
$anchor_range->contains($g_id)
not $anchor_range->contains($f_id)
Truth table0%0/3
A and not(B)
A= $anchor_range->contains($g_id)B= not $anchor_range->contains($f_id)
| |||||||||||||||||||||||||||||||||
| 182 | 0 | my ( $beg, $end ) = App::Dazz::Common::beg_end( $f_B, $f_E, ); | |||||||||||||||||||||||||||||||
| 183 | 0 | $links_of->{$f_id}{$g_id} = AlignDB::IntSpan->new->add_pair( $beg, $end ); | |||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||
| 185 | 0 | $strands_of->{$f_id}{$g_id} = $g_strand; | |||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||
| 188 | 0 | close $in_fh; | |||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ( !$opt->{keep} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 192 | 0 | for my $long_id ( $multi_matched->as_array ) { | |||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ( exists $links_of->{$long_id} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 194 | 0 | delete $links_of->{$long_id}; | |||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ( exists $strands_of->{$long_id} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 197 | 0 | delete $strands_of->{$long_id}; | |||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||
| 202 | 0 | my $graph = Graph->new( directed => 0 ); | |||||||||||||||||||||||||||||||
| 203 | 0 | for my $serial ( $anchor_range->as_array ) { | |||||||||||||||||||||||||||||||
| 204 | 0 | $graph->add_vertex($serial); | |||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||
| 206 | { # Grouping | ||||||||||||||||||||||||||||||||
| 207 | 0 | for my $long_id ( sort { $a <=> $b } keys %{$links_of} ) { | |||||||||||||||||||||||||||||||
| 208 | 0 | my @anchors = sort { $a <=> $b } | |||||||||||||||||||||||||||||||
| 209 | 0 | keys %{ $links_of->{$long_id} }; | |||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | 0 | my $count = scalar @anchors; | |||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||
| 213 | # long reads overlapped with 2 or more anchors will participate in distances judgment | ||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | next unless $count >= 2; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||
| 216 | 0 | for my $i ( 0 .. $count - 1 ) { | |||||||||||||||||||||||||||||||
| 217 | 0 | for my $j ( $i + 1 .. $count - 1 ) { | |||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||
| 219 | #@type AlignDB::IntSpan | ||||||||||||||||||||||||||||||||
| 220 | 0 | my $set_i = $links_of->{$long_id}{ $anchors[$i] }; | |||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | next unless ref $set_i eq "AlignDB::IntSpan"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | next if $set_i->is_empty; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||
| 224 | #@type AlignDB::IntSpan | ||||||||||||||||||||||||||||||||
| 225 | 0 | my $set_j = $links_of->{$long_id}{ $anchors[$j] }; | |||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | next unless ref $set_j eq "AlignDB::IntSpan"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | next if $set_j->is_empty; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||
| 229 | 0 | my $distance = $set_i->distance($set_j); | |||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | next unless defined $distance; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||
| 232 | 0 | my $strand_i = $strands_of->{$long_id}{ $anchors[$i] }; | |||||||||||||||||||||||||||||||
| 233 | 0 | my $strand_j = $strands_of->{$long_id}{ $anchors[$j] }; | |||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | my $strand = $strand_i == $strand_j ? 0 : 1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||
| 237 | 0 | $graph->add_edge( $anchors[$i], $anchors[$j] ); | |||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||
| 239 | # long_ids | ||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ( $graph->has_edge_attribute( $anchors[$i], $anchors[$j], "long_ids" ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 241 | 0 | my $long_ids_ref | |||||||||||||||||||||||||||||||
| 242 | = $graph->get_edge_attribute( $anchors[$i], $anchors[$j], "long_ids" ); | ||||||||||||||||||||||||||||||||
| 243 | 0 | push @{$long_ids_ref}, $long_id; | |||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||
| 245 | else { | ||||||||||||||||||||||||||||||||
| 246 | 0 | $graph->set_edge_attribute( $anchors[$i], $anchors[$j], "long_ids", | |||||||||||||||||||||||||||||||
| 247 | [$long_id], ); | ||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||
| 250 | # distances between anchors | ||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ( $graph->has_edge_attribute( $anchors[$i], $anchors[$j], "distances" ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 252 | 0 | my $distances_ref | |||||||||||||||||||||||||||||||
| 253 | = $graph->get_edge_attribute( $anchors[$i], $anchors[$j], "distances" ); | ||||||||||||||||||||||||||||||||
| 254 | 0 | push @{$distances_ref}, $distance; | |||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||
| 256 | else { | ||||||||||||||||||||||||||||||||
| 257 | 0 | $graph->set_edge_attribute( $anchors[$i], $anchors[$j], "distances", | |||||||||||||||||||||||||||||||
| 258 | [$distance], ); | ||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||
| 261 | # strands | ||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if ( $graph->has_edge_attribute( $anchors[$i], $anchors[$j], "strands" ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 263 | 0 | my $strands_ref | |||||||||||||||||||||||||||||||
| 264 | = $graph->get_edge_attribute( $anchors[$i], $anchors[$j], "strands" ); | ||||||||||||||||||||||||||||||||
| 265 | 0 | push @{$strands_ref}, $strand; | |||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||
| 267 | else { | ||||||||||||||||||||||||||||||||
| 268 | 0 | $graph->set_edge_attribute( $anchors[$i], $anchors[$j], "strands", | |||||||||||||||||||||||||||||||
| 269 | [$strand], ); | ||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||
| 275 | # overlaps between anchors | ||||||||||||||||||||||||||||||||
| 276 | 0 | my $anchor_ovlp_of = {}; | |||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | if ( $opt->{oa} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 278 | 0 | open my $in_fh, "<", $opt->{oa}; | |||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | while ( my $line = <$in_fh> ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 281 | 0 | my $info = App::Dazz::Common::parse_ovlp_line($line); | |||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||
| 283 | # ignore self overlapping | ||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | next if $info->{f_id} eq $info->{g_id}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||
| 286 | 0 | my $pair = join( "-", sort ( $info->{f_id}, $info->{g_id} ) ); | |||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||
| 288 | 0 | $anchor_ovlp_of->{$pair} = $info; | |||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||
| 290 | 0 | close $in_fh; | |||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||
| 293 | # Delete unreliable edges | ||||||||||||||||||||||||||||||||
| 294 | 0 | for my $edge ( $graph->edges ) { | |||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||
| 296 | # if enough long reads support overlaps between anchors, ignore other long reads | ||||||||||||||||||||||||||||||||
| 297 | 0 | my $pair = join( "-", sort ( @{$edge} ) ); | |||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | if ( exists $anchor_ovlp_of->{$pair} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 299 | 0 | my $d_ref = $graph->get_edge_attribute( @{$edge}, "distances" ); | |||||||||||||||||||||||||||||||
| 300 | 0 | my @indexes = grep { $d_ref->[$_] < 0 } ( 0 .. scalar @{$d_ref} - 1 ); | |||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | if ( @indexes >= $opt->{coverage} and ( @indexes / @{$d_ref} ) >= 0.6 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@indexes >= $opt->{"coverage"} and @indexes / @{$d_ref;} >= "0.6"
MC/DC0%0/2
@indexes >= $opt->{"coverage"} and @indexes / @{$d_ref;} >= "0.6"
@indexes >= $opt->{"coverage"}
@indexes / @{$d_ref;} >= "0.6"
Truth table0%0/3
A and B
A= @indexes >= $opt->{"coverage"}B= @indexes / @{$d_ref;} >= "0.6"
| |||||||||||||||||||||||||||||||||
| 303 | 0 | my $id_ref = $graph->get_edge_attribute( @{$edge}, "long_ids" ); | |||||||||||||||||||||||||||||||
| 304 | 0 | my $strand_ref = $graph->get_edge_attribute( @{$edge}, "strands" ); | |||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||
| 306 | # distances are negative | ||||||||||||||||||||||||||||||||
| 307 | 0 | my ( @new_d, @new_id, @new_strand ); | |||||||||||||||||||||||||||||||
| 308 | 0 | for my $i (@indexes) { | |||||||||||||||||||||||||||||||
| 309 | 0 | push @new_d, $d_ref->[$i]; | |||||||||||||||||||||||||||||||
| 310 | 0 | push @new_id, $id_ref->[$i]; | |||||||||||||||||||||||||||||||
| 311 | 0 | push @new_strand, $strand_ref->[$i]; | |||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||
| 314 | 0 | $graph->set_edge_attribute( @{$edge}, "distances", \@new_d ); | |||||||||||||||||||||||||||||||
| 315 | 0 | $graph->set_edge_attribute( @{$edge}, "long_ids", \@new_id ); | |||||||||||||||||||||||||||||||
| 316 | 0 | $graph->set_edge_attribute( @{$edge}, "strands", \@new_strand ); | |||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||
| 320 | # numbers of long reads less than $opt->{coverage} | ||||||||||||||||||||||||||||||||
| 321 | 0 | my $long_ids_ref = $graph->get_edge_attribute( @{$edge}, "long_ids" ); | |||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | if ( scalar @{$long_ids_ref} < $opt->{coverage} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 323 | 0 | $graph->delete_edge( @{$edge} ); | |||||||||||||||||||||||||||||||
| 324 | 0 | next; | |||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | # non-consistent distances | ||||||||||||||||||||||||||||||||
| 328 | 0 | my $distances_ref = $graph->get_edge_attribute( @{$edge}, "distances" ); | |||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | if ( !App::Dazz::Common::judge_distance( $distances_ref, $opt->{max}, ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 330 | 0 | $graph->delete_edge( @{$edge} ); | |||||||||||||||||||||||||||||||
| 331 | 0 | next; | |||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||
| 334 | # non-consistent strands | ||||||||||||||||||||||||||||||||
| 335 | 0 | my $strands_ref = $graph->get_edge_attribute( @{$edge}, "strands" ); | |||||||||||||||||||||||||||||||
| 336 | 0 | my @strands = App::Fasops::Common::uniq( @{$strands_ref} ); | |||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if ( @strands != 1 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 338 | 0 | $graph->delete_edge( @{$edge} ); | |||||||||||||||||||||||||||||||
| 339 | 0 | next; | |||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||
| 344 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 345 | # Outputs | ||||||||||||||||||||||||||||||||
| 346 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 347 | 0 | my @ccs = $graph->connected_components(); | |||||||||||||||||||||||||||||||
| 348 | 0 | my $non_grouped = AlignDB::IntSpan->new; | |||||||||||||||||||||||||||||||
| 349 | 0 | for my $cc ( grep { scalar @{$_} == 1 } @ccs ) { | |||||||||||||||||||||||||||||||
| 350 | 0 | $non_grouped->add( $cc->[0] ); | |||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | if ( !$non_grouped->is_empty ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 354 | 0 | printf STDERR "Non-grouped: %s\n", $non_grouped; | |||||||||||||||||||||||||||||||
| 355 | 0 | printf STDERR "Count: %d/%d\n", $non_grouped->size, $anchor_range->size; | |||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||
| 357 | 0 | my $cmd; | |||||||||||||||||||||||||||||||
| 358 | 0 | $cmd .= "DBshow -U $fn_dazz "; | |||||||||||||||||||||||||||||||
| 359 | 0 | $cmd .= join " ", $non_grouped->as_array; | |||||||||||||||||||||||||||||||
| 360 | 0 | $cmd .= " | faops filter -l 0 stdin stdout"; | |||||||||||||||||||||||||||||||
| 361 | 0 | $cmd .= " > " . $out_dir->child("non_grouped.fasta")->stringify; | |||||||||||||||||||||||||||||||
| 362 | 0 | App::Dazz::Common::exec_cmd( $cmd, { verbose => $opt->{verbose}, } ); | |||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||
| 365 | 0 | $out_dir->child("groups.txt")->remove; | |||||||||||||||||||||||||||||||
| 366 | 0 | @ccs = map { $_->[0] } | |||||||||||||||||||||||||||||||
| 367 | 0 | sort { $b->[1] <=> $a->[1] } | |||||||||||||||||||||||||||||||
| 368 | 0 | map { [ $_, scalar( @{$_} ) ] } | |||||||||||||||||||||||||||||||
| 369 | 0 | grep { scalar @{$_} > 1 } @ccs; | |||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||
| 371 | 0 | my $cc_serial = 1; | |||||||||||||||||||||||||||||||
| 372 | 0 | for my $cc (@ccs) { | |||||||||||||||||||||||||||||||
| 373 | 0 | my @members = sort { $a <=> $b } @{$cc}; | |||||||||||||||||||||||||||||||
| 374 | 0 | my $count = scalar @members; | |||||||||||||||||||||||||||||||
| 375 | 0 | my $basename = sprintf "%s_%s", $cc_serial, $count; | |||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||
| 377 | 0 | $out_dir->child("groups.txt")->append("$basename\n"); | |||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||
| 379 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 380 | # anchors | ||||||||||||||||||||||||||||||||
| 381 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | if ( $count > 0 ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 383 | 0 | my $cmd; | |||||||||||||||||||||||||||||||
| 384 | 0 | $cmd .= "DBshow -U $fn_dazz "; | |||||||||||||||||||||||||||||||
| 385 | 0 | $cmd .= join " ", @members; | |||||||||||||||||||||||||||||||
| 386 | 0 | $cmd .= " | faops filter -l 0 stdin stdout"; | |||||||||||||||||||||||||||||||
| 387 | 0 | $cmd .= " > " . $out_dir->child("$basename.anchor.fasta")->stringify; | |||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||
| 389 | 0 | system $cmd; | |||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||
| 392 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 393 | # distances and long reads | ||||||||||||||||||||||||||||||||
| 394 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 395 | 0 | my $long_id_set = AlignDB::IntSpan->new; | |||||||||||||||||||||||||||||||
| 396 | { | ||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||
| 398 | # anchor_i => anchor_j => [[distances], [long_ids]] | ||||||||||||||||||||||||||||||||
| 399 | 0 | my $relation_of = {}; | |||||||||||||||||||||||||||||||
| 400 | 0 | my @anchor_long_pairs; | |||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||
| 402 | 0 | for my $i ( 0 .. $count - 1 ) { | |||||||||||||||||||||||||||||||
| 403 | 0 | for my $j ( $i + 1 .. $count - 1 ) { | |||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | if ( $graph->has_edge( $members[$i], $members[$j], ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 405 | 0 | my $distances_ref | |||||||||||||||||||||||||||||||
| 406 | = $graph->get_edge_attribute( $members[$i], $members[$j], "distances" ); | ||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||
| 408 | 0 | my $long_ids_ref | |||||||||||||||||||||||||||||||
| 409 | = $graph->get_edge_attribute( $members[$i], $members[$j], "long_ids" ); | ||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||
| 411 | 0 | $long_id_set->add( @{$long_ids_ref} ); | |||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||
| 413 | 0 | $relation_of->{ $members[$i] }{ $members[$j] } | |||||||||||||||||||||||||||||||
| 414 | = [ $distances_ref, $long_ids_ref ]; | ||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||
| 416 | 0 | for my $long_id ( @{$long_ids_ref} ) { | |||||||||||||||||||||||||||||||
| 417 | 0 | push @anchor_long_pairs, [ $members[$i], $long_id ]; | |||||||||||||||||||||||||||||||
| 418 | 0 | push @anchor_long_pairs, [ $members[$j], $long_id ]; | |||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||
| 424 | # serials to names | ||||||||||||||||||||||||||||||||
| 425 | 0 | my $name_of | |||||||||||||||||||||||||||||||
| 426 | = App::Dazz::Common::serial2name( $fn_dazz, [ @members, $long_id_set->as_array ] ); | ||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||
| 428 | 0 | my $fn_relation = $out_dir->child("$basename.relation.tsv"); | |||||||||||||||||||||||||||||||
| 429 | 0 | $fn_relation->remove; | |||||||||||||||||||||||||||||||
| 430 | 0 | for my $key_i ( sort keys %{$relation_of} ) { | |||||||||||||||||||||||||||||||
| 431 | 0 | for my $key_j ( sort keys %{ $relation_of->{$key_i} } ) { | |||||||||||||||||||||||||||||||
| 432 | 0 | my $str_dis = join( ",", @{ $relation_of->{$key_i}{$key_j}[0] } ); | |||||||||||||||||||||||||||||||
| 433 | my $str_long = join( ",", | ||||||||||||||||||||||||||||||||
| 434 | 0 | map { $name_of->{$_} } @{ $relation_of->{$key_i}{$key_j}[1] } ); | |||||||||||||||||||||||||||||||
| 435 | my $line = sprintf "%s\t%s\t%s\t%s\n", $name_of->{$key_i}, | ||||||||||||||||||||||||||||||||
| 436 | 0 | $name_of->{$key_j}, $str_dis, $str_long; | |||||||||||||||||||||||||||||||
| 437 | 0 | $fn_relation->append($line); | |||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||
| 441 | @anchor_long_pairs = sort | ||||||||||||||||||||||||||||||||
| 442 | 0 | map { sprintf( "%s\t%s\n", $name_of->{ $_->[0] }, $name_of->{ $_->[1] } ) } | |||||||||||||||||||||||||||||||
| 443 | @anchor_long_pairs; | ||||||||||||||||||||||||||||||||
| 444 | 0 | @anchor_long_pairs = App::Fasops::Common::uniq(@anchor_long_pairs); | |||||||||||||||||||||||||||||||
| 445 | 0 | $out_dir->child("$basename.restrict.tsv")->spew(@anchor_long_pairs); | |||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||
| 448 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 449 | # long reads | ||||||||||||||||||||||||||||||||
| 450 | #----------------------------# | ||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | if ( !$long_id_set->is_empty ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 452 | 0 | my $cmd; | |||||||||||||||||||||||||||||||
| 453 | 0 | $cmd .= "DBshow -U $fn_dazz "; | |||||||||||||||||||||||||||||||
| 454 | 0 | $cmd .= join " ", $long_id_set->as_array; | |||||||||||||||||||||||||||||||
| 455 | 0 | $cmd .= " | faops filter -l 0 stdin stdout"; | |||||||||||||||||||||||||||||||
| 456 | 0 | $cmd .= " > " . $out_dir->child("$basename.long.fasta")->stringify; | |||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||
| 458 | 0 | system $cmd; | |||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||
| 461 | 0 | $cc_serial++; | |||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||
| 463 | 0 | printf STDERR "CC count %d\n", scalar(@ccs); | |||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | if ( $opt->{png} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 466 | 0 | App::Dazz::Common::g2gv0( $graph, $fn_dazz . ".png" ); | |||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||
| 470 | 11 | 1; | |||||||||||||||||||||||||||||||