Hi,
Suppose if i am having a file with following records as given below.
5555
6756
5555
4555
4555
6767
how can i get the count of each record using AWK.
Eg:5555 count should be 2
4555 count should be 2
6767 count should be 1
... (5 Replies)
Hi everybody,
I'm trying to replace the $98 field with "T" if the last field (108th) is T
I've tried
awk 'BEGIN{OFS=FS="|"} {if ($108=="T")sub($98,"T"); print}' test.txt
but that doesn't do anything
also tried
awk 'BEGIN{OFS=FS="|"}{ /*T.$/ sub($98,"T")} { print}' test.txt
but... (2 Replies)
Hi,
let's say an input looks like:
A|C|C|D
A|C|I|E
A|B|I|C
A|T|I|B
as the title of the thread explains, I am trying to get something like:
1|A=4
2|C=2|B=1|T=1
3|I=3|C=1
4|D=1|E=1|C=1|B=1
i.e. a count of every character in each field (first column of output) independently, sorted... (4 Replies)
Hi,
I have a file like below
PRUM,67016800 ,CC ,C1,67016800 , ,Y,Y,2 ,CK,BX,FOX ,00000001,EA,00000001,20141120 00:00:00, ,N,Y,Y,CK ABCDEF... (7 Replies)
Hi Folks,
I have a file with fields as follows which has last field in multiple lines. I would like to combine a line which has three fields with single field line for as shown in expected output. Please help.
INPUT
hname01 windows appnamec1eda_p1, ... (5 Replies)
I am trying to remove all the lines and spaces where the count in $4 or $5 is greater than 1 (more than 1 letter). The file and the output are tab-delimited. Thank you :).
file
X 5811530 . G C NLGN4X
17 10544696 . GA G MYH3
9 96439004 . C ... (1 Reply)
In the awk below I am trying to copy the entire contents of $6 there may be multiple values seperated by a ;, to $8, if $8 is . (lines 1 and 3 are examples). If that condition $8 is not . (line2 is an example) then that line is skipped and printed as is. The awk does execute but prints the output... (3 Replies)
The below awk executes as is and produces the current output. It isvery close but what Ican not seem to do is add the -exon..., the ... portion comes from $1 and the _exon is static and will never change. If there is + sign in $4 then the ... is in acending order or sequential. If there is a - in... (2 Replies)
Hi,
Sure it's an easy one, but it drives me insane.
input ("|" separated):
1|A,B,C,A
2|A,D,D
3|A,B,B
I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1.
I am trying to get this output... (5 Replies)
Hi,
So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies
LEARN ABOUT DEBIAN
ace::sequence::featurelist
Ace::Sequence::FeatureList(3pm) User Contributed Perl Documentation Ace::Sequence::FeatureList(3pm)NAME
Ace::Sequence::FeatureList - Lightweight Access to Features
SYNOPSIS
# get a megabase from the middle of chromosome I
$seq = Ace::Sequence->new(-name => 'CHROMOSOME_I,
-db => $db,
-offset => 3_000_000,
-length => 1_000_000);
# find out what's there
$list = $seq->feature_list;
# Scalar context: count all the features
$feature_count = $list->types;
# Array context: list all the feature types
@feature_types = $list->types;
# Scalar context, 1 argument. Count this type
$gene_cnt = $list->types('Predicted_gene');
print "There are $gene_cnt genes here.
";
# Array context, 1 argument. Get list of subtypes
@subtypes = $list->types('Predicted_gene');
# Two arguments. Count type & subtype
$genefinder_cnt = $list->types('Predicted_gene','genefinder');
DESCRIPTION
Ace::Sequence::FeatureList is a small class that provides statistical information about sequence features. From it you can obtain summary
counts of the features and their types within a selected region.
OBJECT CREATION
You will not ordinarily create an Ace::Sequence::FeatureList object directly. Instead, objects will be created by calling a Ace::Sequence
object's feature_list() method. If you wish to create an Ace::Sequence::FeatureList object directly, please consult the source code for
the new() method.
OBJECT METHODS
There are only two methods in Ace::Sequence::FeatureList.
type()
This method has five distinct behaviors, depending on its context and the number of parameters. Usage should be intuitive
Context Arguments Behavior
------------------------
scalar -none- total count of features in list
array -none- list feature types (e.g. "exon")
scalar type count features of this type
array type list subtypes of this type
-any- type,subtype count features of this type & subtype
For example, this code fragment will count the number of exons present on the list:
$exon_count = $list->type('exon');
This code fragment will count the number of exons found by "genefinder":
$predicted_exon_count = $list->type('exon','genefinder');
This code fragment will print out all subtypes of "exon" and their counts:
for my $subtype ($list->type('exon')) {
print $subtype," ",$list->type('exon',$subtype),"
";
}
asString()
print $list->asString;
This dumps the list out in tab-delimited format. The order of columns is type, subtype, count.
SEE ALSO
Ace, Ace::Object, Ace::Sequence, Ace::Sequence::Feature, GFF
AUTHOR
Lincoln Stein <lstein@w3.org> with extensive help from Jean Thierry-Mieg <mieg@kaa.crbm.cnrs-mop.fr>
Copyright (c) 1999, Lincoln D. Stein
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for
disclaimers of warranty.
perl v5.14.2 2000-06-11 Ace::Sequence::FeatureList(3pm)