Skip to content

Commit e70980b

Browse files
committed
fix: do not drop na values; keep as much data as possible
Signed-off-by: Josh Loecker <joshloecker@icloud.com>
1 parent 32d7b80 commit e70980b

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

main/como/rnaseq_preprocess.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ async def _write_counts_matrix(
367367
final_matrix = final_matrix[["ensembl_gene_id", *rna_specific_sample_names]]
368368

369369
output_counts_matrix_filepath.parent.mkdir(parents=True, exist_ok=True)
370-
final_matrix.dropna(inplace=True)
371370
final_matrix.to_csv(output_counts_matrix_filepath, index=False)
372371
logger.success(f"Wrote gene count matrix for '{rna.value}' RNA at '{output_counts_matrix_filepath}'")
373372
return final_matrix
@@ -682,7 +681,7 @@ async def read_counts(file: Path) -> list[str]:
682681
)
683682

684683
# Remove NA values from entrez_gene_id dataframe column
685-
return conversion["entrez_gene_id"].dropna().tolist()
684+
return conversion["entrez_gene_id"].tolist()
686685

687686
logger.info("Fetching gene info - this can take up to 5 minutes depending on the number of genes and your internet connection")
688687
genes = set(chain.from_iterable(await asyncio.gather(*[read_counts(f) for f in counts_matrix_filepaths])))
@@ -709,7 +708,6 @@ async def read_counts(file: Path) -> list[str]:
709708

710709
gene_info = gene_info[((~gene_info["entrez_gene_id"].isna()) & (~gene_info["ensembl_gene_id"].isna()) & (~gene_info["gene_symbol"].isna()))]
711710
gene_info.sort_values(by="ensembl_gene_id", inplace=True)
712-
gene_info.dropna(inplace=True)
713711

714712
output_filepath.parent.mkdir(parents=True, exist_ok=True)
715713
gene_info.to_csv(output_filepath, index=False)

0 commit comments

Comments
 (0)