Skip to content

Unexpected truncation of HGVS variant string when using strip() #41

@chrisxu2016

Description

@chrisxu2016

When attempting to remove the prefix p. from an HGVS protein variant string (e.g., p.Gly34Asp) using the str.strip() method, the trailing character of the amino acid abbreviation is incorrectly removed if it matches any character in the strip set.

>>> variant = "p.Gly34Asp"
>>> variant.strip("p.")
'Gly34As'
>>> variant.strip().removeprefix("p.")
'Gly34Asp'

clean_variant = variant.strip("p.") # Remove the p. if its present

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions