I had the hardest time doing the very same thing. Then I learned a few things that helped immensely. For one, getting rid of whatever low end there is in your sample via EQing and filtering will help getting rid of any bass signals that conflict with your bassline that you are laying down. As well, a good ass trick I read was to play your bassline one octave higher, and then bring it down one octave once you are satisfied with what you came up with. It becomes so much easier (for me at least) to find the root key and make sure that your bassline goes well with the melody you are trying to create because you can hear it moreso than feel it when its an octave higher. And I would also advise that you try to start off simple and don't get to elaborate with your basslines. Follow the direction of the sample arrangement you came up with, and eventually with practice you will be able to make more and more complex basslines.