0

I have two fasta files as shown below,

File:1

>Contig_1:90600-91187 
AAGGCCATCAAGGACGTGGATGAGGTCGTCAAGGGCAAGGAACAGGAATTGATGACGGTC

>Contig_98:35323-35886
GACGAAGCGCTCGCCAAGGCCGAAGAAGAAGGCCTGGATCTGGTCGAAATCCAGCCGCAG               

>Contig_24:26615-28387
GCTGCGGCGCTGATCCTGGCGGCCCGCGCCGAGGAGATCGCCCGTTTGGAGCGCGGCGAA

File2

>Contig_1:90600-91187
GACCGTCATCAATTCCTGTTCCTTGCCCTTGACGACCTCATCCACGTCCTTGATGGCCTT 

>Contig_24:26615-28387
TTCGCCGCGCTCCAAACGGGCGATCTCCTCGGCGCGGGCCGCCAGGATCAGCGCCG

Both files are having same fasta headers but varied with their sequences. I need to replace File:2 sequences in File:1 as shown below,

Expected outcome:

>Contig_1:90600-91187
GACCGTCATCAATTCCTGTTCCTTGCCCTTGACGACCTCATCCACGTCCTTGATGGCCTT 

>Contig_98:35323-35886
GACGAAGCGCTCGCCAAGGCCGAAGAAGAAGGCCTGGATCTGGTCGAAATCCAGCCG 

>Contig_24:26615-28387
TTCGCCGCGCTCCAAACGGGCGATCTCCTCGGCGCGGGCCGCCAGGATCAGCGCCG

I tried with cat command, but it is concatenating all the sequences. But, I need to replace File1 sequences with File2 sequences.

  • It seems important to know file details like where are line breaks, so I reformatted the text as being reformatted, but sometimes your data had newlines before the sequence, sometines not. Please check whether the lines are correct now – Philippos Jun 11 at 10:13
  • 1
    I think @Philippos inadvertently removed some of the fasta description lines, but even before the edits the "fasta files" didn't seem correct. Please edit the text and make sure that the rendered output is correct. – Sparhawk Jun 11 at 10:16
  • 2
    I see you edited it, but you needed to check the rendered output like I said. The > characters are markdown for quotes. Anyway, I've fixed it for you now. – Sparhawk Jun 11 at 10:52
  • Thank you all for your time and help. – user357294 Jun 11 at 10:54
  • Can you rephrase your question in computing terms? You'll hit a far wider audience of potential answerers if you do. – roaima Jun 11 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.