Skip to content

Commit c81634d

Browse files
authored
Merge pull request #262 from broadinstitute/development
Release 1.19.2
2 parents 53fa77f + 27e55ae commit c81634d

File tree

4 files changed

+990
-99
lines changed

4 files changed

+990
-99
lines changed

ingest/de.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(
5252
self.accession = self.kwargs["study_accession"]
5353
self.annot_scope = self.kwargs["annotation_scope"]
5454
# only used in output filename, replacing non-alphanumeric with underscores
55-
self.cluster_name = re.sub(r'\W+', '_', self.kwargs["name"])
55+
self.cluster_name = re.sub(r'\W', '_', self.kwargs["name"])
5656
self.method = self.kwargs["method"]
5757

5858
if matrix_file_type == "mtx":
@@ -135,6 +135,8 @@ def process_annots(metadata_file_path, allowed_file_types, headers, dtypes):
135135
skiprows=2,
136136
index_col=0,
137137
dtype=dtypes,
138+
keep_default_na=False,
139+
na_values=[""],
138140
)
139141
group_annots = [k for k, v in dtypes.items() if v == str]
140142
# Where group metadata is missing values (eg. optional or nonconventional metadata)
@@ -387,8 +389,8 @@ def run_scanpy_de(
387389
DifferentialExpression.de_logger.info("Gathering DE annotation labels")
388390
groups = np.unique(adata.obs[annotation]).tolist()
389391
for group in groups:
390-
clean_group = re.sub(r'\W+', '_', group)
391-
clean_annotation = re.sub(r'\W+', '_', annotation)
392+
clean_group = re.sub(r'\W', '_', group)
393+
clean_annotation = re.sub(r'\W', '_', annotation)
392394
DifferentialExpression.de_logger.info(f"Writing DE output for {group}")
393395
rank = sc.get.rank_genes_groups_df(adata, key=rank_key, group=group)
394396
if DifferentialExpression.delimiter_in_gene_name(rank):
@@ -408,8 +410,8 @@ def run_scanpy_de(
408410

409411
@staticmethod
410412
def string_for_output_match(arguments):
411-
cleaned_cluster_name = re.sub(r'\W+', '_', arguments["cluster_name"])
412-
cleaned_annotation_name = re.sub(r'\W+', '_', arguments["annotation_name"])
413+
cleaned_cluster_name = re.sub(r'\W', '_', arguments["cluster_name"])
414+
cleaned_annotation_name = re.sub(r'\W', '_', arguments["annotation_name"])
413415
files_to_match = f"{cleaned_cluster_name}--{cleaned_annotation_name}*.tsv"
414416
return files_to_match
415417

0 commit comments

Comments
 (0)