Sponsored Content
Full Discussion: Command for vlookup function
Top Forums UNIX for Dummies Questions & Answers Command for vlookup function Post 302928642 by derekludwig on Saturday 13th of December 2014 02:51:47 PM
Old 12-13-2014
While this is a commonly asked request, but that the quoted field contains the field separator (a space) makes it a little more complicated. But with a little preprocessing:
Code:
{
  sed -e 's/ "/"/' ${2} 
  echo '""*'
  sed -e 's/ /"/g'  ${1}
} \
| awk -F\" '$3 == "*" { mark++; next; } mark == "" { X[$1] = $2; next; } { print $1, $2, $1 in X ? X[$1] : "NA"; }'

which generates the expected results:
Code:
contig-100_1 5 Bacteria
contig-100_30 10 NA
contig-100_50 20 Bacteria A
contig-100_40 15 NA
contig-100_60 25 Bacteria A, Fungi B


Last edited by derekludwig; 12-13-2014 at 04:04 PM.. Reason: better file separator...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want to implement VLOOKUP (Excel function) in Unix

Dear All, i want to implement vookup function which is there in excel into Unix. Suppose i have 2 files. The files are given below. File1: MSC Cell SDCA Patna-1 12 Bihar Patna-2 45 Ranchi Bhopal-1 85 Raigarh Bhopal-2 ... (8 Replies)
Discussion started by: pravani1
8 Replies

2. Shell Programming and Scripting

Vlookup functionality in Bash

Hi please help in the below request Input File 1: a,1 b,2 c,3 d,4 e,5 f,6 Input File 2: 2 5 3 1 Output Required: b 2 e 5 c 3 (3 Replies)
Discussion started by: ravin
3 Replies

3. Shell Programming and Scripting

vlookup files

hi frnds i have 2 files. 1st is dddd and 2nd is ssss ==> dddd <==: 1,charit 2,gilhotra ==> ssss <==: 1,sajan 2,doda 3,hello and i want o/p ...mean join and vlookup both files sajan,charit (4 Replies)
Discussion started by: dodasajan
4 Replies

4. Shell Programming and Scripting

Vlookup using awk

Hello, I am trying to use vlookup (Excel function) using awk but there is some problem :( --file1-- ABC123 101F X1 A $P=Z X2 A $P=X X3 B $P=F X4 C $P=G MNK180 END --file2-- X1 A_t $P=Z X2 A_t $P=X X3 B_u $P=F X4 C_o $P=G (2 Replies)
Discussion started by: young
2 Replies

5. Shell Programming and Scripting

Vlookup using awk

Hi folks, awk 'NR==FNR {m=$0; next} $1 in m{$0=m} {print}' file2 file1 Works a charm for a vlookup type query, sourced from https://www.unix.com/shell-programming-and-scripting/215998-vlookup-using-awk.html However my column content has white spaces and numbers. Example file1 The Man... (6 Replies)
Discussion started by: pshields1984
6 Replies

6. Shell Programming and Scripting

Excel vlookup function like value mapping with awk

I have two files File1 175552 st_497858.1 rs86052.1 rs92185.1 st_001022416.1 174841 175552_174841 179912 st_001122967.2 rs90435.1 rs89122.1 st_001022583.1 175545 179912_175545 179912 st_001122967.2 rs90435.1 rs89122.1 st_001022584.1 175545 179912_175545 179967 st_001256606.1 rs93516.2... (1 Reply)
Discussion started by: sammy777888
1 Replies

7. Shell Programming and Scripting

Vlookup in Linux

Hello Everybody I am looking for vlookup like functionality in Linux since two files I have are very big(1000MB each) and its not opening completely in excel. Here the requirement file1 11,12,13 16,14,12 28,21,22 22,23,24 file 3 18,16,16 14,12,12 23,22,24 16,11,13 here... (8 Replies)
Discussion started by: shanul karim
8 Replies

8. Shell Programming and Scripting

Conditional Vlookup

Hi everyone, I need to replace values of column 2 array1 with values of column 2 array2 based on a lookup of column 4 value, but only return a value IF the values in column 1 of BOTH array1 and array2 match, otherwise keep original value in column 2 of array1. Both files are tab delimited... (2 Replies)
Discussion started by: Geneanalyst
2 Replies

9. UNIX for Beginners Questions & Answers

Vlookup on 2 files - inserting vlookup command on another command

Hello, i am trying to print group name column(etc/group) on script (etc/passwd) since group name is not listed on etc/passwd columns. Im trying to do a vlookup. but i cant figure out how i can insert the vlookup command FNR==NR inside the print out command or the output. I also tried exporting... (2 Replies)
Discussion started by: joonisio
2 Replies

10. UNIX for Beginners Questions & Answers

Vlookup not using awk

Hi I just want again to ask for help on what command to use to vlookup f1 group name in "/etc/group" matching f3 of it to "/etc/passwd" f4. I do need to display group name in the output of /etc/passwd without using awk or NR==FNR command. thank you while IFS=: read -r f1 f2 f3 f4 f5 f6 f7... (4 Replies)
Discussion started by: joonisio
4 Replies
Bio::Assembly::ContigAnalysis(3pm)			User Contributed Perl Documentation			Bio::Assembly::ContigAnalysis(3pm)

NAME
Bio::Assembly::ContigAnalysis - Perform analysis on sequence assembly contigs. SYNOPSIS
# Module loading use Bio::Assembly::ContigAnalysis; # Assembly loading methods my $ca = Bio::Assembly::ContigAnalysis->new( -contig=>$contigOBJ ); my @lcq = $ca->low_consensus_quality; my @hqd = $ca->high_quality_discrepancies; my @ss = $ca->single_strand_regions; DESCRIPTION
A contig is as a set of sequences, locally aligned to each other, when the sequences in a pair may be aligned. It may also include a consensus sequence. Bio::Assembly::ContigAnalysis is a module holding a collection of methods to analyze contig objects. It was developed around the Bio::Assembly::Contig implementation of contigs and can not work with another contig interface. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing lists Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Robson Francisco de Souza Email: rfsouza@citri.iq.usp.br APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ Object creator new Title : new Usage : my $contig = Bio::Assembly::ContigAnalysis->new(-contig=>$contigOBJ); Function : Creates a new contig analysis object Returns : Bio::Assembly::ContigAnalysis Args : -contig : a Bio::Assembly::Contig object Analysis methods high_quality_discrepancies Title : high_quality_discrepancies Usage : my $sfc = $ContigAnal->high_quality_discrepancies(); Function : Locates all high quality discrepancies among aligned sequences and the consensus sequence. Note: see Bio::Assembly::Contig POD documentation, section "Coordinate System", for a definition of available types. Default coordinate system type is "gapped consensus", i.e. consensus sequence (with gaps) coordinates. If limits are not specified, the entire alignment is analyzed. Returns : Bio::SeqFeature::Collection Args : optional arguments are -threshold : cutoff value for low quality (minimum high quality) Default: 40 -ignore : number of bases that will not be analysed at both ends of contig aligned elements Default: 5 -start : start of interval that will be analyzed -end : start of interval that will be analyzed -type : coordinate system type for interval low_consensus_quality Title : low_consensus_quality Usage : my $sfc = $ContigAnal->low_consensus_quality(); Function : Locates all low quality regions in the consensus Returns : an array of Bio::SeqFeature::Generic objects Args : optional arguments are -threshold : cutoff value for low quality (minimum high quality) Default: 25 -start : start of interval that will be analyzed -end : start of interval that will be analyzed -type : coordinate system type for interval not_confirmed_on_both_strands Title : low_quality_consensus Usage : my $sfc = $ContigAnal->low_quality_consensus(); Function : Locates all regions whose consensus bases were not confirmed by bases from sequences aligned in both orientations, i.e., in such regions, no bases in aligned sequences of either +1 or -1 strand agree with the consensus bases. Returns : an array of Bio::SeqFeature::Generic objects Args : optional arguments are -start : start of interval that will be analyzed -end : start of interval that will be analyzed -type : coordinate system type for interval single_strand Title : single_strand Usage : my $sfc = $ContigAnal->single_strand(); Function : Locates all regions covered by aligned sequences only in one of the two strands, i.e., regions for which aligned sequence's strand() method returns +1 or -1 for all sequences. Returns : an array of Bio::SeqFeature::Generic objects Args : optional arguments are -start : start of interval that will be analyzed -end : start of interval that will be analyzed -type : coordinate system type for interval Internal Methods _merge_overlapping_features Title : _merge_overlapping_features Usage : my @feat = $ContigAnal->_merge_overlapping_features(@features); Function : Merge all overlapping features into features that hold original features as sub-features Returns : array of Bio::SeqFeature::Generic objects Args : array of Bio::SeqFeature::Generic objects _complementary_features_list Title : _complementary_features_list Usage : @feat = $ContigAnal->_complementary_features_list($start,$end,@features); Function : Build a list of features for regions not covered by features in @features array Returns : array of Bio::SeqFeature::Generic objects Args : $start : [integer] start of first output feature $end : [integer] end of last output feature @features : array of Bio::SeqFeature::Generic objects perl v5.14.2 2012-03-02 Bio::Assembly::ContigAnalysis(3pm)
All times are GMT -4. The time now is 01:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy