Sponsored Content
Top Forums Shell Programming and Scripting awk to skip header row and add string to field Post 302978597 by cmccabe on Monday 1st of August 2016 05:09:51 PM
Old 08-01-2016
awk to skip header row and add string to field

The awk below does put in VUS in the 9th field but I can not seem to skip the header then add the VUS. I tried to incorporate NR >=2 and NR > 1 with no luck. Thank you Smilie.

input
Code:
Chr    Start    End    Ref    Alt    Func.refGene    PopFreqMax    CLINSIG    Classification
chr1    43395635    43395635    C    T    exonic    0.12    Benign    
chr1    43396414    43396414    G    A    exonic    0.14    Benign    
chr1    172410967    172410967    G    A    exonic    0.66        
chr1    172411496    172411496    A    G    exonic    1        
chr2    51254901    51254901    G    A    exonic    0.48        
chr2    51254914    51254914    C    T    exonic    0.0023

current output
Code:
Chr    Start    End    Ref    Alt    Func.refGene    PopFreqMax    CLINSIG    VUS
chr1    43395635    43395635    C    T    exonic    0.12    Benign    VUS
chr1    43396414    43396414    G    A    exonic    0.14    Benign    VUS
chr1    172410967    172410967    G    A    exonic    0.66        VUS
chr1    172411496    172411496    A    G    exonic    1        VUS
chr2    51254901    51254901    G    A    exonic    0.48        VUS
chr2    51254914    51254914    C    T    exonic    0.0023        VUS

desired output
Code:
Chr    Start    End    Ref    Alt    Func.refGene    PopFreqMax    CLINSIG    Classification
chr1    43395635    43395635    C    T    exonic    0.12    Benign    VUS
chr1    43396414    43396414    G    A    exonic    0.14    Benign    VUS
chr1    172410967    172410967    G    A    exonic    0.66        VUS
chr1    172411496    172411496    A    G    exonic    1        VUS
chr2    51254901    51254901    G    A    exonic    0.48        VUS
chr2    51254914    51254914    C    T    exonic    0.0023        VUS

awk
Code:
awk -v OFS='\t' '$9=$9"VUS"' input


Last edited by cmccabe; 08-01-2016 at 06:10 PM.. Reason: fixed format
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Skip parsing the header record - Awk

Guys.... Got a scenario in which I need to skip parsing the header record while I do an awk. Does awk has the flexibility to accomplish this?. If so, how do we do this?. Thanks !!! -Anduzzi :) (2 Replies)
Discussion started by: anduzzi
2 Replies

2. Shell Programming and Scripting

help with sed to add delimiter and new field to each row

I have a file with millions of rows that I need to add a delimiter and a new field with a zero to the end of each row. (its too big to open and do a find and replace regex) I'm looking for the next line '\n' and need to replace it with a Unit Separator (hex \037) 0 \n. I've tried the... (2 Replies)
Discussion started by: kmac
2 Replies

3. Shell Programming and Scripting

Printing entire field, if at least one row is matching by AWK

Dear all, I have been trying to print an entire field, if the first line of the field is matching. For example, my input looks something like this. aaa ddd zzz 123 987 126 24 0.650 985 354 9864 0.32 0.333 4324 000 I am looking for a pattern,... (5 Replies)
Discussion started by: Chulamakuri
5 Replies

4. UNIX for Dummies Questions & Answers

Merge all csv files in one folder considering only 1 header row and ignoring header of all others

Friends, I need help with the following in UNIX. Merge all csv files in one folder considering only 1 header row and ignoring header of all other files. FYI - All files are in same format and contains same headers. Thank you (4 Replies)
Discussion started by: Shiny_Roy
4 Replies

5. Shell Programming and Scripting

awk transpose row into 2 field column

Need to transpose every 2 fields of a row into a single 2 field column. input 4 135 114 76 217 30 346 110 5 185 115 45 218 85 347 125 6 85 116 130 220 65 352 95 11 30 117 55 221 42 355 75 16 72 118 55 224 37 357 430 17 30 119 55 225 40 358 62 21 52 120 65 232 480 360 180 ....... (8 Replies)
Discussion started by: sdf
8 Replies

6. UNIX for Dummies Questions & Answers

append column and row header to a file in awk script.

Hi! Is there a way to append column and row header to a file in awk script. For example if I have Jane F 39 manager Carlos M 40 system administrator Sam F 20 programmer and I want it to be # name gend age occup 1 Jane F 39 manager 2 Carlos M ... (4 Replies)
Discussion started by: FUTURE_EINSTEIN
4 Replies

7. Shell Programming and Scripting

Add column header and row header

Hi, I have an input like this 1 2 3 4 2 3 4 5 4 5 6 7 I would like to count the no. of columns and print a header with a prefix "Col". I would also like to count the no. of rows and print as first column with each line number with a prefix "Row" So, my output would be ... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

8. Shell Programming and Scripting

Awk/sed script for transposing any number of rows with header row

Greetings! I have been trying to find out a way to take a CSV file with a large number of rows, and a very large number of columns (in the thousands) and convert the rows to a single column of data, where the first row is a header representing the attribute name and the subsequent series of... (3 Replies)
Discussion started by: tntelle
3 Replies

9. Shell Programming and Scripting

At text to field 1 of header row using awk

I am just trying to insert the word "Index" using awk. The below is close but seems to add the word at the end and I can not get the syntax correct to add from the beginning. Thank you :). awk -F'\t' -v OFS='\t' '{ $-1=$-1 OFS "Index"}$1=$1' file current output Chr Start End ... (3 Replies)
Discussion started by: cmccabe
3 Replies

10. Shell Programming and Scripting

Add field header and default value in awk

I am trying to add a field header Inheritence in between $9 and $10 and default the value of each line to .. The below awk is close I think. Thanks :). input R_Index Chr Start End Ref Alt Func.IDP.refGene Gene.IDP.refGene ... (4 Replies)
Discussion started by: cmccabe
4 Replies
Bio::LiveSeq::AARange(3pm)				User Contributed Perl Documentation				Bio::LiveSeq::AARange(3pm)

NAME
Bio::LiveSeq::AARange - AARange abstract class for LiveSeq SYNOPSIS
#documentation needed DESCRIPTION
This is used as possible parent for aminoacid range object classes. Or it can be used straight away to define aminoacid ranges. The idea is that the ranges defined are attached to a Translation object and they refer to its coordinate-system when they are first created (via the new() method). When they are created they are anyway linked to the underlying DNA LiveSeq by way of the LiveSeq labels. This allows to preserve the ranges even if the numbering changes in the Translation due to deletions or insertions. The protein sequence associated with the AARange can be accessed via the usual seq() or subseq() methods. The start and end of the AARange in protein coordinate system can be fetched with aa_start() and aa_end() methods. Note: the behaviour of these methods would be influenced by the coordinate_start set in the corresponding Translation object. This can be desirable but can also lead to confusion if the coordinate_start had been changed and the original position of the AARange was to be retrieved. start() and end() methods of the AARange will point to the labels identifying the first nucleotide of the first and last triplet coding for the start and end of the AminoAcidRange. The underlying nucleotide sequence of the AARange can be retrieved with the labelsubseq() method. This would retrieve the whole DNA sequence, including possible introns. This is called "DNA_sequence". To fetch the nucleotide sequence of the Transcript, without introns, the labelsubseq() of the attached Transcript (the Transcript the Translation comes from) has to be accessed. This is called "cDNA_sequence". Here are the operations to retrieve these latter two kinds of sequences: $startlabel=$AARange->start; $endtripletlabel=$AARange->end; $endlabel=$AARange->{'seq'}->label(3,$endtripletlabel,$AARange->strand); $dnaseq=$AARange->labelsubseq($startlabel,undef,$endlabel)); $cdnaseq=$AARange->get_Transcript->labelsubseq($startlabel,undef,$endlabel); To simplify, these operations have been included in two additional methods: dna_seq() and cdna_seq(). These would return the whole sequence, as in the examples above. But the above general scheme can be used by specifying different labels, to retrieve hypothetical subsequences of interest. AUTHOR - Joseph A.L. Insana Email: Insana@ebi.ac.uk, jinsana@gmx.net APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : $aarange = Bio::LiveSeq::AARange->new(-translation => $obj_ref, -start => $beginaa, -end => $endaa, -name => "ABCD", -description => "DCBA", -translength => $length); Function: generates a new AminoAcidRange LiveSeq object Returns : reference to a new object of class AARange Errorcode -1 Args : two positions in AminoAcid coordinate numbering an object reference specifying to which translation the aminoacid ranges refer to a name and a description (optional) an optional "translength" argument: this can be given when a lot of AARanges are to be created at the same time for the same Translation object, calculating it with $translation->length This would increase the speed, avoiding the new() function to calculate everytime the same length again and again for every obj. get_Transcript Title : valid Usage : $transcript = $obj->get_Transcript() Function: retrieves the reference to the object of class Transcript (if any) attached to a LiveSeq object Returns : object reference Args : none get_Translation Title : valid Usage : $translation = $obj->get_Translation() Function: retrieves the reference to the object of class Translation (if any) attached to a LiveSeq object Returns : object reference Args : none aa_start Title : aa_start Usage : $end = $aarange->aa_start() Returns : integer (position, according to Translation coordinate system) of the start of an AminoAcidRange object Args : none aa_end Title : aa_end Usage : $end = $aarange->aa_end() Returns : integer (position, according to Translation coordinate system) of the end of an AminoAcidRange object Args : none dna_seq Title : dna_seq Usage : $end = $aarange->dna_seq() Returns : the sequence at DNA level of the entire AminoAcidRange this would include introns (if present) Args : none cdna_seq Title : cdna_seq Usage : $end = $aarange->cdna_seq() Returns : the sequence at cDNA level of the entire AminoAcidRange i.e. this is the part of the Transcript that codes for the AminoAcidRange. It would be composed just of exonic DNA. Args : none perl v5.14.2 2012-03-02 Bio::LiveSeq::AARange(3pm)
All times are GMT -4. The time now is 07:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy