Hi Monks,

I have a sequence files (input_file.txt) with huge number of contigs such as (contig number does not reflect the order):

>contig number 11

tttgctcggaggggatc

>contig number 23

gaaaacacttccttattatacaggtaaaccgtatttggat

>contig number 3

aaagctcggaggggatcccct

... ..

I want to concatenate the contigs such that the above order is preserved, and also, I want to insert the sequence "nnnnncattccattcattaattaattaatgaatgaatgnnnnn" in each contig boundaries (here are two contig boundaries), such that the final output file would become as follows:

>concatenated contig tttgctcggaggggatcnnnnncattccattcattaattaattaatgaatgaatgnnnnngaaaacactt +ccttattatacaggtaaaccgtatttggatnnnnncattccattcattaattaattaatgaatgaatgn +nnnnaaagctcggaggggatcccct

For concatenation purpose, I use

perl -pe "chomp;s/>.+//" input_file.txt >output_file.txt

But I don't know how to insert the sequence in each contig boundary, plz help..


In reply to merge sequences with new sequence insertion by utpalmtbi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.