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
              16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
              by SEQadmin2




              NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification, detection...
              Today, 06:46 AM
            • 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

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 10-28-2026, 09:57 AM
            0 responses
            22 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-28-2026, 09:51 AM
            0 responses
            14 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-22-2026, 11:13 AM
            0 responses
            67 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-22-2026, 10:48 AM
            0 responses
            47 views
            0 reactions
            Last Post SEQadmin2  
            Working...