Question: calculate average value for multiple rows with different values
0
gravatar for anithanagaraj93
3.1 years ago by
India
anithanagaraj930 wrote:
-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 • 1.2k views
ADD COMMENTlink modified 3.1 years ago • written 3.1 years ago by anithanagaraj930
1

What have you tried?

ADD REPLYlink written 3.1 years ago by Devon Ryan89k
1

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

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by Irsan6.8k

i am using perl program for calculation..

thanks for your patience,

ADD REPLYlink written 3.1 years ago by anithanagaraj930

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 REPLYlink written 3.1 years ago by Devon Ryan89k

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

just to store different values for particular miRNA..

ADD REPLYlink written 3.1 years ago by anithanagaraj930

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

ADD REPLYlink written 3.1 years ago by anithanagaraj930

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 REPLYlink written 3.1 years ago by Dan Gaston7.1k

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 REPLYlink written 3.1 years ago by anithanagaraj930

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

ADD REPLYlink written 3.1 years ago by geek_y9.4k

Thanks for your patience Devon...

Anitha

ADD REPLYlink written 3.1 years ago by anithanagaraj930
6
gravatar for geek_y
3.1 years ago by
geek_y9.4k
Barcelona/CRG/London/Imperial
geek_y9.4k wrote:

Using bedtools:

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

output:

hsa-miR-3615    -1.30000000000000004441
hsa-miR-5p  -0.5
ADD COMMENTlink modified 3.1 years ago • written 3.1 years ago by geek_y9.4k

The biggest benefit of this: no perl! :)

ADD REPLYlink written 3.1 years ago by Devon Ryan89k

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 REPLYlink written 3.1 years ago by anithanagaraj930

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 REPLYlink modified 3.1 years ago • written 3.1 years ago by michael.ante3.2k

Ha csv files are tab separated only...

ADD REPLYlink written 3.1 years ago by anithanagaraj930

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

ADD REPLYlink written 3.1 years ago by Devon Ryan89k

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 REPLYlink written 3.1 years ago by anithanagaraj930
1

Hope your file is sorted based in the miRNA ID.

ADD REPLYlink written 3.1 years ago by geek_y9.4k

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

ADD REPLYlink modified 3.1 years ago • written 3.1 years ago by Devon Ryan89k

Thanks a lot... I ll try

ADD REPLYlink written 3.1 years ago by anithanagaraj930
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1775 users visited in the last hour