Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Sequence.replace #1222

Closed
gregcaporaso opened this issue Dec 8, 2015 · 3 comments
Closed

add Sequence.replace #1222

gregcaporaso opened this issue Dec 8, 2015 · 3 comments
Assignees

Comments

@gregcaporaso
Copy link
Contributor

This should likely take a boolean vector and a character to assign to all sequence positions corresponding to True values in the boolean vector. This would be useful, for example, for replacing all gap characters with the default gap character, or all degenerate characters with a single degenerate character (likely N).

@ebolyen
Copy link
Contributor

ebolyen commented Dec 8, 2015

Depending on how people feel, we could also support both of these statements:

with sequence.replace(mutate=True) as raw:
    raw[[3, 2, 1]] = [b'A', b'C', b'T']

and

sequence.replace([3, 2, 1], 'N')

@jairideout
Copy link
Contributor

👎 for the first example. I think sequence data should remain immutable unless we have a real need for mutability. If we want to support mutability, the __setitem__ API is likely more intuitive for users:

sequence[[3, 2, 1]] = [b'A', b'C', b'T']

@ebolyen
Copy link
Contributor

ebolyen commented Dec 8, 2015

Good point

@ebolyen ebolyen added this to the 0.4.2 Tentative Milestone milestone Jan 5, 2016
@gregcaporaso gregcaporaso modified the milestone: 0.4.2 Tentative Milestone Jan 5, 2016
@ebolyen ebolyen added this to the 0.5.0: Python 3 support only milestone Feb 18, 2016
kestrelgorlick added a commit to kestrelgorlick/scikit-bio that referenced this issue Feb 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants