Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DrD2009
    Member
    • Oct 2009
    • 88

    #1

    Script Help

    Hello everyone,

    I've been racking my brain trying to create a script to make a certain file, but I have had no success in my attempts.

    I have a file like this:
    Code:
    ACGCCGGCCA
    GTGAATTGTA
    ATACGACTCA
    CTATAGGGCG
    AATTGGGCCC
    TCTAGATG
    All I want to do is to create a file like the following:
    Code:
    1	ACGCCGGCCA
    11	GTGAATTGTA
    21	ATACGACTCA
    31	CTATAGGGCG
    41	AATTGGGCCC
    51	TCTAGATGCA
    61	TGCTCGAGCG
    71	GCCGCCAGTG
    It should be something relatively easy I'm just really missing. I've been trying it using awk, but have had little luck.

    I believe it is basically just this code:
    Code:
    awk '{print NR?????? "\t" $0}'
    I'm just not sure what the ??????????? should be. Any help with this would be great. Thanks in advance.
  • Kennels
    Senior Member
    • Feb 2011
    • 149

    #2
    If it's ok with perl, here's a simple perl one liner:

    Code:
    perl -e ' $pos=1; while(<>) { $line=$_; print "$pos\t$line"; $pos+=10; } ' inputfile.txt > outputfile.txt
    replace inputfile.txt with your file containing your reads, and outputfile.txt with a desired output file name.

    I'm assuming you want the position of the base at the start of every line. You can replace the '10' in the code if you desire another increment. The delimiter here is a tab (\t).

    Comment

    • oiiio
      Senior Member
      • Jan 2011
      • 105

      #3
      I was going to say something very similar to Kennels's answer. If you are going to be doing this kind of thing frequently, Perl is awesome!

      Comment

      • cliffbeall
        Senior Member
        • Jan 2010
        • 144

        #4
        Here is the awk:

        Code:
        awk -v N=1 '{print N "\t" $0} {N += 10}'

        Comment

        • kwatts59
          Member
          • Apr 2011
          • 46

          #5
          Use MS Excel to open the file, insert a column in the front of the data.
          Put 1 in the A1 cell. In cell B1, put the formula =A1+10. Then fill down the column.
          Then save the file as a text file, tab delimited.

          Comment

          Latest Articles

          Collapse

          • SEQadmin2
            New Genomics Technologies Take Aim at Long-Standing Limits
            by SEQadmin2


            Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

            We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
            ...
            Today, 10:25 AM
          • SEQadmin2
            How Immunogenomics Decodes Immunity’s Genetic Blueprint
            by SEQadmin2




            The immune system’s power comes from its genetic diversity, allowing myriad threats to be neutralized through first recognizing foreign antigens. That diversity is also what makes the immune system so difficult to study. Recent advances in sequencing technology and computational biology, however, are giving researchers new tools to understand immune responses and immune-related diseases in greater detail.

            This convergence of genetics, immunology, and computation...
            09-01-2026, 05:41 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, 09-25-2026, 09:06 AM
          0 responses
          27 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 09-23-2026, 11:05 AM
          0 responses
          24 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 09-18-2026, 11:37 AM
          1 response
          46 views
          0 reactions
          Last Post pekgio
          by pekgio
           
          Started by SEQadmin2, 09-16-2026, 10:23 AM
          1 response
          55 views
          0 reactions
          Last Post pekgio
          by pekgio
           
          Working...