Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Retro
    Member
    • Apr 2011
    • 27

    #1

    Plot of NGS paired end distance at each genome position

    Hi,

    could anybody help in the following: standard Illumina paired end 300 bp NGS library is mapped on human genome. I would like FOR EACH GENOMIC POSITION to plot the average size of fragments that map across that position. The reason is, we see a huge decrease of fragments from the regular 300 down to ~100 in difficult GC rich areas.

    Thank you,
    Daniel
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    I don't know of any premade packages to do that. However, you could use pysam or Rsamtools to iterate through alignments crossing each position and average the TLEN values. I don't recall if the underlying bam_fetch function will return both mates in a pair, but it so make sure to include only one (based on sign of TLEN), and if not you'll have to handle things accordingly.

    You could also do this in C or java if you prefer, though it seems most people tend to prefer python or R.

    Comment

    • gringer
      David Eccles (gringer)
      • May 2011
      • 845

      #3
      To save a bit of coding time trying to get around the intricacies of pysam, I would use samtools view and awk to generate the numbers:
      Code:
      samtools view input.bam | \
        awk -v 'OFS=,' 'BEGIN{print "RName,RPos,TLen"} {if($9>0){print $3,$4,$9}}' | \
        gzip > template_lengths.csv.gz
      Then R to generate the graph:
      Code:
      data.df <- read.csv("template_lengths.csv.gz");
      pdf("MyTemplateLengthPlots.pdf",width=20,height=8);
      for(rName in levels(data.df$RName)){
        sub.df <- subset(data.df, RName == rName);
        plot(sub.df$Rpos, sub.df$TLen, main = rName);
      }
      graphics.off()
      Last edited by gringer; 04-02-2014, 02:18 AM.

      Comment

      • Jeremy
        Senior Member
        • Nov 2009
        • 190

        #4
        You want to plot 3.2 billion data points? That is going to be a problem. You should look into some other way of representing that data.

        If you do want to plot with R then I reccomend the ggbio package from bioconductor.
        Last edited by Jeremy; 04-02-2014, 07:44 PM.

        Comment

        • Brian Bushnell
          Super Moderator
          • Jan 2014
          • 2709

          #5
          ALE (Assembly Likelihood Estimator) may be useful here. It can detect areas where the apparent insert size differs from usual, and generates a histogram that you can view, as well as probabilities that the reference represents the reads. It accepts an assembly (fasta) file and set of constituent mapped reads (sam), to generate output.

          Comment

          • Retro
            Member
            • Apr 2011
            • 27

            #6
            Additional information

            Thank you for the suggestions. Let me give you some more detail, maybe somebody encountered similar problem. We are trying to fill in some gaps in the chicken genome sequence. Those gaps do contain genes but are extremely GC rich. EVEN WITH ~1000x COVERAGE (!) OF THE CHICKEN GENOME we cannot extend our sequence into the gaps by using the paired reads. What happens that as we get closer to the boundary of the difficult sequence, the paired distances diminish and at the border the paired reads basically overlap each other, so there is not chance to walk into the gap. Just by inspecting few genomic regions, I can see this happening repeatedly. So I wanted to visualize this better by plotting the paired distances (not on the entire genome, just on selected genomic regions, on the order of several kbp).

            Comment

            • Brian Bushnell
              Super Moderator
              • Jan 2014
              • 2709

              #7
              You may simply need longer "reads". For example, PacBio reads, or MiSeq 300bpx2 with an average insert of around 500bp merged with bbmerge. Since you already have 300bp reads, it may be useful to merge them into consensi before using them, assuming your insert size is appropriate. Of course, reads with low-complexity sequence will not merge very well. Fortunately... low-complexity sequence (like ACACACAC...ACAC) is not very important for most purposes.

              Have you tried ALE? If it doesn't work I can write something that will plot the pairing distance as a function of position, but ALE should already do this extremely well.

              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...
                Yesterday, 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
              25 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-28-2026, 09:51 AM
              0 responses
              15 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 11:13 AM
              0 responses
              71 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 10-22-2026, 10:48 AM
              0 responses
              48 views
              0 reactions
              Last Post SEQadmin2  
              Working...