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
            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
          • 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

          ad_right_rmr

          Collapse

          News

          Collapse

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