Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert nine variable assignments to the usage of combined operators #16

Closed
elfring opened this issue Dec 5, 2021 · 2 comments
Closed

Comments

@elfring
Copy link

elfring commented Dec 5, 2021

馃憖 Some source code analysis tools can help to find opportunities for improving software components.
馃挱 I propose to increase the usage of combined operators accordingly.

diff --git a/fdog/bin/hamstr.pl b/fdog/bin/hamstr.pl
index 3feb01e..c56ecdb 100755
--- a/fdog/bin/hamstr.pl
+++ b/fdog/bin/hamstr.pl
@@ -1150,7 +1150,7 @@ sub checkInput {
 		elsif (-e $blastpathtmp . '_prot' . $blastdbend){
 			## the check for the file naming '_prot' is only to maintain backward compatibility
 			$blastapp = '_prot';
-			$blastpathtmp = $blastpathtmp . $blastapp;
+			$blastpathtmp .= $blastapp;
 			push @log, "\tcheck for $blastpathtmp succeeded";
 			printOUT("succeeded\n");
 		}
diff --git a/fdog/bin/oneSeq.pl b/fdog/bin/oneSeq.pl
index a99e1e6..6a8a61b 100755
--- a/fdog/bin/oneSeq.pl
+++ b/fdog/bin/oneSeq.pl
@@ -586,7 +586,7 @@ if (!$coreex) {
 		print "Added TAXON: $addedTaxon\t$addedTaxonName\n";
 		#if a new core ortholog was found
 		if($addedTaxon ne "") {
-			$hamstrSpecies = $hamstrSpecies . "," . $addedTaxon;
+			$hamstrSpecies .= "," . $addedTaxon;
 
 			clearTmpFiles();
 
@@ -865,7 +865,7 @@ sub getAlnScores{
 		unless ($silent) {
 			print "Cumulative alignmentscore is: $score\n";
 		}
-		$scores{$key} = $scores{$key} / $maxAlnScore;
+		$scores{$key} /= $maxAlnScore;
 		$score = $scores{$key};
 		unless ($silent) {
 			print "Normalised alignmentscore is: $score\n";
@@ -1151,7 +1151,7 @@ sub checkOptions {
 		}
 		my $output = '';
 		for (my $i = 0; $i < @refTaxonlist; $i++) {
-			$output = $output . "[$i]" . "\t" . $refTaxonlist[$i] . "\n";
+			$output .= "[$i]\t" . $refTaxonlist[$i] . "\n";
 		}
 		### for debug?
 		# for (keys %taxa){
@@ -1279,7 +1279,7 @@ sub checkOptions {
 		}
 		print "Your sequence was named: " . $seqName . "\n\n";
 	}
-	$outputPath = $outputPath . "/$seqName";
+	$outputPath .= "/$seqName";
 	if (! -d "$outputPath"){
 		mkdir "$outputPath", 0777  or die "could not create the output directory $outputPath";
 	}
@@ -1526,7 +1526,7 @@ sub fetchSequence {
 		my $line = $_;
 		chomp($line);
 		unless($line =~ /^\>.*/) {
-			$seq = $seq . $line;
+			$seq .= $line;
 		}
 	}
 	close INPUT;
@@ -1719,7 +1719,7 @@ sub cumulativeAlnScore{
 			if($line[0] && ($line[0] eq $shortedId)){
 				if(exists $cumscores{$key}) {
 					$gotScore = 1;
-					$cumscores{$key} = $cumscores{$key} + $line[2];
+					$cumscores{$key} += $line[2];
 				}else{
 					$gotScore = 1;
 					$cumscores{$key} = $line[2];
@@ -1938,7 +1938,7 @@ sub runHamstr {
 	if (! -e $taxaDir) {
 		## backward compatibility. I used to name the dirs with the ending .dir
 		if (-e "$taxaDir.dir"){
-			$taxaDir = $taxaDir . '.dir';
+			$taxaDir .= '.dir';
 		}
 	}
 	$taxaDir =~ s/\s*//g;
diff --git a/fdog/bin/translate.pl b/fdog/bin/translate.pl
index 68ee444..2fe04dd 100755
--- a/fdog/bin/translate.pl
+++ b/fdog/bin/translate.pl
@@ -167,7 +167,7 @@ sub checkIds {
 		$id =~ s/|.*//;
 	    }
 	    elsif ($check == 2) {
-		$id = $id . '_' . $seq_object[$i]->desc;
+		$id .= '_' . $seq_object[$i]->desc;
 		$id =~ s/(.{0,$limit}).*/$1/;
 	    }
 	    if (defined $counter->{$id}) {
@trvinh
Copy link
Member

trvinh commented Jan 24, 2023

solved with PR #26

@trvinh trvinh closed this as completed Jan 24, 2023
@elfring
Copy link
Author

elfring commented Jan 24, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants