Skip to content

Commit

Permalink
fix sequence of file_structure check when processing sample names
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarbranson committed Sep 9, 2024
1 parent ad4fe06 commit caf8d6f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions latools/latools.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ def __init__(self, data_path, errorhunt=False, config='DEFAULT',
data.sort(key=lambda d: d.uTime[0])

# process sample names
if (names == 'file_names') | (names == 'metadata_names'):
if file_structure == 'long':
samples = np.array([s.sample for s in data], dtype=object)
elif (names == 'file_names') | (names == 'metadata_names'):
samples = np.array([s.sample.replace(' ', '') for s in data], dtype=object) # get all sample names
# if duplicates, rename them
usamples, ucounts = np.unique(samples, return_counts=True)
Expand All @@ -292,8 +294,6 @@ def __init__(self, data_path, errorhunt=False, config='DEFAULT',
samples[ind] = new # rename in samples
for s, ns in zip([data[i] for i in np.where(ind)[0]], new):
s.sample = ns # rename in D objects
elif file_structure == 'long':
samples = np.array([s.sample for s in data], dtype=object)
else:
samples = np.arange(len(data)) # assign a range of numbers
for i, s in enumerate(samples):
Expand Down

0 comments on commit caf8d6f

Please sign in to comment.