Sponsored Content
Full Discussion: Awk: Error with END
Top Forums Shell Programming and Scripting Awk: Error with END Post 303010981 by genome on Thursday 11th of January 2018 10:01:15 AM
Old 01-11-2018
Quote:
Originally Posted by RudiC
There's an error in the sequence of opening and closing braces.
Thanks for your reply.

Code:
awk ' 

{
if(!snp[$2]){ snp[$2] = $0 
cnt[$2]++
arr[++SN]=$2
}
else{ snp[$2] = snp[$2] " " $0 " " 
cnt[$2]++
}
}
END { 
for( i in snp){
if(cnt[i] == 2){
print i,snp[i]
}
}
}


 ' new_id.txt

Fixed it. Smilie
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk : delete ^M at the end of the line

Hi all, I'm newbi in scripting. could someone tell how to delete the ^M at the end of the linie with an awk command. many thanks in advance. (2 Replies)
Discussion started by: liliput
2 Replies

2. Shell Programming and Scripting

AWK end of line question

Any clues on how to parse a line returned from an ls command that allows for the filename to be fully passed even if it includes spaces? What I got close with is: ls -ltra | awk '{print $1 "|" $3 "|" $4 "|" $5 "|" $6 "|" $7 "|" $8 "|" $9 $10 $11 $12 ... (etc)}' However this clears the spaces in... (6 Replies)
Discussion started by: jpport123
6 Replies

3. UNIX and Linux Applications

Print date at END clause of AWK

Hi to all! I 'm new in unix programing so... may be I decided a wrong tool to solve the problem but anyway... all road goes to rome jajaja. My question is: There is any way to print date at the END clause of an AWK script. I mean, I'm writing a tool with AWK and the results are redirected to a... (4 Replies)
Discussion started by: fmeriles
4 Replies

4. Shell Programming and Scripting

End of file in AWK

Hello! I need to control when i arrive to the end of my file, any built-in? or another way to do? Thanks! (4 Replies)
Discussion started by: claw82
4 Replies

5. Shell Programming and Scripting

awk get rid of space in end of field

Hello. I'm using a file to "grep" in a 2nd one (with awk) cat file1 2 first user 9 second user 1 third user (with a space after user) I want to get the line except the 1st field so I do : field=$(gawk '{$1 =""; print $0}' file | sed 's/^ //') It works but it deletes... (5 Replies)
Discussion started by: xanthos
5 Replies

6. Shell Programming and Scripting

awk - end of line - Help!

I have a textfile which I am parsing with awk. The lines do not have the same number of fields, so sometimes $3 is the last field, sometimes not. When I do a 'printf("%s, %s\n", $2, $3)', if $3 is the last field in the line, when I cat the file the output looks something like this:... (3 Replies)
Discussion started by: dmesserly
3 Replies

7. Shell Programming and Scripting

BEGIN and END format in awk

I'm new to awk, trying to understand the basics. I'm trying to reset the counter everytime the program gets a new file to check. I figured in the BEGIN part it would work, but it doesn't. #!/bin/awk -f BEGIN {counter=0} { sum=0 for ( i=1; i<=NF;... (1 Reply)
Discussion started by: guitarist684
1 Replies

8. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies

9. UNIX for Dummies Questions & Answers

awk until the end of file

Hi, I tried to use a code to awk until the end of file. I not sure what is the syntax so my last paragraph is \n `var=$(awk '/\n/ {P=0} /Policy Change/ {P=1} P' (2 Replies)
Discussion started by: alvinoo
2 Replies
Bio::Graphics::Glyph::allele_tower(3pm) 		User Contributed Perl Documentation		   Bio::Graphics::Glyph::allele_tower(3pm)

NAME
Bio::Graphics::Glyph::allele_tower - The "allele_tower" glyph SYNOPSIS
See <Bio::Graphics::Panel> and <Bio::Graphics::Glyph>. DESCRIPTION
This glyph draws a letter for each allele found at a SNP position, one above the other (i.e. in a column). For example: A G See also http://www.hapmap.org/cgi-perl/gbrowse/gbrowse 'genotyped SNPs' for an example. The common options are available (except height which is calculated based on the number of alleles). In addition, if you give the glyph the minor allele frequency (MAF) and indicate which is the minor allele, the glyph will display these differences. GETTING THE ALLELES To specify the alleles, create an "Alleles" attribute for the feature. There should be two such attributes. For example, for a T/G polymorphism, the GFF load file should look like: Chr3 . SNP 12345 12345 . . . SNP ABC123; Alleles T ; Alleles G Alternatively, you can pass an "alleles" callback to the appropriate section of the config file. This option should return the two alleles separated by a slash: alleles = sub { my $snp = shift; my @d = $snp->get_tag_values('AllelePair'); return join "/",@d; } OPTIONS . Glyph Colour . Different colour for alleles on the reverse strand . Print out the complement for alleles on the reverse strand . Major allele shown in bold . Horizontal histogram to show allele frequency GLYPH COLOR The glyph color can be configured to be different if the feature is on the plus or minus strand. Use fgcolor to define the glyph color for the plus strand and bgcolor for the minus strand. For example: fgcolor = blue bgcolor = red For this option to work, you must also set ref_strand to return the strand of the feature: ref_strand = sub {shift->strand} REVERSE STRAND ALLELES If the alleles on the negative strand need to be the complement of what is listed in the GFF files, (e.g. A/G becomes T/C), set the complement option to have value 1 complement = 1 For this option to work, you must also set ref_strand to return the strand of the feature: ref_strand = sub {shift->strand} MAJOR/MINOR ALLELE Use the 'minor_allele' option to return the minor allele for the SNP. If you use this option, the major allele will appear in bold type. ALLELE FREQUENCY HISTOGRAMS Use the 'maf' option to return the minor allele frequency for the SNP. If you use this option, a horizontal histogram will be drawn next to the alleles, to indicate their relative frequencies. e.g. A______ C__ Note: The 'label' option must be set to 1 (i.e. on) and the 'minor_allele' option must return a valid allele for this to work. BUGS
Please report them. SEE ALSO
Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::cds, Bio::Graphics::Glyph::crossbox, Bio::Graphics::Glyph::diamond, Bio::Graphics::Glyph::dna, Bio::Graphics::Glyph::dot, Bio::Graphics::Glyph::ellipse, Bio::Graphics::Glyph::extending_arrow, Bio::Graphics::Glyph::generic, Bio::Graphics::Glyph::graded_segments, Bio::Graphics::Glyph::heterogeneous_segments, Bio::Graphics::Glyph::line, Bio::Graphics::Glyph::pinsertion, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::rndrect, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::ruler_arrow, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::translation, Bio::Graphics::Glyph::allele_tower, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD AUTHOR
Fiona Cunningham <cunningh@cshl.edu> in Lincoln Stein's lab <steinl@cshl.edu>. Copyright (c) 2003 Cold Spring Harbor Laboratory This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty. perl v5.14.2 2012-02-20 Bio::Graphics::Glyph::allele_tower(3pm)
All times are GMT -4. The time now is 10:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy