diff --git a/Bio/GenBank/__init__.py b/Bio/GenBank/__init__.py index fd1627dd8..b947bc894 100644 --- a/Bio/GenBank/__init__.py +++ b/Bio/GenBank/__init__.py @@ -233,13 +233,12 @@ class _BaseGenBankConsumer: else: tax_info = taxonomy_string tax_list = tax_info.split(";") - new_tax_list = [] - for tax_item in tax_list: - new_items = tax_item.split("\n") - new_tax_list.extend(new_items) - while "" in new_tax_list: - new_tax_list.remove("") - return [x.strip() for x in new_tax_list] + return [ + item.strip() + for tax_item in tax_list + for item in tax_item.split("\n") + if item + ] @staticmethod def _clean_location(location_string): diff --git a/Bio/Graphics/BasicChromosome.py b/Bio/Graphics/BasicChromosome.py index 3db3186d6..c54d7cba2 100644 --- a/Bio/Graphics/BasicChromosome.py +++ b/Bio/Graphics/BasicChromosome.py @@ -324,11 +324,11 @@ class Chromosome(_ChromosomeComponent): self.end_x_position - self.start_x_position - segment_width ) - y_limits = [] - for sub_component in self._sub_components: - y_limits.extend( - (sub_component.start_y_position, sub_component.end_y_position) - ) + y_limits = [ + limit + for sub_component in self._sub_components + for limit in (sub_component.start_y_position, sub_component.end_y_position) + ] y_min = min(y_limits) y_max = max(y_limits) del y_limits diff --git a/Bio/Nexus/Nexus.py b/Bio/Nexus/Nexus.py index dadc1f6f6..511f565ef 100644 --- a/Bio/Nexus/Nexus.py +++ b/Bio/Nexus/Nexus.py @@ -593,9 +593,7 @@ class Commandline: for n in range(len(options)) if options[n] == "=" and n != 0 and n != len(options) ] - indices = [] - for sl in valued_indices: - indices.extend(sl) + indices = [index for sl in valued_indices for index in sl] token_indices = [n for n in range(len(options)) if n not in indices] for opt in valued_indices: # self.options[options[opt[0]].lower()] = options[opt[2]].lower() diff --git a/Bio/PDB/internal_coords.py b/Bio/PDB/internal_coords.py index 1137818aa..ad5148c82 100644 --- a/Bio/PDB/internal_coords.py +++ b/Bio/PDB/internal_coords.py @@ -1034,11 +1034,8 @@ class IC_Chain: self.initNCaCs.append(tuple(initNCaC)) # next residue NCaCKeys so can do per-residue assemble() - ric.NCaCKey = [] - ric.NCaCKey.extend( - ric.split_akl( - (AtomKey(ric, "N"), AtomKey(ric, "CA"), AtomKey(ric, "C")) - ) + ric.NCaCKey = ric.split_akl( + (AtomKey(ric, "N"), AtomKey(ric, "CA"), AtomKey(ric, "C")) ) ric._link_dihedra() @@ -2709,11 +2706,8 @@ class IC_Residue: self._build_rak_cache() # initialise NCaCKey here: - self.NCaCKey = [] - self.NCaCKey.extend( - self.split_akl( - (AtomKey(self, "N"), AtomKey(self, "CA"), AtomKey(self, "C")) - ) + self.NCaCKey = self.split_akl( + (AtomKey(self, "N"), AtomKey(self, "CA"), AtomKey(self, "C")) ) def set_flexible(self) -> None: diff --git a/Bio/Phylo/Consensus.py b/Bio/Phylo/Consensus.py index 80273ff25..824c8b861 100644 --- a/Bio/Phylo/Consensus.py +++ b/Bio/Phylo/Consensus.py @@ -274,7 +274,7 @@ def strict_consensus(trees): def majority_consensus(trees, cutoff=0): """Search majority rule consensus tree from multiple trees. - This is a extend majority rule method, which means the you can set any + This is an extend majority rule method, which means the you can set any cutoff between 0 ~ 1 instead of 0.5. The default value of cutoff is 0 to create a relaxed binary consensus tree in any condition (as long as one of the provided trees is a binary tree). The branch length of each consensus