Hi, I have two files, one is protein sequences of a group of genes, and the other is their corresponding nucleotide sequences.
>maker-scaffold10x_338_pilon-snap-gene-0.71-mRNA-1
MHLKNGDPKPTIKPNQCTLFGFRFCPYVDRVRMVLQYYNVPHDNVWIHLYSKPDWYLELY
PVGKVPLLITKEGKTIVESDAIIRYLDETIGNKSLMSLCGEAEFERAGKLASKLMAQSHG
ILFGASVAEANASAYRDVCQEINDTIKGPYLLGDKLTLADFLLFSHVNHFEPIMARLDGL
APSDVHDLKATDQYRTKWPRLTTFLDVMRRLPCVLTVREPSQKLALFAETYRQGQPNPDL
>augustus_masked-scf7180006947290-processed-gene-0.5-mRNA-1
MSEIRSLNIFDANSQNSSEFRRNIPDFLRPYECYRCVIGKKKPDDVEYICRYSLSCLGDC
AKEKDYARYLEMKPCIFLQVNKVYGWIPDIVGENLLVKCFGKVGLIKIILNSITPEIVFN
YFGIKYDKVLINLQDKPEWFLKMYPEGKVPFIIDKQRQLGDSEIIIRDYDSKNNNKLITA
CGEEKFSETKDLISSFFGLCYTILFKDNKISDENADLFLKALEKVEAKIVGPFMWGDQLS
LADVILFTHLNMFECSLSRIEGIHPDQVKDGYPNAAREASFVKIPAYLKQMRNHSAVKDV
YVHPNDISKYAVGLRIGKPNPEGDN
>DILT_0000424901-mRNA-1
MGWVLGGDGSFLPTGCANHGDPEPSVNPENVTLYDMQFCPYCQRVRYTLDYHKIPYDRIL
IDLMSKPSWYLKMYPVGKVPLLLYRGKTMAESDVIMKYCDQMKGAKASLLSVCGEEGFKR
ALNLTSSVSLLLIALLRYKLLFSPDVTRADADSLKAALSNLDKAIQGPYLMDLLPFLTFE
GKELSLADLALFPFLHAWDLLISRLKDVGDDSDESAEPVAPRWPNVLKYCQLMNQKPFIM
KTAFRDDEFSKYMDTRLQAARP
>MS3_04642.1
MHLKRSDPKPLIDPNRLTLIGFRFCPYVDRVRLILSYYKIDYDLINVSLASKPEWFLKMY
PIGKVPLLLLPNEQKLPESDEIIRHIDKLYGSETLLSHCGIEEFEKVKELITGISRPSYM
IMCVQEINLCDVSLYRAACNKINDAIKGPYFTGSELSLADLILFPHLHRFEVVMGRITGK
KPEEINELNINDELRKEFPKLTEFLDTMRKQSFVIDVTIPYRIHVQYAASVLSGHANPDI
E
Here's the nucleotide sequences, I have deleted the remaining part of the last 3 sequences
>maker-scaffold10x_338_pilon-snap-gene-0.71-mRNA-1
ATGCATCTGAAAAACGGTGACCCAAAACCTACCATCAAGCCTAATCAATGTACTCTATTT
GGTTTTCGATTCTGTCCCTATGTGGATCGTGTCAGAATGGTACTCCAATATTACAACGTC
CCGCATGATAATGTTTGGATACATTTATACTCAAAACCGGATTGGTATCTGGAATTATAT
CCGGTCGGCAAAGTACCTCTTTTGATTACCAAAGAGGGGAAGACAATTGTGGAATCGGAT
GCGATTATACGGTATTTGGACGAAACGATCGGAAACAAGTCTCTGATGTCTTTGTGTGGT
GAAGCGGAGTTTGAGCGGGCCGGGAAATTGGCGTCTAAACTCATGGCTCAATCGCATGGT
ATTTTATTCGGCGCCAGTGTCGCGGAAGCTAATGCGTCTGCGTATCGTGACGTCTGTCAA
GAAATAAATGATACAATCAAGGGACCATACTTGTTGGGCGACAAGTTGACATTGGCCGAT
TTTCTGTTATTCTCTCATGTGAACCACTTCGAACCGATCATGGCTCGTTTAGACGGTCTA
GCACCCAGTGACGTTCATGATCTGAAAGCGACCGATCAGTACAGGACGAAATGGCCCCGG
TTGACCACCTTCTTGGATGTTATGCGTCGTTTGCCCTGTGTGCTTACCGTACGTGAGCCG
TCCCAAAAGCTTGCCCTTTTTGCGGAAACATATCGTCAAGGTCAACCAAATCCGGATCTA
TGA
>augustus_masked-scf7180006947290-processed-gene-0.5-mRNA-1
ATGAGTGAAATACGGAGTTTAAACATTTTCGATGCCAACAGCCAGAACTCA.......
>DILT_0000424901-mRNA-1
ATGGGCTGGGTATTAGGTGGCGACGGCTCCTTCTTACCCACCGGTTGTGCTAA.......
>MS3_04642.1
ATGCACCTCAAACGAAGTGACCCTAAACCACTGATTGATCCTAATC..........
After aligning my protein sequences, my output looks something likes (I have deleted the remaining part to reduce space):
CLUSTAL W (1.81) multiple sequence alignment
augustus_masked-scf7180006947290 MSEIRSLNIFDANSQNSSEFRRNIPD-FLRPYECYRCVIGKKKPDDVEYICRYSLSCLGD
DILT_0000424901-mRNA-1 ---MGWVLGGDGSFLPTGCANHGDPEPSVNPENV--------------------------
maker-scaffold10x_338_pilon-snap -----------------MHLKNGDPKPTIKPNQC--------------------------
MS3_04642.1 -----------------MHLKRSDPKPLIDPNRL--------------------------
... *. : *
augustus_masked-scf7180006947290 CAKEKDYARYLEMKPCIFLQVNKVYGWIPDIVGENLLVKCFGKVGLIKIILNSITPEIVF
DILT_0000424901-mRNA-1 --------TLYDMQFCPYCQRVR----------------------------------YTL
maker-scaffold10x_338_pilon-snap --------TLFGFRFCPYVDRVR----------------------------------MVL
MS3_04642.1 --------TLIGFRFCPYVDRVR----------------------------------LIL
:. * : : . :
augustus_masked-scf7180006947290 NYFGIKYDKVLINLQDKPEWFLKMYPEGKVPFIIDK-QRQLGDSEIIIRDYDSKNNNK--
DILT_0000424901-mRNA-1 DYHKIPYDRILIDLMSKPSWYLKMYPVGKVPLLLYR-GKTMAESDVIMKYCDQMKGAKAS
maker-scaffold10x_338_pilon-snap QYYNVPHDNVWIHLYSKPDWYLELYPVGKVPLLITKEGKTIVESDAIIRYLDETIGNK-S
MS3_04642.1 SYYKIDYDLINVSLASKPEWFLKMYPIGKVPLLLLPNEQKLPESDEIIRHIDKLYGSE-T
.*. : :* : : * .**.*:*::** ****::: . : :*: *:. *. . :
The challenge I'm having is generating a new file containing the nucleotide sequences matching the sequence ID (the alignment software shortens the sequence ID to 32 characters I think) and the order newly assigned to them the alignment software (especially if I have loads of sequences to align). The nucleotide sequences should now look like (I've deleted some of the nucleotide sequences):
>augustus_masked-scf7180006947290
ATGAGTGAAATACGGAGTTTAAACATTTTCGATGCCAACAGCCAGAACTCATCAGAATTT
AGACGTAATATTCCAGATTTCCTGAGACCCTATGAGTGTTATCGCTGTGTTATCGGGAAA
AAGAAGCCGGATGATGTTGAATACATTTGCAGATATTCTCTGTCATGTTTAGGTGATTGT
GCAAAAGAAAAGGACTATGCAAGGTATCTGGAAATGAAACCCTGCATTTTTCTTCAAGTC
AATAAAGTTTATGGCTGGATTCCAGACATTGTTGGTGAAAATTTACTCGTGAAATGTTTC
GGAAAGGTCGGTTTAATTAAAATTATATTAAATAGTATAACACCTGAAATTGTATTCAAC
TACTTCGGGATCAAATATGACAAGGTTCTAATAAATCTACAGGATAAACCTGAATGGTTT
CTCAAAATGTACCCTGAAGGCAAGGTTCCATTCATCATTGATAAACAGAGACAACTTGGT
GACTCTGAGATTATCATTCGAGACTATGACTCAAAGAACAATAATAAATTGATTACTGCC
TGTGGCGAAGAAAAGTTTTCTGAAACTAAAGATCTCATCTCAAGCTTCTTTGGCCTTTGC
TATACCATTCTCTTCAAGGATAATAAAATTTCCGATGAGAATGCTGATCTCTTCTTGAAA
GCTCTCGAGAAGGTTGAAGCGAAAATTGTTGGCCCCTTCATGTGGGGAGATCAACTATCT
CTAGCCGATGTAATTCTCTTCACACATTTGAACATGTTCGAGTGCTCTTTATCGAGAATC
GAGGGAATTCATCCTGACCAAGTGAAAGATGGTTATCCCAATGCCGCAAGGGAAGCTAGC
TTCGTCAAGATTCCCGCCTATCTGAAGCAAATGAGAAATCACTCTGCAGTTAAAGATGTC
TACGTTCATCCTAATGATATTTCCAAGTACGCTGTCGGTTTAAGAATTGGAAAGCCAAAT
CCGGAAGGCGATAACTAG
>DILT_0000424901-mRNA-1
ATGGGCTGGGTATTAGGTGGCGACGGCTCCTTCTTACCCACCGG.......
>maker-scaffold10x_338_pilon-snap
ATGCATCTGAAAAACGGTGACCCAAAACCTACCA..........
>MS3_04642.1
ATGCACCTCAAACGAAGTGACCCTAAACCACTGATTGATCCTAAT.........
I need the final nucleotide sequences file and the alignment file for another analysis, but I am stuck. How can I do this? been thinking of python, but my scripting skills aren't best yet. Any advice? Apologies for the long post. Thanks kay
shenwei356 : Do you need to add anything to the command to recognize fasta names that are truncated to first 32 characters? It looks like the alignment software is doing that.
thanks for your reply, but would for few sequences, I'm talking of when I have like 50 sequences (or more).
Also, Im not sure if truncating the sequence ID truncated to 32 characters makes Identifying unique, it appears it just truncates them, meaning in case of sequences where sequences have similar ID within the 32 characters, identifying them may be an issue.
thanks
According what you mentioned in another similar post, the MSA software can save aligment result in FASTA file, where sequence ids are not truncted. I also remember some MSA tools indeed support this, like clustalo/clustalw.
So, you can just output the sequence headers
thanks, figured another way to do it using a script.
Assuming alignment file is also in fasta file, and the sequence ID is not truncated. Is it possible to sort my nucleotides then to have something like:
using this approach I will have to extract the new sequence ID from the alignment file and write it to a new file:
and then use
csvtk sort
, what if I have many sequences?The desired output looks like it is just sorted sorted by sequence name. Shouldn't be
seqkit sort
enough to do the job? Truncating the names could than be done by a littleawk
script.fin swimmer