Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • extract data from txt files

    I want to extract gene expression values from a txt file based on gene names.

    for example:

    A 1500

    B 2500

    C 3500

    D 3400

    I want to extract A and C gene expression values using gene name file extract it.

    A 1500

    C 3500

    I have wroten a perl code, but it is not work well. Could you help me modify it or give me a new code?

    Thanks,

    #!/usr/bin/perl -w
    use strict;
    open(IN,"file1");
    open(NAME,"file2");
    open(OUT,">result");
    while(<IN>){
    chomp;
    @data=split / /,$_;
    $hash{$data[0]}=$data[1];
    }
    while(<NAME>){
    chomp;
    print OUT "$_ $hash{$_}\n";
    }
    close IN;
    close NAME;
    close OUT;

  • #2
    Why not simply grep:
    Code:
    grep -f name.txt gene_expression.txt > out.txt
    P.S.: Please be aware of the fact, that Cross-Postings are forbidden/not welcome..
    Last edited by Michael.Ante; 09-14-2015, 07:54 AM.

    Comment


    • #3
      Thanks, you are right.

      Originally posted by Michael.Ante View Post
      Why not simply grep:
      Code:
      grep -f name.txt gene_expression.txt > out.txt
      P.S.: Please be aware of the fact, that Cross-Postings are forbidden/not welcome..

      Comment


      • #4
        After RMA processing, you should end up with an ExpressionSet object. Let's assume it's called eset, and your probe set IDs are in a character vector called yourProbeSetIDs. Then:

        exprs(eset) # gives a dataframe with expression levels, probe set IDs are the row names
        exprs(eset)[yourProbeSetIDs, ] # gives you of subset dataframe with your probe sets of interest
        To write a tab-delimited file:

        write.table(yourDataFrame, file="filename.txt", sep="\t", quote=F, row.names=T)
        Clinical Research

        Comment


        • #5
          I'm looking for something like that, Thank you.
          Online Clinical Research Training
          Online Clinical Research Training

          Comment

          Latest Articles

          Collapse

          • seqadmin
            Essential Discoveries and Tools in Epitranscriptomics
            by seqadmin


            The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist on Modified Bases...
            Yesterday, 07:01 AM
          • seqadmin
            Current Approaches to Protein Sequencing
            by seqadmin


            Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
            04-04-2024, 04:25 PM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 04-11-2024, 12:08 PM
          0 responses
          39 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 10:19 PM
          0 responses
          41 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 09:21 AM
          0 responses
          35 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-04-2024, 09:00 AM
          0 responses
          55 views
          0 likes
          Last Post seqadmin  
          Working...
          X