Dear All,
I have a bunch of position specific mutation file and sequences file both. I want to mutate that sequences with given position as examples
Mutation Position
G10M (at position of 10 mutated G to M) Similarly
Y70K ( at position of 70 residue mutated Y to K
>P00519
MLEICLKLVGCKSKKGLSSSSSCYLEEALQRPVASDFEPQGLSEAARWNSKENLLAGPSE
NDPNLFVALYDFVASGDNTLSITKGEKLRVLGYNHNGEWCEAQTKNGQGWVPSNYITPVN
SLEKHSWYHGPVSRNAAEYLLSSGINGSFLVRESESSPGQRSISLRYEGRVYHYRINTAS
Output
> P00519
MLEICLKLV`M`CKSKKGLSSSSSCYLEEALQRPVASDFEPQGLSEAARWNSKENLLAGPSE
NDPNLFVAL`K`DFVASGDNTLSITKGEKLRVLGYNHNGEWCEAQTKNGQGWVPSNYITPVN
SLEKHSWYHGPVSRNAAEYLLSSGINGSFLVRESESSPGQRSISLRYEGRVYHYRINTAS
if any one have such code please send me.. thanks
1 answer
Try the following script. It's not very well tested but I've written it to catch some of the more obvious errors.
Caveats:
You must have a mutation map file which looks like this:
>SeqID1,A123B >SeqID2,X234Y .... >SeqIDn,YNNNZAnything else, and it'll break. You should be able to lose the
>without it mattering, but this brings me on to caveat number 2The IDs in your mapfile and your sequences must be identical. i.e. if you have a mutation that reads
SeqID1,A123Bthe corresponding sequence must be calledSeqID1. There are ways around this, but this will suffice for the time being I think, so test it and see how you get on.- Your mutation file should be put together with 1-based indexing (the script does the necessary conversion). i.e., the first base/residue should be number 1, not 0 (which is what python understands).
Some other disclaimers, I've only tested this with one mutation per sequence so far. It should handle multiple, but the terminal display may freak out, so you might need to ignore that. You'll need BioPython installed.
Invoke it like so:
$ python Mutate.py -v -o /path/to/output.fasta mutation_map_file.csv input.fasta
https://github.com/jrjhealey/bioinfo-tools/blob/master/Mutate.py
Log in to answer this question.
I added markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:
Please show us what you tried to solve this and didn't work. We rather point you in the right direction if you show some effort yourself.
In addition, you selected "tutorial", while this is clearly a question. I changed the post type.
Finally, you use the "sequence" and "software error" tag for this question, while these are not accurate. Please use appropriate tags. As such experts can easily find your question and help you.
Do you have a mutation mapfile with sequence names? I assume you want to do this with more than one sequence at a time?
Yes, I have multiple files and want to do with mutation multiple times in a single file.
Ok, to properly automate this you will really need a second input file which maps, to each sequence name (ideally), the positions and substitutions to be made.
Can you show us an example of such a file? A simple tab/comma separated file would do, something like:
Yes... Similar file I have which u written..
Thanks for sharing some details - in this case, your solution is pretty trivial. Use any programming language you're familiar with and use this pseudocode as template.
I tend to recommend Perl for these sort of string operations, but Python is widely used now, too.
So, show us it......
You really need to put more effort in your question. We cannot read what's on your screen or guess how your input files look like. We are a group of volunteers and we are helping you on free Sunday. Show some respect and don't make this too hard for us.
This post is NOT A TUTORIAL. I have changed it AGAIN to a question.
It also is not a "software error". Please use logical tags. In this case you want to mutate positions in an amino acid fasta.
Please show us what you tried to solve this and didn't work. We rather point you in the right direction if you show some effort yourself.