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

Tolerate discrepancies in MLST profile file #5

Merged
merged 2 commits into from
Sep 21, 2016
Merged

Tolerate discrepancies in MLST profile file #5

merged 2 commits into from
Sep 21, 2016

Conversation

rrwick
Copy link
Contributor

@rrwick rrwick commented Sep 18, 2016

This PR fixes an issue with the Salmonella enterica profile file. S. enterica uses these seven genes for MLST: AROC, DNAN, HEMD, HISD, PURE, SUCA and THRA. However, the header line of the S. enterica profile file (publicSTs.txt) has extra columns and extra characters in the gene names. It looks like this:
ST EBG AROCNUM DNANNUM HEMDNUM HISDNUM PURENUM SUCANUM THRANUM SOURCE REFSTRAIN LINEAGE

This results in all stringMLST calls for S. enterica being 0. The allele calls work, but they don't match up with a sequence type. The issue seems to be that the sample's profile is a dictionary using the actual gene names:
{'HISD': '9', 'HEMD': '12', 'THRA': '2', 'SUCA': '9', 'AROC': '10', 'PURE': '112', 'DNAN': '7'}

But the profiles it tries to match against use the column names:
{'REFSTRAIN': 'S/20050005', 'THRANUM': '2', 'EBG': '1', 'HEMDNUM': '12', 'SUCANUM': '9', 'SOURCE': 'public', 'DNANNUM': '7', 'HISDNUM': '9', 'AROCNUM': '10', 'PURENUM': '112'}

The findST function was looking for exact matches between the profiles, and therefore finding nothing.

There may be more efficient or elegant ways to fix this issue, but I chose this approach because it seemed the least intrusive - for the most part I only had to modify the findST function. This function no longer looks for exact matches between the profiles. Instead, it changes the sample profile gene names to match those in the ST profiles and then looks for a match where the sample profile is contained within an ST profile.

Using the above example, the findST function now turns this sample profile:
{'HISD': '9', 'HEMD': '12', 'THRA': '2', 'SUCA': '9', 'AROC': '10', 'PURE': '112', 'DNAN': '7'}
Into this:
{'HISDNUM': '9', 'HEMDNUM': '12', 'THRANUM': '2', 'SUCANUM': '9', 'AROCNUM': '10', 'PURENUM': '112', 'DNANNUM': '7'}

And then since this ST profile contains all of the values in the sample profile, it will match (even though it also contains extra stuff):
{'REFSTRAIN': 'S/20050005', 'THRANUM': '2', 'EBG': '1', 'HEMDNUM': '12', 'SUCANUM': '9', 'SOURCE': 'public', 'DNANNUM': '7', 'HISDNUM': '9', 'AROCNUM': '10', 'PURENUM': '112'}

The one other change I made was in loadSTfromFile. This function now no longer assumes that the last column in the profile file isn't used. It now includes the last column as well, so stringMLST should tolerate profile files that contain only ST numbers and alleles.

These modifications seem to work well on my samples and on the example data included in stringMLST - I'm not sure if you have a larger test set to try it on as well. Let me know if you have any questions!

Ryan

@Takadonet
Copy link
Contributor

This PR would fix #2

@anujg30 anujg30 merged commit 213b2ed into jordanlab:master Sep 21, 2016
ar0ch pushed a commit to ar0ch/stringMLST that referenced this pull request Apr 29, 2017
Tolerate discrepancies in MLST profile file

Former-commit-id: 213b2ed
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.

3 participants