Replace Ambigious codons with Amino acid sequences
1
0
Entering edit mode
4.7 years ago

I have two multi-fasta files, one contains nucleotide sequences, and a subset of nucleotide sequence for ORF1 is:

>ORF1_BnaA03g18710D_S45:82:1509
ATGGCCGCCGCAGTTTCCACCGTCGGTGCCATCAACAGAGCTCCGTTGAGCTTGAACGGG
TCAGGAGCAGGAGCTGCTTCAGTCCCAGCTACGACCTTCTTGGGAAAGAAAGTTGTAACC
GCGTCGAGATTCACACAGAGCAACAACAAGAAGAGCAACGGATCATTCAAAGTGGTCGCT
GTCAAAGAAGACAAACAAACCGATGGAGACAGATGGAGGGGACTTGCCTACGACACGTCT
GATGATCAACAAGACATCACCAGAGGCAAAGGTATGGTTGACTCTGTCTTCCAAGCTCCC
ATGGGAACCGGAACTCACAATGCCGTTCTTAGCTCCTATGAGTACATTAGCCAAGGTCTT
AAGCAGTACAACTTGGACAACATGATGGATGGGCTTTACATTGCTCCTGCATTCATGGAC
AAGCTTGTTGTTCACATCACCAAGAACTTCTTGACTTTACCTAACATCAAGGTTCCACTT
ATTTTGGGTATTTGGGGAGGCAAAGGTCAAGGTAAATCCTTCCAGTGTGAGCTTGTCATG
GCCAAGATGGGCATTAACCCAATCATGATGAGTGCTGGAGAGCTTGAGAGTGGAAACGCA
GGAGAACCAGCCAAGCTGATCCGTCAAAGGTACCGTGAAGCAGCAGACATGATCAAAAAG
GGAAAAATGTGTTGTCTATTCATCAACGATCTCGACGCTGGTGCTGGTCGTATGGGTGGT
ACTACYYAGTACACAGTCAACAACCWGATGGTTAACGCAACCYTCATGAACMTTGCTGAT
AACCCAACCAACGTCCAGCTCCCGGGAATGTACAACAAGGAAGAAAACGCACGTGTCCCC
ATCATCGTCACCGGTAACGATTTCTCCACTCTCTACGCACCTCTCATCCGTGACGGGCGT
ATGGAGAARTTCTACTGGGCACCCACACGTGAGGACCKTATTGGTGTCTGCAAGGGTATC
TTCAGGACTGATAACGTTAAGGATGAAGACATTGTCACGCTTGTTGACCAGTTCCCTGGA
CAATCTATCGATTTCTTTGGTGCATTGAGGGCGAGAGTGTACGATGATGAAGTGAGGAAG
TTCGTTGAGGGACTTGGAGTKGAGAAGATAGGAAAGAGGCTGGTGAACTCTAGGGAAGGT
CCTCCAGTGTTCGAGCAACCAGCGATGACTCTTGAGAAGCTTATGGAGTACGGAAACATG
CTTGTGATGGAGCAAGAGAACGTCAAGAGAGTCCAACTTGCTGACCAATACCTTAACGAG
GCTGCCTTGGGAGACGCAAACGCGGACGCCATTGGCCGCGGAACTTTCTATGGGAAAGCA
GCACAGCAAGTGAACCTTCCTGTTCCAGAAGGGTGTACTGATCCTCAAGCCGACAACTTT
GATCCAACAGCTAGAAGTGATGATGGAACTTGTGTCTACAACTTTTGA

The second file contains the corresponding amino acid sequences and subset is:

>ORF1_BnaA03g18710D_S45:82:1509
MAAAVSTVGAINRAPLSLNGSGAGAASVPATTFLGKKVVTASRFTQSNNKKSNGSFKVVA
VKEDKQTDGDRWRGLAYDTSDDQQDITRGKGMVDSVFQAPMGTGTHNAVLSSYEYISQGL
KQYNLDNMMDGLYIAPAFMDKLVVHITKNFLTLPNIKVPLILGIWGGKGQGKSFQCELVM
AKMGINPIMMSAGELESGNAGEPAKLIRQRYREAADMIKKGKMCCLFINDLDAGAGRMGG
TTXYTVNNXMVNATXMNJADNPTNVQLPGMYNKEENARVPIIVTGNDFSTLYAPLIRDGR
MEKFYWAPTREDXIGVCKGIFRTDNVKDEDIVTLVDQFPGQSIDFFGALRARVYDDEVRK
FVEGLGVEKIGKRLVNSREGPPVFEQPAMTLEKLMEYGNMLVMEQENVKRVQLADQYLNE
AALGDANADAIGRGTFYGKAAQQVNLPVPEGCTDPQADNFDPTARSDDGTCVYNF

Now the problem is for some amino acids we have X (the above sequence contains 4 x) instead of amino acid, I am interested to check the corresponding nucleotide sequence for these ambiguous codons, check possible combinations for ambigious nucloeide, and replace with correct amino acids using Codon table.

For example for the first X position which is at position 243 in sequence (TTXYTV), the nucleotide sequence for this x is yag, where Y corresponds to C or T (y=c/t), so the possible combination would be CAG or TAG, CAG codes for Gln(Q) (cag=Gln (Q)), and TAG codes for stop codons (tag= stop codon).

The output may be saved in excel format something like the following image or any suitable format.

image

Any help will be highly appreciated.

RNA-Seq sequence • 1.9k views
ADD COMMENT
0
Entering edit mode

Let's say the possible combinations allow for 2 different amino acids. How would you pick the 'right" one?

ADD REPLY
0
Entering edit mode

I would like to keep both combinations, in the sequence a the yag will become cag and codes for Q, while in the sequence b the yag will become tag and reflects stop codon (*) and the outputs would be like these:

>ORF1_BnaA03g18710D_S45:82:1509_a
MAAAVSTVGAINRAPLSLNGSGAGAASVPATTFLGKKVVTASRFTQSNNKKSNGSFKVVA
VKEDKQTDGDRWRGLAYDTSDDQQDITRGKGMVDSVFQAPMGTGTHNAVLSSYEYISQGL
KQYNLDNMMDGLYIAPAFMDKLVVHITKNFLTLPNIKVPLILGIWGGKGQGKSFQCELVM
AKMGINPIMMSAGELESGNAGEPAKLIRQRYREAADMIKKGKMCCLFINDLDAGAGRMGG
TTQYTVNNXMVNATXMNJADNPTNVQLPGMYNKEENARVPIIVTGNDFSTLYAPLIRDGR
MEKFYWAPTREDXIGVCKGIFRTDNVKDEDIVTLVDQFPGQSIDFFGALRARVYDDEVRK
FVEGLGVEKIGKRLVNSREGPPVFEQPAMTLEKLMEYGNMLVMEQENVKRVQLADQYLNE
AALGDANADAIGRGTFYGKAAQQVNLPVPEGCTDPQADNFDPTARSDDGTCVYNF

>ORF1_BnaA03g18710D_S45:82:1509_b
MAAAVSTVGAINRAPLSLNGSGAGAASVPATTFLGKKVVTASRFTQSNNKKSNGSFKVVA
VKEDKQTDGDRWRGLAYDTSDDQQDITRGKGMVDSVFQAPMGTGTHNAVLSSYEYISQGL
KQYNLDNMMDGLYIAPAFMDKLVVHITKNFLTLPNIKVPLILGIWGGKGQGKSFQCELVM
AKMGINPIMMSAGELESGNAGEPAKLIRQRYREAADMIKKGKMCCLFINDLDAGAGRMGG
TT*YTVNNXMVNATXMNJADNPTNVQLPGMYNKEENARVPIIVTGNDFSTLYAPLIRDGR
MEKFYWAPTREDXIGVCKGIFRTDNVKDEDIVTLVDQFPGQSIDFFGALRARVYDDEVRK
FVEGLGVEKIGKRLVNSREGPPVFEQPAMTLEKLMEYGNMLVMEQENVKRVQLADQYLNE
AALGDANADAIGRGTFYGKAAQQVNLPVPEGCTDPQADNFDPTARSDDGTCVYN

And I think these will be better alternative as compared to excel format.

ADD REPLY
1
Entering edit mode

You should look for a way to expand regexes - some piece of code that can take [bcr]at as input and give you bat cat rat. Once you have that, you should linearize your nucleotide FASTA and replace all ambiguous codes with their corresponding regexes (Y would become [CT] for example). Then, apply the regex expansion algorithm to the sequence field of your linearized fasta and you'd get multiple sequences per header. Use a custom awk to write each resultant sequence with a suffixed header and you'll be all set.

The key is the regex expansion algorithm though, that's what you'll need to find here.

ADD REPLY
0
Entering edit mode
4.7 years ago
Asaf 10k

You can use sed to write each nucleotide in a line. For instance if the file name is /tmp/r1.fa:

tail -n +2 /tmp/r1.fa |tr -d "\n" | sed 's/\(...\)/\1\n/g' |cat -n

You can do the same for the AA file, just remove two dots from the expression in the sed.

ADD COMMENT
0
Entering edit mode

I don't think this answers OP's question at all.

ADD REPLY
0
Entering edit mode

Yeah, I don't do excel. Closest he'll get.

ADD REPLY
1
Entering edit mode

It's not about Excel, I think. We should help OP with the ambiguous nucleotides, not help them with their Excel requirements. Also, in their reply to my comment, OP has clarified that they want a multi-fasta, not a spreadsheet.

ADD REPLY
0
Entering edit mode

I read it as finding a way to find corresponding nucleotides and AA, I think my solution gives him a way to do so, it will require some manual work but unless he wants to write some code I don't know a tool that can do that.

ADD REPLY

Login before adding your answer.

Traffic: 2516 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6