Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • morning latte
    Member
    • Jun 2013
    • 91

    #1

    counting total bases in a fasta file

    Hello,

    I have a fasta file like below.

    >NODE_1476_length_303_cov_5.280528
    TTAAGTGGGATTTCGTTTAGTGAGGTAGGTACTTTTACTTGGATTTCCATAATTGTATAAG
    TCTTTTAGTCGTTTTTGTATTCCTTAGCCAATACATAAGAGTAGGCTTGAGCTAACATTTGA......
    >NODE_2306_length_339_cov_2.926254
    .
    .
    .

    I want to get total base-pair count from this file. I tried fastx toolkit but it did not work as my fasta format is not what fastx wants (guess fastx wants one line of sequences while mine has two lines of sequences). Could somebody suggest any tool or command for it? Thanks.
  • martinghunt
    Junior Member
    • Jul 2013
    • 5

    #2
    Here's a quick unix hack:
    grep -v ">" file.fasta | wc | awk '{print $3-$1}'

    Comment

    • morning latte
      Member
      • Jun 2013
      • 91

      #3
      Thanks, it works very well.

      Comment

      • na_sd
        Junior Member
        • Nov 2015
        • 3

        #4
        The number of contigs

        I am given a fasta file like this file that you can download it. This file is de novo assembled genome.

        I have two very simple questions:

        1- How many contigs are present in this file? (my guess: it is equal to the number of rows in the file?!)

        2- what is the total genomic length of the assembly?
        (my guess: it is 'len=245876' which has been written in the first line)

        I am new in DNA sequence analysis stuff, thanks for your kind help.

        Comment

        • GenoMax
          Senior Member
          • Feb 2008
          • 7142

          #5
          Originally posted by na_sd View Post
          The number of contigs

          I am given a fasta file like this file that you can download it. This file is de novo assembled genome.

          I have two very simple questions:

          1- How many contigs are present in this file? (my guess: it is equal to the number of rows in the file?!)
          @Brian and I had answered some of these questions in your Biostars post but looks like you are not convinced. The answers are still going to be the same.

          If you do
          Code:
          grep -c "^>" your_file
          that will give you a number for the contigs present in your file.
          2- what is the total genomic length of the assembly?
          (my guess: it is 'len=245876' which has been written in the first line)

          I am new in DNA sequence analysis stuff, thanks for your kind help.
          That may just be the length of first contig. Does each of your contigs have such a number? We don't know if the contigs you have overlap so it may not be possible to answer this question directly.

          PS: I am not going to download the file from dropbox to test.

          Comment

          • na_sd
            Junior Member
            • Nov 2015
            • 3

            #6
            Originally posted by GenoMax View Post
            @Brian and I had answered some of these questions in your Biostars post but looks like you are not convinced. The answers are still going to be the same.

            If you do
            Code:
            grep -c "^>" your_file
            that will give you a number for the contigs present in your file.


            That may just be the length of first contig. Does each of your contigs have such a number? We don't know if the contigs you have overlap so it may not be possible to answer this question directly.

            PS: I am not going to download the file from dropbox to test.

            Thanks.
            I am not convinced because my file is not like general fasta file. It has ONLY one line with '>'. The person has asked me about the number of contigs in this file and I am sure that it is greater than 1.
            I wish you had downloaded the file and then answered my question.

            Comment

            • GenoMax
              Senior Member
              • Feb 2008
              • 7142

              #7
              Originally posted by na_sd View Post
              Thanks.
              I am not convinced because my file is not like general fasta file. It has ONLY one line with '>'. The person has asked me about the number of contigs in this file and I am sure that it is greater than 1.
              I wish you had downloaded the file and then answered my question.
              If there is only one line starting with ">" in your file then

              a> Your file is either incomplete or
              b> the sequence got assembled as a single contig

              note: You appear to have removed the file from dropbox.
              Last edited by GenoMax; 09-23-2016, 06:23 AM.

              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
                ...
                Today, 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, Today, 05:39 AM
              0 responses
              9 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, Yesterday, 09:56 AM
              0 responses
              11 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-09-2026, 11:14 AM
              0 responses
              25 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 09-29-2026, 09:51 AM
              0 responses
              76 views
              0 reactions
              Last Post SEQadmin2  
              Working...