Skip to content

Commit

Permalink
made closing optional
Browse files Browse the repository at this point in the history
filehandles optional
  • Loading branch information
FelixKrueger committed May 3, 2023
1 parent 33db3d4 commit 1e86f64
Showing 1 changed file with 32 additions and 17 deletions.
49 changes: 32 additions & 17 deletions bismark
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Getopt::Long;
use FindBin qw($RealBin);
use lib "$RealBin/../lib";

## This program is Copyright (C) 2010-22, Felix Krueger ([email protected])
## This program is Copyright (C) 2010-23, Felix Krueger ([email protected])

## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
Expand All @@ -25,8 +25,8 @@ use lib "$RealBin/../lib";

my $parent_dir = getcwd();

my $bismark_version = 'v0.24.0';
my $copyright_dates = "2010-22";
my $bismark_version = 'v0.24.0dev';
my $copyright_dates = "2010-23";

my $start_run = time();
my $command_line = join (" ",@ARGV);
Expand Down Expand Up @@ -2350,8 +2350,12 @@ sub process_single_end_fastA_file_for_methylation_call{
print "Processed $counting{sequences_count} sequences in total\n\n";

close OUT or warn "Failed to close filehandle OUT: $!\n";
close AMBIG or warn "Failed to close filehandle AMBIG: $!";
close UNMAPPED or warn "Failed to close filehandle UNMAPPED: $!";
if ($ambiguous){
close AMBIG or warn "Failed to close filehandle AMBIG: $!";
}
if ($unmapped){
close UNMAPPED or warn "Failed to close filehandle UNMAPPED: $!";
}

print_final_analysis_report_single_end($C_to_T_infile,$G_to_A_infile,$pid);

Expand Down Expand Up @@ -2434,8 +2438,12 @@ sub process_single_end_fastQ_file_for_methylation_call{
print "Processed $counting{sequences_count} sequences in total\n\n";

close OUT or warn "Failed to close filehandle OUT: $!";
close AMBIG or warn "Failed to close filehandle AMBIG: $!";
close UNMAPPED or warn "Failed to close filehandle UNMAPPED: $!";
if ($ambiguous){
close AMBIG or warn "Failed to close filehandle AMBIG: $!";
}
if ($unmapped){
close UNMAPPED or warn "Failed to close filehandle UNMAPPED: $!";
}

print_final_analysis_report_single_end($C_to_T_infile,$G_to_A_infile,$pid);
if ($ambig_bam){
Expand Down Expand Up @@ -2526,11 +2534,14 @@ sub process_fastA_files_for_paired_end_methylation_calls{

warn "Processed $counting{sequences_count} sequences in total\n\n";
close OUT or die $!;
close AMBIG_1 or warn "Failed to close filehandle AMBIG_1: $!";
close AMBIG_2 or warn "Failed to close filehandle AMBIG_2: $!";
close UNMAPPED_1 or warn "Failed to close filehandle UNMAPPED_1: $!";
close UNMAPPED_2 or warn "Failed to close filehandle UNMAPPED_2: $!";

if ($ambiguous){
close AMBIG_1 or warn "Failed to close filehandle AMBIG_1: $!";
close AMBIG_2 or warn "Failed to close filehandle AMBIG_2: $!";
}
if ($unmapped){
close UNMAPPED_1 or warn "Failed to close filehandle UNMAPPED_1: $!";
close UNMAPPED_2 or warn "Failed to close filehandle UNMAPPED_2: $!";
}
print_final_analysis_report_paired_ends($C_to_T_infile_1,$G_to_A_infile_1,$C_to_T_infile_2,$G_to_A_infile_2,$pid);

}
Expand Down Expand Up @@ -2638,10 +2649,14 @@ sub process_fastQ_files_for_paired_end_methylation_calls{
warn "Processed $counting{sequences_count} sequences in total\n\n";

close OUT or warn "Failed to close filehandle OUT: $!\n\n";
close AMBIG_1 or warn "Failed to close filehandle AMBIG_1: $!";
close AMBIG_2 or warn "Failed to close filehandle AMBIG_2: $!";
close UNMAPPED_1 or warn "Failed to close filehandle UNMAPPED_1: $!";
close UNMAPPED_2 or warn "Failed to close filehandle UNMAPPED_2: $!";
if ($ambiguous){
close AMBIG_1 or warn "Failed to close filehandle AMBIG_1: $!";
close AMBIG_2 or warn "Failed to close filehandle AMBIG_2: $!";
}
if ($unmapped){
close UNMAPPED_1 or warn "Failed to close filehandle UNMAPPED_1: $!";
close UNMAPPED_2 or warn "Failed to close filehandle UNMAPPED_2: $!";
}

if ($ambig_bam){
close AMBIBAM or warn "Had trouble closing filehandle AMBIBAM: $!\n\n";
Expand Down Expand Up @@ -9978,6 +9993,6 @@ Bismark BAM/SAM OUTPUT (default):
Each read of paired-end alignments is written out in a separate line in the above format.
Last modified on 17 May 2022
Last modified on 03 May 2023
HOW_TO
}

0 comments on commit 1e86f64

Please sign in to comment.