From 2c69fcd278ef19abc6a0cc6ea6056b4fe4ef8ff2 Mon Sep 17 00:00:00 2001 From: gravitogen <48878052+gravitogen@users.noreply.github.com> Date: Thu, 8 Oct 2020 15:39:37 -0700 Subject: [PATCH] Use comma instead of tab character Many editors replace tab with spaces automatically and tab is not a visible character. It is better to use comma as delimiter. --- loompy/bus_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loompy/bus_file.py b/loompy/bus_file.py index 025b5eb..8049af9 100644 --- a/loompy/bus_file.py +++ b/loompy/bus_file.py @@ -133,7 +133,7 @@ def load_sample_metadata(path: str, sample_id: str) -> Dict[str, str]: else: result = {} with open(path) as f: - headers = [x.lower() for x in f.readline()[:-1].split("\t")] + headers = [x.lower() for x in f.readline()[:-1].split(",")] if "sampleid" not in headers and 'name' not in headers: raise ValueError("Required column 'SampleID' or 'Name' not found in sample metadata file") if "sampleid" in headers: @@ -142,7 +142,7 @@ def load_sample_metadata(path: str, sample_id: str) -> Dict[str, str]: sample_metadata_key_idx = headers.index("name") sample_found = False for line in f: - items = line[:-1].split("\t") + items = line[:-1].split(",") if len(items) > sample_metadata_key_idx and items[sample_metadata_key_idx] == sample_id: for i, item in enumerate(items): result[headers[i]] = item