Question: calculate average value for multiple rows with different values
0
4.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.4k views
modified 4.1 years ago • written 4.1 years ago by anithanagaraj930
1

What have you tried?

1

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

i am using perl program for calculation..

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.

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

just to store different values for particular miRNA..

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

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.

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

Thank you, Anitha

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

Anitha

6
4.1 years ago by
geek_y10k
Barcelona
geek_y10k wrote:

Using `bedtools`:

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

output:

``````hsa-miR-3615    -1.30000000000000004441
hsa-miR-5p  -0.5
``````

The biggest benefit of this: no perl! :)

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

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

 if you don't know, try:

``````head value.csv | sed -n 'l'
``````

Ha csv files are tab separated only...

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

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

1

Hope your file is sorted based in the miRNA ID.

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