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
            Recent Advances in Sequencing Analysis Tools
            by seqadmin


            The sequencing world is rapidly changing due to declining costs, enhanced accuracies, and the advent of newer, cutting-edge instruments. Equally important to these developments are improvements in sequencing analysis, a process that converts vast amounts of raw data into a comprehensible and meaningful form. This complex task requires expertise and the right analysis tools. In this article, we highlight the progress and innovation in sequencing analysis by reviewing several of the...
            05-06-2024, 07:48 AM
          • 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...
            04-22-2024, 07:01 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 05-07-2024, 06:57 AM
          0 responses
          12 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 05-06-2024, 07:17 AM
          0 responses
          16 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 05-02-2024, 08:06 AM
          0 responses
          22 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-30-2024, 12:17 PM
          0 responses
          24 views
          0 likes
          Last Post seqadmin  
          Working...
          X