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

Separated fit and transform steps. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Separated fit and transform steps. #4

wants to merge 1 commit into from

Conversation

iacobo
Copy link

@iacobo iacobo commented Aug 2, 2019

If one sequence has e.g. only CGT the old code will inconsistently assign integers to each letter if other sequences have a different set of letters (i.e. ACG or ACGT). Not problematic for long sequences which are very unlikely to not use all 4 letters, but if e.g. applying to small k-mers very likely to produce errors.

i.e. integer_encoder.fit_transform(list('CGT')) != integer_encoder.fit_transform(list('ACGT'))

Solution: grab alphabet of all letters in all sequences first and fit before transforming each sequence in loop.

If one sequence has e.g. only CGT the old code will inconsistently assign integers to each letter if other sequences have all letters. 

i.e. integer_encoder.fit_transform(list('CGT')) != integer_encoder.fit_transform(list('ACGT'))

Solution: grab alphabet of all letters in all sequences first and fit before transforming each sequence in loop.
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

Successfully merging this pull request may close these issues.

1 participant