Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yangjianhunt
    Member
    • Jun 2012
    • 14

    #1

    How do I automate the graphing of these data?

    Hi, everybody,

    I have result files generated by blastn which then were sorted based on the second field. A typical file looks like:

    360 miR156a
    1 miR156a
    9 miR156a
    1 miR156a
    10 miR156a
    7 miR156a
    1 miR156a
    705 miR157a
    2 miR157a
    1 miR157a
    5 miR157a
    4 miR157a
    67 miR157a
    5 miR157a
    11 miR157a
    2 miR157a
    34 miR159
    3 miR162
    3 miR166a
    17 miR166a
    4 miR166a
    103 miR167a
    1 miR167a
    ... .....

    The first column is the deepseq read counts for each unique sequence. The 2nd column is the miR IDs that the sequence was aligns to.
    I would like to:
    1)
    Sum the total read counts for each miR IDs (e.g. for miR156a, sum row1-row7);
    Generate a bar graph to show the total read counts for each miR ID.


    I have more than 20 files like this. I would like to use an automated way of doing this. The R package came to my minds.
    But I have not used R before. Can you guys give me some tips or suggestions as about which R package or tools to use? (I can then learn those and figure out)


    2)
    If possible, generate a table that summarize all the total reads info from the 20 files.
    The table that I would like to have is as follows:

    miRID sample1 sample2 sample3 ......... sample 20
    miR156 103 300 450 .......... 33
    miR157 205 300 ..........
    miR167 .....
    .... .......


    Thanks a lot!!

    Jian
    Last edited by yangjianhunt; 06-29-2012, 09:14 AM.
  • kopi-o
    Senior Member
    • Feb 2008
    • 319

    #2
    For 1), the bar plot part is easy in R; just use barplot() !

    Summing the counts can be done in a lot of different ways. Here is one that is maybe a bit cryptic but will teach you the table() command. Assume you have the table you pasted in a text file called mirna.txt. Try to run the following in R, with the mirna.txt file in the current working directory:

    m <- read.table("mirna.txt")
    q <- table(m)
    totcounts <- as.numeric(rownames(q)) %*% q
    barplot(totcounts)

    There are of course more transparent ways of summing the counts, but I'm too lazy to type them out :-)

    Comment

    • yangjianhunt
      Member
      • Jun 2012
      • 14

      #3
      Thanks a lot, kopi-o.

      This looks awesome. I will try it out.

      Jian

      Comment

      • yangjianhunt
        Member
        • Jun 2012
        • 14

        #4
        solved

        I eventually used:
        list.files () function to get all the files
        lapply () to achieve processing for multiple functions.
        read.table () to read data.frame from each file
        tapply (SeqCounts, miRNA, sum) to get a counting for each "class"
        write.table () to write data into a file, append=TRUE
        also used paste() and cat () to write a name before each appendage.
        barplot () to draw polt

        It took me a couple of days to learn the introductory basics of R. But it was fun and will be useful in the future I hope.

        Again, thanks to Kopi-o for point the way: I haven't learned how to used the table () function yet...But I feel confident to be able to learn it now.

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
          by SEQadmin2



          CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

          Despite this, “CRISPR helped turn genome editing from a specialized technique into
          ...
          Today, 11:01 AM
        • SEQadmin2
          Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
          by SEQadmin2


          Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

          The systematic characterization of the human proteome has
          ...
          07-20-2026, 11:48 AM
        • SEQadmin2
          Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
          by SEQadmin2



          Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
          ...
          07-09-2026, 11:10 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, Today, 02:55 AM
        0 responses
        7 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-24-2026, 12:17 PM
        0 responses
        11 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-23-2026, 11:41 AM
        0 responses
        12 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 07-20-2026, 11:10 AM
        0 responses
        24 views
        0 reactions
        Last Post SEQadmin2  
        Working...