Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Appending /1 or /2 to read identifiers (illumina 1.8+ format)

    Hello,

    I've just started working with Illumina 1.8+ format fastq files, and the read identifiers don't contain the /1 or /2 suffixes for PE reads any more, and this information is contained in column 2.

    I'm not scripting savvy, and i'm just using a very clumsy perl script to add this information:

    Code:
    perl -e ' while(<>) { @cols=split("\t", $_); $cols[0] = "$cols[0]/1"; print "$cols[0]\t$cols[1]\t$cols[2]\t$cols[3]\t$cols[4]\t$cols[5]\t$cols[6]\t$cols[7]\t$cols[8]\t$cols[9]\t$cols[10]\t$cols[11]"; } exit '
    I'm wondering if anyone can share a good sed or awk command or script to do this more efficiently/quickly as I'm working with a few Gb to tens of Gb+ sized files. I've been trying but can't get the syntax right.

    thanks,

  • #2
    From what I can see the new fastq files are space delimited, not tab. Since only the header line should contain any spaces you could probably get away with something as simple as:

    Code:
    perl -pe 's/ /\/1 /'
    which should be pretty quick.

    Comment


    • #3
      But, if you really want a sed solution, the equivalent would be:

      Code:
      sed -e 's% \([0-9]\)%/\1 %'
      or just:

      Code:
      sed -e 's% %/%'
      if you want the exact results that Simon's perl one-liner would give you. But the reads I deal with are nearly always indexed, so they look like:

      @H-148:620D1KACXX:8:1101:1853:1942 2:Y:0:GCCAAT
      So, I don't know what havoc the extra fields will play. My first sed expression results in:

      @H-148:620D1KACXX:8:1101:1853:1942/2 :Y:0:GCCAAT
      whereas the second gives:

      @H-148:620D1KACXX:8:1101:1853:1942/2:Y:0:GCCAAT
      Oh, one other I have to include because it highlights a power that sed has, but perl does not:

      Code:
      sed -e 's% %/%' -e 's/:/ /7'
      it gives the (possibly more desirable)

      @H-148:620D1KACXX:8:1101:1853:1942/2 Y:0:GCCAAT
      result. Get it? The final "7" denotes that sed should do the substitution the seventh time it sees ":" on the line! Not a feature in perl s/// commands! Although, no doubt, someone will be able to dig up a pragma that will confer this ability upon perl.

      --
      Phillip

      Comment


      • #4
        Thanks for the help.

        that sed function is really cool. I really need to sit down and learn these things properly...

        Comment

        Latest Articles

        Collapse

        • seqadmin
          Current Approaches to Protein Sequencing
          by seqadmin


          Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
          04-04-2024, 04:25 PM
        • seqadmin
          Strategies for Sequencing Challenging Samples
          by seqadmin


          Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
          03-22-2024, 06:39 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by seqadmin, 04-11-2024, 12:08 PM
        0 responses
        31 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 10:19 PM
        0 responses
        33 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-10-2024, 09:21 AM
        0 responses
        28 views
        0 likes
        Last Post seqadmin  
        Started by seqadmin, 04-04-2024, 09:00 AM
        0 responses
        53 views
        0 likes
        Last Post seqadmin  
        Working...
        X