Skip to content

Commit 6709071

Browse files
committed
fix some lint
1 parent 1421639 commit 6709071

3 files changed

Lines changed: 21 additions & 19 deletions

File tree

kb_python/count.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ def count(
12901290
by_name: Aggregate counts by name instead of ID.
12911291
cellranger: Whether to convert the final count matrix into a
12921292
cellranger-compatible matrix, defaults to `False`
1293-
gzip: Whether to gzip compress cellranger output matrices,
1293+
gzip: Whether to gzip compress cellranger output matrices,
12941294
defaults to `False`
12951295
delete_bus: Whether to delete intermediate BUS files after successful count,
12961296
defaults to `False`
@@ -1760,24 +1760,24 @@ def update_results_with_suffix(current_results, new_results, suffix):
17601760
if delete_bus:
17611761
logger.info('Deleting intermediate BUS files to save disk space')
17621762
bus_files_to_delete = []
1763-
1763+
17641764
# Collect all .bus files from results
17651765
if 'bus' in unfiltered_results:
17661766
bus_files_to_delete.append(unfiltered_results['bus'])
17671767
if 'bus_scs' in unfiltered_results:
17681768
bus_files_to_delete.append(unfiltered_results['bus_scs'])
1769-
1769+
17701770
# For smartseq3, delete suffix versions too
17711771
for suffix in ['', INTERNAL_SUFFIX, UMI_SUFFIX]:
17721772
if f'bus{suffix}' in unfiltered_results:
17731773
bus_files_to_delete.append(unfiltered_results[f'bus{suffix}'])
17741774
if f'bus_scs{suffix}' in unfiltered_results:
17751775
bus_files_to_delete.append(unfiltered_results[f'bus_scs{suffix}'])
1776-
1776+
17771777
# Delete filtered bus if exists
17781778
if 'filtered' in results and 'bus_scs' in results['filtered']:
17791779
bus_files_to_delete.append(results['filtered']['bus_scs'])
1780-
1780+
17811781
# Delete each BUS file
17821782
for bus_file in bus_files_to_delete:
17831783
if bus_file and os.path.exists(bus_file):
@@ -1875,7 +1875,7 @@ def count_nac(
18751875
by_name: Aggregate counts by name instead of ID.
18761876
cellranger: Whether to convert the final count matrix into a
18771877
cellranger-compatible matrix, defaults to `False`
1878-
gzip: Whether to gzip compress cellranger output matrices,
1878+
gzip: Whether to gzip compress cellranger output matrices,
18791879
defaults to `False`
18801880
cellranger_style: Whether to organize output in CellRanger-style directories
18811881
(spliced/ and unspliced/ subdirectories), defaults to `False`
@@ -2184,7 +2184,7 @@ def update_results_with_suffix(current_results, new_results, suffix):
21842184
cr_dir = os.path.join(counts_dir, f'{CELLRANGER_DIR}_{prefix}{suffix}')
21852185
else:
21862186
cr_dir = os.path.join(counts_dir, f'{CELLRANGER_DIR}_{prefix}{suffix}')
2187-
2187+
21882188
cr_result = matrix_to_cellranger(
21892189
count_result[i]['mtx'], count_result[i]['barcodes'],
21902190
count_result[i]['genes'], t2g_path,
@@ -2359,7 +2359,7 @@ def update_results_with_suffix(current_results, new_results, suffix):
23592359
cr_dir = os.path.join(filtered_counts_dir, f'{CELLRANGER_DIR}_{prefix}')
23602360
else:
23612361
cr_dir = os.path.join(filtered_counts_dir, f'{CELLRANGER_DIR}_{prefix}')
2362-
2362+
23632363
cr_result = matrix_to_cellranger(
23642364
count_result[i]['mtx'], count_result[i]['barcodes'],
23652365
count_result[i]['genes'], t2g_path,
@@ -2488,19 +2488,19 @@ def update_results_with_suffix(current_results, new_results, suffix):
24882488
if delete_bus:
24892489
logger.info('Deleting intermediate BUS files to save disk space')
24902490
bus_files_to_delete = []
2491-
2491+
24922492
# Collect all .bus files from results
24932493
prefixes = ['processed', 'unprocessed', 'ambiguous']
24942494
for prefix in prefixes:
24952495
if prefix in unfiltered_results:
24962496
for suffix in ['', INTERNAL_SUFFIX, UMI_SUFFIX]:
24972497
if f'bus{suffix}' in unfiltered_results[prefix]:
24982498
bus_files_to_delete.append(unfiltered_results[prefix][f'bus{suffix}'])
2499-
2499+
25002500
# Delete filtered bus files if they exist
25012501
if 'filtered' in results and 'bus_scs' in results['filtered']:
25022502
bus_files_to_delete.append(results['filtered']['bus_scs'])
2503-
2503+
25042504
# Delete each BUS file
25052505
for bus_file in bus_files_to_delete:
25062506
if bus_file and os.path.exists(bus_file):

kb_python/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,11 @@ def parse_count(
591591
parser.error(
592592
f'Option `--aa` cannot be used with workflow {args.workflow}.'
593593
)
594-
594+
595595
# Auto-enable gzip and cellranger-style when --cellranger is used
596596
use_gzip = args.cellranger and not args.no_gzip or args.gzip
597597
use_cellranger_style = args.cellranger
598-
598+
599599
from .count import count_nac
600600
count_nac(
601601
args.i,
@@ -1462,7 +1462,10 @@ def setup_count_args(
14621462
)
14631463
parser_count.add_argument(
14641464
'--gzip',
1465-
help='Gzip compress output matrices (matrix.mtx.gz, barcodes.tsv.gz, genes.tsv.gz). Automatically enabled with --cellranger',
1465+
help=(
1466+
'Gzip compress output matrices (matrix.mtx.gz, barcodes.tsv.gz, genes.tsv.gz). '
1467+
'Automatically enabled with --cellranger. '
1468+
),
14661469
action='store_true'
14671470
)
14681471
parser_count.add_argument(

kb_python/ref.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import glob
2-
import itertools
32
import os
43
import tarfile
54
from collections import defaultdict
@@ -72,7 +71,7 @@ def generate_mismatches(name, sequence):
7271
lengths = set()
7372
features = {}
7473
variants = {}
75-
74+
7675
# Store all original sequences to check for collisions with variants
7776
original_sequences = set()
7877

@@ -89,7 +88,7 @@ def generate_mismatches(name, sequence):
8988
lengths.add(len(row.sequence))
9089
features[row['name']] = row.sequence
9190
original_sequences.add(row.sequence)
92-
91+
9392
variants[row['name']] = {
9493
name: seq
9594
for name, seq in generate_mismatches(row['name'], row.sequence)
@@ -122,8 +121,8 @@ def generate_mismatches(name, sequence):
122121
# 1. Check collision with original barcodes
123122
if seq in original_sequences:
124123
logger.warning(
125-
f'Collision detected between variants of feature barcode(s) {",".join(set(v[0] for v in variant_list))} '
126-
f'and original feature barcode {seq}. These variants will be removed.'
124+
f'Collision detected between variants of feature barcode(s) {",".join(set(v[0] for v in variant_list))}'
125+
f' and original feature barcode {seq}. These variants will be removed.'
127126
)
128127
for feature_name, variant_name in variant_list:
129128
if variant_name in variants[feature_name]:

0 commit comments

Comments
 (0)