Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • avtsanger
    Junior Member
    • Jun 2010
    • 8

    #1

    Calculating the number of contigs in a scaffold file

    I am trying to calculate the number of contigs in a scaffold file i.e. a consensus sequence separated by n's. I have been working on an assembly generated by Newbler and have closed some of the gaps computationally or experimentally. I need to know how many contigs are left in each scaffold. Could anyone point me in the right direction?
  • nickloman
    Senior Member
    • Jul 2009
    • 355

    #2
    The file 454Scaffolds.txt generated by Newbler has the information you need.

    See http://contig.wordpress.com/2010/03/...-file/#more-56 for more information.

    Comment

    • avtsanger
      Junior Member
      • Jun 2010
      • 8

      #3
      I should clarify: the assembly was imported in to gap4 and worked on by joining contigs to the scaffold consensus and closing gaps computationally or experimentally. I can save out the updated consensus files but these will still contain n's due to the scaffold sequence that I joined in. I need to find a way of calculating the number of contigs ie. the number of sequences separated by n's in this file.

      Comment

      • westerman
        Rick Westerman
        • Jun 2008
        • 1104

        #4
        Assuming you are a unix type system, one answer is to use the 'tr' command along with 'sed' and 'wc'. First get rid of the fasta headers. Then get rid of the newlines. Then reduce all the of the 'n's to a single character. Finally delete all non-n's and then count up the remaining n's. That number will represent the number of gaps you have plus one thus the number of contigs.

        sed -e 's/>.*/n/' scaffold.fasta | tr -d '\n' | tr -s 'n' | tr -d 'acgt' | wc -c

        The above assumes only acgtn in lower case. I suspect there are as many other answers as there are people on this bulletin board.

        Comment

        • flxlex
          Moderator
          • Nov 2008
          • 412

          #5
          Originally posted by westerman View Post
          I suspect there are as many other answers as there are people on this bulletin board.
          Perhaps, but yours is hard to beat for shortness...

          Comment

          • avtsanger
            Junior Member
            • Jun 2010
            • 8

            #6
            Thanks. That's great and gives me the answer I was looking for.

            Comment

            Latest Articles

            Collapse

            • SEQadmin2
              Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
              by SEQadmin2



              Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

              Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
              ...
              10-14-2026, 09:55 AM
            • 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
              ...
              09-28-2026, 10:25 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 10-15-2026, 10:52 AM
            0 responses
            26 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-14-2026, 05:39 AM
            0 responses
            34 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-13-2026, 09:56 AM
            0 responses
            31 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-09-2026, 11:14 AM
            0 responses
            28 views
            0 reactions
            Last Post SEQadmin2  
            Working...