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
            Advancing Precision Medicine for Rare Diseases in Children
            by seqadmin




            Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
            12-16-2024, 07:57 AM
          • seqadmin
            Recent Advances in Sequencing Technologies
            by seqadmin



            Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

            Long-Read Sequencing
            Long-read sequencing has seen remarkable advancements,...
            12-02-2024, 01:49 PM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 12-17-2024, 10:28 AM
          0 responses
          33 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 12-13-2024, 08:24 AM
          0 responses
          48 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 12-12-2024, 07:41 AM
          0 responses
          34 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 12-11-2024, 07:45 AM
          0 responses
          46 views
          0 likes
          Last Post seqadmin  
          Working...
          X