SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
extract data from fasta-files with perl?? anna_ Bioinformatics 20 02-17-2016 08:29 AM
convert base call files (*.bcl) into files (*_qseq.txt) giampe Bioinformatics 12 10-20-2011 09:45 AM
qseq files versus sequence.txt files drio Illumina/Solexa 3 11-09-2009 10:02 AM
s_#_sorted.txt files caza Bioinformatics 2 04-28-2009 09:12 AM
solexa output files | s_*_seq.txt vs. s_*_sequencece.txt lajoieb Illumina/Solexa 3 04-08-2009 06:52 PM

Reply
 
Thread Tools
Old 09-14-2015, 08:18 AM   #1
sunnycqcn
Member
 
Location: Canada

Join Date: Apr 2013
Posts: 17
Default 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;
sunnycqcn is offline   Reply With Quote
Old 09-14-2015, 08:41 AM   #2
Michael.Ante
Senior Member
 
Location: Vienna

Join Date: Oct 2011
Posts: 121
Default

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 at 08:54 AM.
Michael.Ante is offline   Reply With Quote
Old 09-14-2015, 08:55 AM   #3
sunnycqcn
Member
 
Location: Canada

Join Date: Apr 2013
Posts: 17
Default

Thanks, you are right.

Quote:
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..
sunnycqcn is offline   Reply With Quote
Old 01-08-2019, 01:20 AM   #4
ashishbansal
Junior Member
 
Location: Pune

Join Date: Dec 2018
Posts: 3
Default

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
ashishbansal is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 01:46 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO