fix: keep FlyBase gene nan when reading 10x mtx - #4329
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4329 +/- ##
=======================================
Coverage 81.92% 81.93%
=======================================
Files 134 134
Lines 13027 13030 +3
=======================================
+ Hits 10673 10676 +3
Misses 2354 2354
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
I doubt "nan" will ever appear as truly meaning a nullish value in any TSV file. If this is a concern we can technically filter out "nan" only for Drosophila analyses. But then again maybe someone will try to splice it into another organism :) |
7200f5b to
155cc30
Compare
155cc30 to
dbb30f8
Compare
|
Thanks! First a rant I can’t keep myself from: I hate CSV/TSV 😭 I’ve been telling people my whole career they should avoid it yet I have little success, and bullshit like this makes it into some industry standard. For this PR, I like that you protect against drift, but I changed it to be simpler: pd.read_csv(path, sep="\t", header=None, dtype=str, na_filter=False, quoting=csv.QUOTE_NONE)and removed the |
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
|
@flying-sheep thanks for the review and corrections, yes we would all be happier without CSV/TSV. Your fix is much simpler, the drift protection was overkill. History taught me not to leave Mr. Meeseeks unhappy for too long, so I created #4377 as instructed |
FlyBase has a real gene named
nan.read_10x_mtxreadsgenes.tsv/features.tsvwithpd.read_csv, and pandas treatsnanas missing by default, so that symbol disappeared. That showed up ascalculate_qc_metricsblowing up aftervar_names.str.startswith(...)(#1259, also #1708), or as a silently wrong identifier.This keeps lowercase
nanas a gene name and still treats the rest of pandas’ NA tokens (NaN,NA, and so on) as missing. The default token list is copied in the reader so production code does not importpandas._libs; a test compares that copy to pandas so we notice if it drifts.barcodes.tsvis unchanged.