Skip to content

Commit

Permalink
Merge pull request #212 from phac-nml/fix-pointfinderdatabase-PMID-co…
Browse files Browse the repository at this point in the history
…lumn

Coerce PMID column into string not integer
  • Loading branch information
apetkau authored Dec 10, 2024
2 parents 3507992 + 1e15db7 commit 26770da
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions staramr/blast/pointfinder/PointfinderDatabaseInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ def from_file(cls, file):

with open(file) as f:
line = f.readline()

line = line.lstrip("#")
column_names = line.split()

pointfinder_info = pd.read_csv(file, sep=r'\t|\s{4,}', index_col=False, comment='#', header=None, names=column_names, engine='python')
pointfinder_info["PMID"] = pointfinder_info["PMID"].astype(str)

return cls(pointfinder_info, file)

Expand All @@ -53,7 +54,7 @@ def from_pandas_table(cls, database_info_dataframe):
:return: A new PointfinderDatabaseInfo.
"""
return cls(database_info_dataframe)

@staticmethod
def to_codons(regex_match):
# Sometimes, the regex will match a string with a comma and return multiple matches.
Expand Down Expand Up @@ -128,7 +129,7 @@ def _get_resistance_codon_match(self, gene, codon_mutation):
# so we need to convert to nucleotide coordinates before making the comparison.
& (table['Ref_codon'] == codon_mutation.get_database_amr_gene_mutation())
& (table['Res_codon'].str.contains(codon_mutation.get_input_genome_mutation(), regex=False))]

# We need to handle codon insertions as a special case:
# Pointfinder mis-reports the position of codon insertions. For example:
# ref: ACG --- ACG
Expand Down

0 comments on commit 26770da

Please sign in to comment.