bioperl / bioperl-live

Core BioPerl 1.x code
http://bioperl.org
299 stars 182 forks source link

Fix tiny bug #383

Closed Juke34 closed 1 year ago

Juke34 commented 1 year ago

seq_id replaced by SEQ when the name is 0 because perl see 0 as FALSE

BUG reported here: https://github.com/NBISweden/AGAT/issues/368

carandraug commented 1 year ago

Since we know we're dealing with a string, can we just evaluate it's length instead?

Juke34 commented 1 year ago

You mean replacing

$name = 'SEQ' if (! $name and $name ne "0");

by

$name = 'SEQ' if ! length($name);

?

carandraug commented 1 year ago

Yes. I think it's shorter and clearer. $name is a string and we only use SEQ when the string is empty. It's nice when we can just evaluate the truthiness of the variable, but we're already not doing that because we need to check for the specific "0" case. At that point, the whole abstraction is gone, so we might as well just check the string length.

carandraug commented 1 year ago

Thank you for the fix. I squashed your two commits and remove the trailing whitespace before merging by fast forward. Because of the change for trailing whitespace, github does not recognize as it being merged (but it is). Closing as fixed. Thank you again.