File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ use Data::Dumper;
20
20
# globals
21
21
22
22
my $EXE = basename($0 );
23
- my $VERSION = " 0.3 .0" ;
23
+ my $VERSION = " 0.4 .0" ;
24
24
my $AUTHOR = ' Torsten Seemann (@torstenseemann)' ;
25
25
my $HOMEPAGE = " https://github.com/tseemann/samclip" ;
26
26
@@ -123,14 +123,17 @@ while (my $line = <ARGV>) {
123
123
my $start = $sam [SAM_POS];
124
124
my $end = $start + length ($sam [SAM_SEQ]) - 1;
125
125
my $contiglen = $len -> {$sam [SAM_RNAME]} or err(" Reference" , $sam [SAM_RNAME], " not in '$ref '" );
126
- msg(" CHROM=$sam [SAM_RNAME]:1-$contiglen POS=$start ..$end CIGAR=$sam [SAM_CIGAR] HL=$HL SL=$SL SR=$SR HR=$HR max=$max )" ) if $debug ;
127
- unless ($start <= 1 or $end >= $contiglen ) {
128
- if ($HL +$SL > $max or $HR +$SR > $max ) {
129
- $removed ++;
130
- next ;
131
- }
126
+ my $L = $HL + $SL ;
127
+ my $R = $HR + $SR ;
128
+ $L = 0 if $start <= 1+$L ;
129
+ $R = 0 if $end >= $contiglen -$R ;
130
+ my $info = $debug ? " CHROM=$sam [SAM_RNAME]:1..$contiglen POS=$start ..$end CIGAR=$sam [SAM_CIGAR] L=$L R=$R | HL=$HL SL=$SL SR=$SR HR=$HR max=$max )" : " need --debug" ;
131
+ if ($L > $max or $R > $max ) {
132
+ msg(" BAD! $info " ) if $debug ;
133
+ $removed ++;
134
+ next ;
132
135
}
133
- msg(" ^^^ KEPT " ) if $debug ;
136
+ msg(" GOOD $info " ) if $debug ;
134
137
# otherwise pass through untouched
135
138
print $line if $invert ;
136
139
$kept ++;
You can’t perform that action at this time.
0 commit comments