Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tonybert
    Member
    • Aug 2012
    • 38

    #1

    sample gene count matrix from list in R

    Greetings, I am trying to produce a sample matrix consisting of samples (columns) and gene-IDs (rows), with the raw hits for each gene in the matrix. For COG categories, I have been able to produce these types of tables quite easily in excel. However, for other types of gene-ontology databases that are a bit more complex, i have been running into some problems. What i have currently is a list that looks like the below:

    >count_pFAM_samplelist
    count pFAM sample
    1 2 1A1D_ACIAC/10-323 1
    2 3 1A1D_AGRRK/9-322 1
    3 1 1A1D_BURCC/10-323 1
    4 1 1A1D_CUPNH/9-323 1
    5 1 1A1D_METNO/9-322 1
    6 2 1A1D_METPP/10-323 1
    7 3 1A1D_METS4/9-322 1
    8 1 1A1D_PSES0/11-323 1
    9 1 1A1D_PSEUD/10-323 1
    10 2 1A1D_RHIRD/10-322 1
    11 2 14312_ARATH/10-245 2
    12 1 1433_EIMTE/9-256 2
    13 1 1433_SPIOL/1-198 2
    14 1 1A1D_ACIAC/10-323 2
    15 4 1A1D_AGRRK/9-322 2
    16 1 1A1D_CUPNH/9-323 2
    17 2 1A1D_METNO/9-322 2
    18 6 1A1D_METPP/10-323 2
    19 1 1A1D_METS4/9-322 2
    20 2 1A1D_PSEUD/10-323 2

    what I would like to do is transform this into a matrix with "sample" in columns, pFAM in rows, with count listed in the matrix. If anyone has any suggestions, they would be helpful. Thanks,

    -Tony
  • dpryan
    Devon Ryan
    • Jul 2011
    • 3478

    #2
    Do each of the samples at least have a row for each of the pFAM IDs (assuming the example is sorted, it would seem not)? That would make life easier (and make things more amenable to conversion in R). If not, presumably you would want a 0 used when an entry is missing entirely. The general idea would be to split() that by "sample", lapply() a function to simple return the counts, and then convert that list into a matrix. But that'll only work for well behaved data (otherwise, just script something in python or whatever other language you know, since iteration is really slow in R).

    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
    24 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
    36 views
    0 reactions
    Last Post SEQadmin2  
    Started by SEQadmin2, 10-14-2026, 05:39 AM
    0 responses
    42 views
    0 reactions
    Last Post SEQadmin2  
    Working...