The present invention relates to a compound having formula I:and pharmaceutically acceptable salts thereof. The compounds of formula I and pharmaceutical compositions containing them are of the class of thrombin inhibitors which are useful as anticoagulants.