Basic help using "replace"

Apologies for my coding ignorance. I have a VCF file with identifiers such as “R01C01-1012345” or “R33C44-1234567”. I’d like to trim off the first 6 characters and the hyphen, leaving me with identifiers “1012345” and “1234567”. I’m trying to use the “replace” function, but I keep struggling with the syntax. How would you write this efficiently? Thanks!

If they always are delimited by a dash like this, you could do: id.split('-')[1]

Thanks. That does what I want to accomplish, but how can I incorporate the change into my matrix table ‘d’ with identifier field ‘s’. I tried the following:

‘’’
d.s = d.s.split(’-’)[1]
‘’’

It said that the matrix table is “not mutable”.

Hail’s interfaces are “functional” not mutable, so you’ll need to use a method like annotate/select/key_by to change fields. In this case:

mt = mt.key_cols_by(s = mt.s.split('-')[1]

That seems to work!