Skip to content

Commit

Permalink
remove alpha_cased altogether
Browse files Browse the repository at this point in the history
  • Loading branch information
stolarczyk committed Feb 4, 2019
1 parent a361b7a commit 739bafa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
6 changes: 3 additions & 3 deletions peppy/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
from .exceptions import PeppyError
from .sample import merge_sample, Sample
from .utils import \
add_project_sample_constants, alpha_cased, copy, fetch_samples, is_url, \
add_project_sample_constants, copy, fetch_samples, is_url, \
non_null_value, warn_derived_cols, warn_implied_cols


Expand Down Expand Up @@ -571,15 +571,15 @@ def build_sheet(self, *protocols):
given, else all of this Project's samples
"""
# Use all protocols if none are explicitly specified.
protocols = {alpha_cased(p) for p in (protocols or self.protocols)}
protocols = {p for p in (protocols or self.protocols)}
include_samples = []
for s in self.samples:
try:
proto = s.protocol
except AttributeError:
include_samples.append(s)
continue
check_proto = alpha_cased(proto)
check_proto = proto
if check_proto in protocols:
include_samples.append(s)
else:
Expand Down
14 changes: 0 additions & 14 deletions peppy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@ def add_project_sample_constants(sample, project):



def alpha_cased(text, lower=False):
"""
Filter text to just letters and homogenize case.
:param str text: what to filter and homogenize.
:param bool lower: whether to convert to lowercase; default uppercase.
:return str: input filtered to just letters, with homogenized case.
"""
text = "".join(filter(
lambda c: c.isalpha() or c == GENERIC_PROTOCOL_KEY, text))
return text.lower() if lower else text.upper()



def check_bam(bam, o):
"""
Check reads in BAM file for read type and lengths.
Expand Down
6 changes: 2 additions & 4 deletions tests/models/integration/test_Project_Sample_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from peppy import \
Project, Sample, \
SAMPLE_ANNOTATIONS_KEY, SAMPLE_NAME_COLNAME
from peppy.utils import alpha_cased


__author__ = "Vince Reuter"
__email__ = "[email protected]"
Expand Down Expand Up @@ -199,9 +197,9 @@ def test_multiple_samples(
sheet = p.build_sheet(*protocols)
assert exp_num_samples == len(sheet)
if protocols:
fuzzy_protos = {alpha_cased(p) for p in protocols}
fuzzy_protos = {p for p in protocols}
for _, sample_data in sheet.iterrows():
assert alpha_cased(sample_data.protocol) in fuzzy_protos
assert sample_data.protocol in fuzzy_protos



Expand Down

2 comments on commit 739bafa

@vreuter
Copy link
Member

@vreuter vreuter commented on 739bafa Feb 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@nsheff
Copy link
Contributor

@nsheff nsheff commented on 739bafa Feb 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to #225 ?

Should we instead provide a suggestion?

Please sign in to comment.