Skip to content

Commit 2026946

Browse files
committed
Remove remaining references to $Bin .
Thanks @DHatziioanou for reporting.
1 parent 87d64d4 commit 2026946

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

bin/ExtendOrFormatContigs.pl

+28-27
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
my $min_base_ratio = $ARGV[7];
2525
my $max_trim = $ARGV[8];
2626
my $verbose = $ARGV[9];
27-
my $minContigLength = $ARGV[11];
27+
my $minContigLength = $ARGV[11];
2828
my $libraryfile = $ARGV[12];
2929
my $gaps = $ARGV[13];
3030
my $threads = $ARGV[14];
31-
3231

3332
my $log = $base_name . ".logfile.txt";
3433
my $summaryfile = $base_name.".summaryfile.txt";
@@ -39,7 +38,7 @@
3938
my ($bin);
4039
if($extending == 1){
4140

42-
&ExtendContigs($base_name, $filecontig, $filenameOutExt, $Bin);
41+
&ExtendContigs($base_name, $filecontig, $filenameOutExt);
4342
print SUMFILE "\n" if($minContigLength > 0);
4443
&FormatContigs() if($minContigLength > 0);
4544
}else{
@@ -48,13 +47,13 @@
4847

4948
close SUMFILE;
5049
close LOG;
51-
50+
5251
mkpath('process_OK');
5352
#--------------------------------------------------
5453

5554
###EXTEND CONTIGS WITH UNMAPPED READS
5655
sub ExtendContigs{
57-
my ($base_name, $filecontig, $filenameOutExt, $Bin) = @_;
56+
my ($base_name, $filecontig, $filenameOutExt) = @_;
5857
my ($seq);
5958
#-------------------------------------------------NOW MAP SINGLE READS TO INITIAL CONTIGS FILE.
6059
my $readfile = "reads/" . $filenameOutExt;
@@ -67,8 +66,8 @@ sub ExtendContigs{
6766
#--------------------------------------------ASSEMBLY START
6867

6968
ASSEMBLY:
70-
open(IN,$filecontig) || die "Can't open $filecontig -- fatal\n";
71-
my ($exttig_count, $counter, $NCount, $orig_mer, $prevhead) = (0,0,0,0,'');
69+
open(IN, $filecontig) || die "Can't open $filecontig -- fatal\n";
70+
my ($exttig_count, $counter, $NCount, $orig_mer, $prevhead) = (0, 0, 0, 0, '');
7271
while(<IN>){
7372
s/\r\n/\n/;
7473
chomp;
@@ -91,12 +90,12 @@ sub ExtendContigs{
9190
my $reversetig = reverseComplement($seqrc); ### return to sequence, as inputted
9291
if($leng > $orig_mer){ ### commented out: && $start_sequence ne $seqrc && $start_sequence ne $reversetig
9392
my $cov = $total_bases / $leng;
94-
printf TIG ">extcontig%i|size%i|read%i|cov%.2f|seed:$prevhead\n%s\n", ($counter,$leng,$reads_needed,$cov,$reversetig); #print contigs to file
93+
printf TIG ">extcontig%i|size%i|read%i|cov%.2f|seed:$prevhead\n%s\n", ($counter, $leng, $reads_needed, $cov, $reversetig); #print contigs to file
9594
$exttig_count++;
9695
}else{
9796
my $cov = $reads_needed = 0;
9897
my $singlet_leng = length($start_sequence);
99-
printf TIG ">contig%i|size%i|read%i|cov%.2f|seed:$prevhead\n%s\n", ($counter,$leng,$reads_needed,$cov,$reversetig); #print singlets to file
98+
printf TIG ">contig%i|size%i|read%i|cov%.2f|seed:$prevhead\n%s\n", ($counter, $leng, $reads_needed, $cov, $reversetig); #print singlets to file
10099
}
101100
}
102101
CounterPrint(++$counter);
@@ -124,8 +123,8 @@ sub ExtendContigs{
124123
sub FormatContigs{
125124
&printMessage("\n=>".getDate().": Storing contigs to format for scaffolding\n");
126125
open (TIG, ">$contig") || die "Can't write to $contig -- fatal\n";
127-
open(IN,$filecontig) || die "Can't open $filecontig -- fatal\n";
128-
my ($counter, $seq, $prevhead, $step) = (0,'','', 100);
126+
open(IN, $filecontig) || die "Can't open $filecontig -- fatal\n";
127+
my ($counter, $seq, $prevhead, $step) = (0, '', '', 100);
129128
while(<IN>){
130129
s/\r\n/\n/;
131130
chomp;
@@ -138,7 +137,7 @@ sub FormatContigs{
138137
CounterPrint($counter);
139138
$step = $step + 100;
140139
}
141-
printf TIG ">contig%i|size%i|read%i|cov%.2f|seed:$prevhead\n%s\n", ($counter,$length_seq,0,0.00,$seq);
140+
printf TIG ">contig%i|size%i|read%i|cov%.2f|seed:$prevhead\n%s\n", ($counter, $length_seq, 0, 0.00, $seq);
142141
}
143142
$prevhead = $head;
144143
$seq = '';
@@ -157,15 +156,15 @@ sub doExtension{
157156
my ($direction, $orig_mer, $seq, $reads_needed, $total_bases, $min_overlap, $base_overlap, $min_base_ratio, $verbose, $tig_count, $max_trim) = @_;
158157

159158
my $previous = $seq;
160-
my ($extended, $trim_ct) = (1,0);
159+
my ($extended, $trim_ct) = (1, 0);
161160

162161
if($orig_mer > $MAX){$orig_mer=$MAX;} ### Deals with special cases where the seed sequences are different from the read set (and possibly very large) - goal here is not to increase sequence coverage of seed, but rather to extend it.
163162

164163
TRIM:
165164
while($trim_ct <= $max_trim){
166165
while($extended){
167166

168-
my ($pos,$current_reads,$current_bases,$span) = (0,0,0,"");
167+
my ($pos, $current_reads, $current_bases, $span) = (0, 0, 0, "");
169168

170169
### Added 19March08
171170
if(length($seq) >= $MAX){ # $seq is length of contig being extended -- if larger than largest read, make sure the largest read could align and all subsequent rds.
@@ -177,10 +176,10 @@ sub doExtension{
177176
my $overhang = {};
178177
my @overlapping_reads = ();
179178
for (my $x=1;$x <= ($orig_mer * 2);$x++){
180-
($overhang->{$x}{'A'},$overhang->{$x}{'C'},$overhang->{$x}{'G'},$overhang->{$x}{'T'}) = (0,0,0,0);
179+
($overhang->{$x}{'A'}, $overhang->{$x}{'C'}, $overhang->{$x}{'G'}, $overhang->{$x}{'T'}) = (0, 0, 0, 0);
181180
}
182181

183-
### COLLECT SEQUENCES
182+
### COLLECT SEQUENCES
184183
while ($span >= $min_overlap){ # will slide the subseq, until the user-defined min overlap size
185184

186185
$pos = length($seq) - $span;
@@ -200,9 +199,9 @@ sub doExtension{
200199

201200
# Collect all overhangs
202201
push @overlapping_reads, $pass; ### all overlapping reads
203-
my @over = split(//,$dangle);
202+
my @over = split(//, $dangle);
204203
my $ct_oh = 0;
205-
204+
206205
foreach my $bz(@over){
207206
$ct_oh++; ### tracks overhang position passed the seed
208207
$overhang->{$ct_oh}{$bz} += $bin->{$sub}{$pass};
@@ -242,7 +241,7 @@ sub doExtension{
242241
last CONSENSUS;
243242
}
244243
}
245-
$previous_bz = $bz;
244+
$previous_bz = $bz;
246245
$ct_dna++;
247246
}
248247
}
@@ -252,7 +251,7 @@ sub doExtension{
252251
if($consensus ne ""){
253252

254253
print "Will extend $seq\nwith: $consensus\n\n" if($verbose);
255-
my $temp_sequence = $seq . $consensus; ## this is the contig extension
254+
my $temp_sequence = $seq . $consensus; ## this is the contig extension
256255
my $integral = 0;
257256
my $position = length($temp_sequence) - ($startspan + length($consensus));
258257
my $temp_sequence_end = substr($temp_sequence, $position);
@@ -290,7 +289,7 @@ sub doExtension{
290289
$extended = 1;
291290
print "\n$direction prime EXTENSION ROUND $trim_ct COMPLETE UNTIL $max_trim nt TRIMMED OFF => TRIMMED SEQUENCE:$seq\n\n" if ($verbose);
292291
}
293-
292+
294293
}### while trimming within bounds
295294

296295
print "\n*** NOTHING ELSE TO BE DONE IN $direction prime- PERHAPS YOU COULD DECREASE THE MINIMUM OVERLAP -m (currently set to -m $min_overlap) ***\n\n" if ($verbose);
@@ -302,19 +301,19 @@ sub doExtension{
302301
###DELETE READ DATA IF IT HAS BEEN USED FOR EXTENDING A CONTIG
303302
sub deleteData {
304303
my ($sequence) = @_;
305-
304+
306305
my $subnor = substr($sequence, 0, 10);
307306
my $comp_seq = reverseComplement($sequence);
308307
my $subrv = substr($comp_seq, 0, 10);
309-
308+
310309
#remove k-mer from hash table and prefix tree
311310
delete $bin->{$subrv}{$comp_seq};
312311
delete $bin->{$subnor}{$sequence};
313312
}
314313

315314
sub getUnmappedReads{
316315
my ($contigFile, $readfiles) = @_;
317-
my ($library,$fnames) = ("start","");
316+
my ($library, $fnames) = ("start", "");
318317

319318
#obtain sequences to map against the contigs
320319
open(FILELIB, "< $libraryfile") || die "Can't open $libraryfile -- fatal\n";
@@ -330,9 +329,11 @@ sub getUnmappedReads{
330329
close FILELIB;
331330
my $unpaired = "reads/$base_name.singlereads.fasta";
332331
$files->{$unpaired}++ if(-e $unpaired);
333-
foreach my $f(keys %$files){ $fnames.="$f,";}
332+
foreach my $f(keys %$files){
333+
$fnames .= "$f,";
334+
}
334335
chop $fnames;
335-
336+
336337
#build bowtie index of contigs and map reads to the index
337338
my $bowtieout = $base_name . ".$library.bowtieIndex";
338339
die "Contig file ($contigFile) not found. Exiting...\n" if(!(-e $contigFile));
@@ -344,7 +345,7 @@ sub getUnmappedReads{
344345
#map reads with bowtie and obtain unmapped reads. Store the unmapped reads into a hash and use them for contig extension
345346
open(IN, "$procline") || die "Can't open bowtie output -- fatal\n";
346347
my ($counter, $step) = (0, 100000);
347-
my ($orig, $rc, $subrv,$subnor, $orig_mer);
348+
my ($orig, $rc, $subrv, $subnor, $orig_mer);
348349
while(<IN>){
349350
my @t = split(/\t/);
350351
next if ($t[2] ne '*');

0 commit comments

Comments
 (0)