How to average value if they have the same annotation names?
Hi I have a file like this
input_file
Each line has annotation name and its correlated value. The annotation name and the value are seperated by a space. I want to average the value if the lines have the same annotation names in the output file. In this case, there are 2 lines have CR387793 annotataion and 3 lines have AR388755 annotation in the input file, so the average value of CR387793 should be -3.15 and the average value of AR388755 should be 2.65, all the other annotation has only one unique value so it will be kept in the output file. So I am expecting the output file is like this below
output_file
I have thousands of lines in my input file to be processed like the example, how can I achieve this by the Unix command. Thank you very much!
If I have a file like this, could anyone please guide me how to find the average value in each metrix. The file has got about 130,000 metrixs.
Grid-ref= 142, 235
178 182 203 240 273 295 289 293 283 262 201 176
167 187 187 246 260 282 299 312 293 276 230 191
169 ... (2 Replies)
Hi,
I have the data like this
$1 $2
1 12
2 13
3 14
4 12
5 12
6 12
7 13
8 14
9 12
10 12
i want to compute average of $1 and $2 every 5th line (1-5 and 6-10)
Please help me with awk
Thank you (4 Replies)
Hi
I am looking for an awk script which can compute average of all the fields every 5th line. The file looks:
A B C D E F G H I J K L M
1 18 13 14 12 14 13 11 12 12 15 15 15
2 17 17 13 13 13 12 12 11 12 14 15 14
3 16 16 12 12 12 11 11 12 11 16 14 13
4 15 15 11 11 11 12 11 12 11... (6 Replies)
I have a file which is
2
3
4
5
6
6
so i am writing program in C to calculate mean..
#include<stdio.h>
#include<string.h>
#include <math.h>
double CALL mean(int n , double x)
main (int argc, char **argv)
{
char Buf,SEQ;
int i;
double result = 0;
FILE *fp; (3 Replies)
Sun Solaris Unix Question
Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
I have the following Snps data
CHROM POS ID
chr7 78599583 rs987435
chr15 33395779 rs987436
chr1 189807684 rs987437
chr20 33907909 rs987438
chr12 75664046 rs987439
and the following gene data
genename name chrom strand txstart txend... (8 Replies)
i have a file with 2 columns. i want to calculate the average of column 1 based on the values of column 2. here's how the file looks like. i want to calculate the sums of numbers corresponding to 1 and then calculate the average. same for numbers corresponding to zero. any help with a code would... (1 Reply)
Discussion started by: onerokeyz
1 Replies
LEARN ABOUT CENTOS
perl::critic::annotation
Perl::Critic::Annotation(3) User Contributed Perl Documentation Perl::Critic::Annotation(3)NAME
Perl::Critic::Annotation - A "## no critic" annotation in a document.
SYNOPSIS
use Perl::Critic::Annotation;
$annotation = Perl::Critic::Annotation->new( -element => $no_critic_ppi_element );
$bool = $annotation->disables_line( $number );
$bool = $annotation->disables_policy( $policy_object );
$bool = $annotation->disables_all_policies();
($start, $end) = $annotation->effective_range();
@disabled_policy_names = $annotation->disabled_policies();
DESCRIPTION
"Perl::Critic::Annotation" represents a single "## no critic" annotation in a <PPI:Document>. The Annotation takes care of parsing the
annotation and keeps track of which lines and Policies it affects. It is intended to encapsulate the details of the no-critic annotations,
and to provide a way for Policy objects to interact with the annotations (via a Perl::Critic::Document).
INTERFACE SUPPORT
This is considered to be a non-public class. Its interface is subject to change without notice.
CLASS METHODS
create_annotations( -doc => $doc )
Given a Perl::Critic::Document, finds all the "## no critic" annotations and constructs a new "Perl::Critic::Annotation" for each one
and returns them. The order of the returned objects is not defined. It is generally expected that clients will use this interface
rather than calling the "Perl::Critic::Annotation" constructor directly.
CONSTRUCTOR
"new( -element => $ppi_annotation_element )"
Returns a reference to a new Annotation object. The -element argument is required and should be a "PPI::Token::Comment" that conforms
to the "## no critic" syntax.
METHODS
"disables_line( $line )"
Returns true if this Annotation disables $line for any (or all) Policies.
"disables_policy( $policy_object )"
"disables_policy( $policy_name )"
Returns true if this Annotation disables $polciy_object or $policy_name at any (or all) lines.
"disables_all_policies()"
Returns true if this Annotation disables all Policies at any (or all) lines. If this method returns true, "disabled_policies" will
return an empty list.
"effective_range()"
Returns a two-element list, representing the first and last line numbers where this Annotation has effect.
"disabled_policies()"
Returns a list of the names of the Policies that are affected by this Annotation. If this list is empty, then it means that all
Policies are affected by this Annotation, and "disables_all_policies()" should return true.
"element()"
Returns the PPI::Element where this annotation started. This is typically an instance of PPI::Token::Comment.
AUTHOR
Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
COPYRIGHT
Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module.
perl v5.16.3 2014-06-09 Perl::Critic::Annotation(3)