calculate average value for multiple rows with different values
1
0
Entering edit mode
8.8 years ago
-1.6    hsa-miR-3615
-1  hsa-miR-3615
2.8 hsa-miR-5p
-3.8    hsa-miR-5p

how to calculate avg value for particular type of miRNA (like hsa-miR-3615) using perl scripts?

rna-seq • 3.1k views
ADD COMMENT
1
Entering edit mode

What have you tried?

ADD REPLY
1
Entering edit mode

Since you are such a novice in programming/data analysis, why don't you do this with Excel's pivot table function?

ADD REPLY
0
Entering edit mode

i am using perl program for calculation..

thanks for your patience,

ADD REPLY
0
Entering edit mode

We're aware of that. In order to get help, you need to show some code that you wrote that you'd hoped would work. We'll then give you some advise on how to actually get it working correctly.

ADD REPLY
0
Entering edit mode

my %hash; while () { @line=split(\t); push@{hash{$key}}, $value; }

just to store different values for particular miRNA..

ADD REPLY
0
Entering edit mode

actually i am beginar of perl... so i dnt knw hw t write a prgm

ADD REPLY
0
Entering edit mode

If you need to learn some basic programming skills I'd highly suggest doing a course on Coursera or Software Carpentry or something to teach you the basics first. Its hard to teach basic concepts from scratch in a forum like this.

ADD REPLY
0
Entering edit mode

Thanks for your answer goutham. If values for each mirna are more than 2, then how can I use above command?

Thank you, Anitha

ADD REPLY
0
Entering edit mode

-g 2 does not indicate its two rows. Read the manual

ADD REPLY
0
Entering edit mode

Thanks for your patience Devon...

Anitha

ADD REPLY
6
Entering edit mode
8.8 years ago

Using bedtools:

groupBy -i < in file>  -g 2 -c 1 -o mean

output:

hsa-miR-3615    -1.30000000000000004441
hsa-miR-5p  -0.5
ADD COMMENT
0
Entering edit mode

The biggest benefit of this: no perl! :)

ADD REPLY
0
Entering edit mode

Thanks for answer goutham.. My file format is csv so i changed command line as "groupBy -i value.csv -g 2 -c 1 -o mean >b.csv", but it takes first two values for this miRNA so what i have to do? i want avg of three values for this miRNA.. 511703.6 hsa-miR-486-5p 503453.6 hsa-miR-486-5p -1.6 hsa-miR-486-5p

Thank you..

ADD REPLY
0
Entering edit mode

AFAIK, the bedtools require tab-separated values. How is the data in your csv-file separated?

[Edit] if you don't know, try:

head value.csv | sed -n 'l'
ADD REPLY
0
Entering edit mode

Ha csv files are tab separated only...

ADD REPLY
0
Entering edit mode

You mean comma separated, though realistically they can be separated by anything, they're just text files.

ADD REPLY
0
Entering edit mode

ya... but it takes only two rows, but i have more than two values for each miRNA that is also both negative and positive values.. above bed tools not taken more than two values..

ADD REPLY
1
Entering edit mode

Hope your file is sorted based in the miRNA ID.

ADD REPLY
0
Entering edit mode

Who told you that? It'll take an arbitrary number of values (if not, it's a bug).

ADD REPLY
0
Entering edit mode

Thanks a lot... I ll try

ADD REPLY

Login before adding your answer.

Traffic: 2111 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6