Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antoza
    Member
    • Aug 2013
    • 18

    #1

    lenght distribution range in a a fasta file

    Hi folks,

    I have to calculate the lenght distribution range in a a fasta file, for example how many sequences are less than 100 bp, how many are in their lenght from 101 to 300 bp, from 301 to 500 bases and so on.. Any script or tool for doing this job?

    Thanks in advance!
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    If you index it with "samtools faidx" the resulting ".fai" file will be a text file containing the length of each of the sequences (among other information). You could then plot the distribution in R with whatever binning strategy you want.

    Comment

    • antoza
      Member
      • Aug 2013
      • 18

      #3
      Dear dpryan,

      I have retrieved the ".fai" file and I have the lenghts of the genes that I wanted (2 columns file, first column are the gene names, second column the gene lenghts, as in the following):

      gene_120397 43056
      gene_240653 224380
      gene_150423 68254
      gene_143456 10090
      gene_141140 15291
      gene_253613 3088

      Could you please indicate me an R code for plotting these distributions as I am not so familiar with plotting in R

      Thank you!!!

      Comment

      • rnaeye
        Member
        • May 2011
        • 80

        #4
        mydata <- read.table("inputfile.txt")
        plot(mydata)

        Comment

        • arcolombo698
          Senior Member
          • Nov 2013
          • 142

          #5
          FastQC Length Distribution

          Hello.

          I believe that Fastqc has this information, but not in a fasta file.

          if anyone has used FastQC to find the length distribution, I am wondering in what conditions does it consider the distribution to be a fail or a pass.

          advice?

          Comment

          • westerman
            Rick Westerman
            • Jun 2008
            • 1104

            #6
            Originally posted by arcolombo698 View Post
            Hello.

            I believe that Fastqc has this information, but not in a fasta file.

            if anyone has used FastQC to find the length distribution, I am wondering in what conditions does it consider the distribution to be a fail or a pass.

            advice?
            From the documentation:

            Warning

            This module will raise a warning if all sequences are not the same length.

            Failure

            This module will raise an error if any of the sequences have zero length.

            Comment

            • kurban910
              Member
              • Jul 2014
              • 58

              #7
              hi @antoza,
              did you find way to solve your problem? if u did could you share your experience?
              i am facing with the same task right now.
              thanks.

              Comment

              • arcolombo698
                Senior Member
                • Nov 2013
                • 142

                #8
                FastQC does plot this information so one can visually see the distribution of length. this is a quick/easy approach.

                if you use samtools, one can plot the lengths using R.

                Comment

                • Brian Bushnell
                  Super Moderator
                  • Jan 2014
                  • 2709

                  #9
                  The BBMap package has a couple programs for this purpose:

                  stats.sh in=file.fasta shist=shist.txt
                  (only works on fasta input)

                  readlength.sh in=file.fasta out=hist.txt

                  (works on fasta, fastq, or sam)

                  The way they display output is a little different, but both are easy to plot.

                  Comment

                  • kurban910
                    Member
                    • Jul 2014
                    • 58

                    #10
                    yeah , that will work. thanks @Brian Bushnell

                    Comment

                    • kurban910
                      Member
                      • Jul 2014
                      • 58

                      #11
                      hi @arcolombo698,
                      could you be little bit more specific?!
                      how could i do what i want by using FastQC when my input file is fasta?

                      Comment

                      • kurban910
                        Member
                        • Jul 2014
                        • 58

                        #12
                        hey @arcolombo698,
                        i sued samtools got the fai file. and when i tried to do the length distribution by R i changed my gene.fa.fai file to gene.txt. then i used this commend as its mentioned by@rnaeye:

                        mydata <- read.table("gene.txt")
                        plot(mydata)

                        and got this error:

                        Code:
                        > mydata <- read.table("gene.txt")
                        > plot(mydata)
                        Error: cannot allocate vector of size 156.2 Gb
                        i am new at R, so could u explain to me where did it go wrong?

                        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-22-2026, 11:13 AM
                        0 responses
                        28 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 10-22-2026, 10:48 AM
                        0 responses
                        20 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 10-15-2026, 10:52 AM
                        0 responses
                        38 views
                        0 reactions
                        Last Post SEQadmin2  
                        Started by SEQadmin2, 10-14-2026, 05:39 AM
                        0 responses
                        44 views
                        0 reactions
                        Last Post SEQadmin2  
                        Working...