Tolerate discrepancies in MLST profile file #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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