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
            Strategies for Sequencing Challenging Samples
            by seqadmin


            Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
            03-22-2024, 06:39 AM
          • seqadmin
            Techniques and Challenges in Conservation Genomics
            by seqadmin



            The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

            Avian Conservation
            Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
            03-08-2024, 10:41 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 03-27-2024, 06:37 PM
          0 responses
          13 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 03-27-2024, 06:07 PM
          0 responses
          11 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 03-22-2024, 10:03 AM
          0 responses
          53 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 03-21-2024, 07:32 AM
          0 responses
          69 views
          0 likes
          Last Post seqadmin  
          Working...
          X