Skip to content

Commit

Permalink
update analysis to create clean gz
Browse files Browse the repository at this point in the history
  • Loading branch information
MFlores2021 committed Jun 28, 2023
1 parent 846933e commit 68cde68
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions perl/analysis.pl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# Check
if ($controlfile ne 'NA'){
if ( !grep( /^$controlfile$/, @files ) ) {
print "Control file name not provided or incorrect.\n";
Util::print_user_submessage("Control file name not provided or incorrect.\n");
}
}

Expand Down Expand Up @@ -110,6 +110,7 @@
}

### Trimming
my @clean_files;
if($adaptor ne 'NA' && $length ne 'NA'){
my $commtrim;
my $trimdir = 'perl ' . catfile($localdir,'VD','tools','sRNA_clean','sRNA_clean.pl ');
Expand All @@ -120,8 +121,21 @@
}
system($commtrim) == 0
or die "Error: $commtrim . $?";

foreach my $file (@files) {
my $clean =$file;
$clean =~ s/\.fq$/\.clean\.fq/;
$clean =~ s/\.fastq$/\.clean\.fq/;

my $cleanfile = catfile($dir,$clean);
if(-e -s $cleanfile && ($file ne $clean)){

push @clean_files, catfile($dir,$clean);
}
}
}


my @array_files;
#Loop through the array printing out the filenames
foreach my $file1 (@files) {
Expand Down Expand Up @@ -319,6 +333,7 @@
if($spike ne 'NA'){
merge_spike_files($dir);
}

# Get blast
my $fileBlast;
if($fileBlast ne 'NA'){
Expand Down Expand Up @@ -353,11 +368,28 @@
# if ($file =~ "control\.tsv") {unlink $file;}
# if ($file =~ "spikeSummary\.txt") {unlink $file;}
if (! -d $file && ($file =~ /\.fastq$/ || $file =~ /\.fq$/ ) ) {unlink $file;}

foreach my $cleanfile (@clean_files){
if( -e -s $cleanfile) {
compress_file($cleanfile, $localdir);
}
}
}

closedir(DIR);

### End of analysis
sub compress_file {
my $file = shift;
my $localdir = shift;

my $tooldir = catfile($localdir,'VD', 'bin','gzip.exe ');
my $commrun = $tooldir . " -k " . $file;

system($commrun) == 0
or warn "Error: $commrun . $?";
}


sub format_spike {
my %count;
Expand Down Expand Up @@ -481,7 +513,7 @@ sub print_summary {
}
}
}

#Get blast results
my %dataFileBlast;
my $fileBlast;
Expand Down

0 comments on commit 68cde68

Please sign in to comment.