Skip to content

Commit

Permalink
cleanup anndata
Browse files Browse the repository at this point in the history
also clean up args.umi_gene legacy
  • Loading branch information
Yenaled committed Jan 5, 2024
1 parent 9cc489b commit a4acdf7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 0 additions & 10 deletions kb_python/count.py
Original file line number Diff line number Diff line change
Expand Up @@ -2016,29 +2016,24 @@ def update_results_with_suffix(current_results, new_results, suffix):
if sum_matrices and sum_matrices != 'none':
# Sum up multiple matrices
sums = {}
updated_prefixes = []
if sum_matrices == 'cell' or sum_matrices == 'total':
sums['cell'] = do_sum_matrices(
count_result[prefixes.index('processed')]['mtx'],
count_result[prefixes.index('ambiguous')]['mtx'],
f'{counts_prefix}.cell.mtx', em or mm
)
updated_prefixes = ['cell', 'unprocessed']
if sum_matrices == 'nucleus' or sum_matrices == 'total':
sums['nucleus'] = do_sum_matrices(
count_result[prefixes.index('unprocessed')]['mtx'],
count_result[prefixes.index('ambiguous')]['mtx'],
f'{counts_prefix}.nucleus.mtx', em or mm
)
updated_prefixes = ['processed', 'nucleus']
if sum_matrices == 'total':
sums['total'] = do_sum_matrices(
f'{counts_prefix}.mature.mtx',
f'{counts_prefix}.nucleus.mtx',
f'{counts_prefix}.total.mtx', em or mm
)
updated_prefixes = prefixes
prefixes = updated_prefixes
for prefix, f in sums.items():
res = copy.deepcopy(count_result[0])
res['mtx'] = f
Expand Down Expand Up @@ -2184,29 +2179,24 @@ def update_results_with_suffix(current_results, new_results, suffix):
if sum_matrices and sum_matrices != 'none':
# Sum up multiple matrices
sums = {}
updated_prefixes = []
if sum_matrices == 'cell' or sum_matrices == 'total':
sums['cell'] = do_sum_matrices(
count_result[prefixes.index('processed')]['mtx'],
count_result[prefixes.index('ambiguous')]['mtx'],
f'{filtered_counts_prefix}.cell.mtx', em or mm
)
updated_prefixes = ['cell', 'unprocessed']
if sum_matrices == 'nucleus' or sum_matrices == 'total':
sums['nucleus'] = do_sum_matrices(
count_result[prefixes.index('unprocessed')]['mtx'],
count_result[prefixes.index('ambiguous')]['mtx'],
f'{filtered_counts_prefix}.nucleus.mtx', em or mm
)
updated_prefixes = ['processed', 'nucleus']
if sum_matrices == 'total':
sums['total'] = do_sum_matrices(
f'{filtered_counts_prefix}.mature.mtx',
f'{filtered_counts_prefix}.nucleus.mtx',
f'{filtered_counts_prefix}.total.mtx', em or mm
)
updated_prefixes = prefixes
prefixes = updated_prefixes
for prefix, f in sums.items():
res = copy.deepcopy(count_result[0])
res['mtx'] = f
Expand Down
2 changes: 1 addition & 1 deletion kb_python/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def parse_count(
fragment_s=args.fragment_s,
paired=args.parity == 'paired',
strand=args.strand,
umi_gene=args.umi_gene,
umi_gene=args.x.upper() not in ('BULK', 'SMARTSEQ2'),
em=args.em,
by_name=args.gene_names
)
Expand Down

0 comments on commit a4acdf7

Please sign in to comment.