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

Coerce PMID column into string not integer #212

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading