Sponsored Content
Top Forums Shell Programming and Scripting Match and retrieve information from file Post 302944287 by RudiC on Monday 18th of May 2015 12:51:32 PM
Old 05-18-2015
If your awk allows for multichar field separators, try
Code:
awk 'FNR==NR {T[$1]=$2; next} {print $0, T[$2]}' 'FS=  +' file2 file1
//NODECOLORCODE         "Exon 1"        "ENST00000595813" "#FF0000"
//NODECOLORCODE         "Exon 1"        "ENST00000596051" "#FF0000"
//NODECOLORCODE         "Exon 2"        "ENST00000243643" "#FFD400"
//NODECOLORCODE         "Exon 2"        "ENST00000421033" "#FFD400"
//NODECOLORCODE         "Exon 3"        "ENST00000243643" "#FFff00"
//NODECOLORCODE         "Exon 3"        "ENST00000421033" "#FFff00"
//NODECOLORCODE         "Exon 4"        "ENST00000243643" "#2Bff00"
//NODECOLORCODE         "Exon 4"        "ENST00000421033" "#2Bff00"
//NODECOLORCODE         "Exon 5"        "ENST00000421033" "#00ff00"
//NODECOLORCODE         "Exon 5"        "ENST00000440291" "#00ff00"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A script pls( To retrieve database information)

KSH - Unix -AIX - db2 ************** Get the input from the user say '123' (It varies) Then i want to connect to a database say "D1" then i want th extract from the database by giving "select * from tablename where input = '123' I also want to connect to another database "D2" then i... (3 Replies)
Discussion started by: rollthecoin
3 Replies

2. Solaris

command to retrieve user information

Hi, I want the command to retrieve the existing user information such as * authorization * Profile * role * exipre(expiration date of login) * inactive please tell me how to do that Thank you. (3 Replies)
Discussion started by: S_venkatesh
3 Replies

3. UNIX for Dummies Questions & Answers

retrieve lines that match a pattern

Hi, I would like to know how can I get lines from a text file that match no more than 2 '>'. Example: Input file: a >cr1 4 a>b b>c a >cr2 5 a>b Output file: a >cr2 5 a>b Thanks in advance (2 Replies)
Discussion started by: fadista
2 Replies

4. Shell Programming and Scripting

Execute a C program and retrieve information

Hi I have the following script: #!/bin/sh gcc -o program program.c ./program & PID=$! where i execute a C program and i get its pid. I want to retrieve information about this program (e.g memory consumption) using command top. So far i have: top -d 1.0 -p $PID But i dont know how to... (6 Replies)
Discussion started by: nteath
6 Replies

5. Shell Programming and Scripting

Retrieve lines that match any occurence in a list of patterns

I have two files. The first containing a header and six columns of data. Example file 1: Number SNP ID dbSNP RS ID Chromosome Result_Call Physical Position 787066 SNP_A-8575395 RS6650104 1 NOCALL 564477 786872 SNP_A-8575125 RS10458597 1 AA ... (13 Replies)
Discussion started by: Selftaught
13 Replies

6. Shell Programming and Scripting

Match pattern1 in file, match pattern2, substitute value1 in line

not getting anywhere with this an xml file contains multiple clients set up with same tags, different values. I need to parse the file for client foo, and change the value of tag "64bit" from false to true. cat clients.xml <Client type"FIX"> <ClientName>foo</ClientName>... (3 Replies)
Discussion started by: jack.bauer
3 Replies

7. Shell Programming and Scripting

Retrieve information Text/Word from HTML code using awk/sed

awk/sed newbie here. I have a HTML file and from that file and I would like to retrieve a text word. <font face=arial size=-1><li><a href=/value_for_clients/Tokyo/abc_process.txt>abc</a> NDK Version: 4.0 </li> <font face=arial size=-1><li><a... (6 Replies)
Discussion started by: sk2code
6 Replies

8. Shell Programming and Scripting

Display match or no match and write a text file to a directory

The below bash connects to a site, downloads a file, searches that file based of user input - could be multiple (all that seems to work). What I am not able to figure out is how to display on the screen match found or no match found" and write a file to a directory (C:\Users\cmccabe\Desktop\wget)... (4 Replies)
Discussion started by: cmccabe
4 Replies

9. Solaris

Solaris commands to retrieve chipset information

I need to know what are the commands in Solaris to retrieve the below information about the hardware platform. 1. Chipset information (information about various hardware controller cards on the mother boards, system BIOS versions, PCI firmware version etc..) 2. Serial number of the work... (2 Replies)
Discussion started by: rajujayanthy
2 Replies

10. Shell Programming and Scripting

awk to update file based on partial match in field1 and exact match in field2

I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output. $1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies
Bio::Tools::Sim4::Results(3pm)				User Contributed Perl Documentation			    Bio::Tools::Sim4::Results(3pm)

NAME
Bio::Tools::Sim4::Results - Results of one Sim4 run SYNOPSIS
# to preset the order of EST and genomic file as given on the sim4 # command line: my $sim4 = Bio::Tools::Sim4::Results->new(-file => 'result.sim4', -estfirst => 1); # to let the order be determined automatically (by length comparison): $sim4 = Bio::Tools::Sim4::Results->new( -file => 'sim4.results' ); # filehandle: $sim4 = Bio::Tools::Sim4::Results->new( -fh => *INPUT ); # parse the results while(my $exonset = $sim4->next_exonset()) { # $exonset is-a Bio::SeqFeature::Generic with Bio::Tools::Sim4::Exons # as sub features print "Delimited on sequence ", $exonset->seq_id(), "from ", $exonset->start(), " to ", $exonset->end(), " "; foreach my $exon ( $exonset->sub_SeqFeature() ) { # $exon is-a Bio::SeqFeature::FeaturePair print "Exon from ", $exon->start, " to ", $exon->end, " on strand ", $exon->strand(), " "; # you can get out what it matched using the est_hit attribute my $homol = $exon->est_hit(); print "Matched to sequence ", $homol->seq_id, " at ", $homol->start," to ", $homol->end, " "; } } # essential if you gave a filename at initialization (otherwise the file # stays open) $sim4->close(); DESCRIPTION
The sim4 module provides a parser and results object for sim4 output. The sim4 results are specialised types of SeqFeatures, meaning you can add them to AnnSeq objects fine, and manipulate them in the "normal" seqfeature manner. The sim4 Exon objects are Bio::SeqFeature::FeaturePair inherited objects. The $esthit = $exon->est_hit() is the alignment as a feature on the matching object (normally, an EST), in which the start/end points are where the hit lies. To make this module work sensibly you need to run sim4 genomic.fasta est.database.fasta or sim4 est.fasta genomic.database.fasta To get the sequence identifiers recorded for the first sequence, too, use A=4 as output option for sim4. One fiddle here is that there are only two real possibilities to the matching criteria: either one sequence needs reversing or not. Because of this, it is impossible to tell whether the match is in the forward or reverse strand of the genomic DNA. We solve this here by assuming that the genomic DNA is always forward. As a consequence, the strand attribute of the matching EST is unknown, and the strand attribute of the genomic DNA (i.e., the Exon object) will reflect the direction of the hit. See the documentation of parse_next_alignment() for abilities of the parser to deal with the different output format options of sim4. 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 one of 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 - Ewan Birney, Hilmar Lapp Ewan Birney <birney-at-sanger.ac.uk> Hilmar Lapp <hlapp-at-gmx.net> or <hilmar.lapp-at-pharma.novartis.com>. APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ analysis_method Usage : $sim4->analysis_method(); Purpose : Inherited method. Overridden to ensure that the name matches /sim4/i. Returns : String Argument : n/a parse_next_alignment Title : parse_next_alignment Usage : @exons = $sim4_result->parse_next_alignment; foreach $exon (@exons) { # do something } Function: Parses the next alignment of the Sim4 result file and returns the found exons as an array of Bio::Tools::Sim4::Exon objects. Call this method repeatedly until an empty array is returned to get the results for all alignments. The $exon->seq_id() attribute will be set to the identifier of the respective sequence for both sequences if A=4 was used in the sim4 run, and otherwise for the second sequence only. If the output does not contain the identifier, the filename stripped of path and extension is used instead. In addition, the full filename will be recorded for both features ($exon inherits off Bio::SeqFeature::SimilarityPair) as tag 'filename'. The length is accessible via the seqlength() attribute of $exon->query() and $exon->est_hit(). Note that this method is capable of dealing with outputs generated with format 0,1,3, and 4 (via the A=n option to sim4). It automatically determines which of the two sequences has been reversed, and adjusts the coordinates for that sequence. It will also detect whether the EST sequence(s) were given as first or as second file to sim4, unless this has been specified at creation time of the object. Example : Returns : An array of Bio::Tools::Sim4::Exon objects Args : next_exonset Title : next_exonset Usage : $exonset = $sim4_result->parse_next_exonset; print "Exons start at ", $exonset->start(), "and end at ", $exonset->end(), " "; foreach $exon ($exonset->sub_SeqFeature()) { # do something } Function: Parses the next alignment of the Sim4 result file and returns the set of exons as a container of features. The container is itself a Bio::SeqFeature::Generic object, with the Bio::Tools::Sim4::Exon objects as sub features. Start, end, and strand of the container will represent the total region covered by the exons of this set. See the documentation of parse_next_alignment() for further reference about parsing and how the information is stored. Example : Returns : An Bio::SeqFeature::Generic object holding Bio::Tools::Sim4::Exon objects as sub features. Args : next_feature Title : next_feature Usage : while($exonset = $sim4->next_feature()) { # do something } Function: Does the same as L<next_exonset()>. See there for documentation of the functionality. Call this method repeatedly until FALSE is returned. The returned object is actually a SeqFeatureI implementing object. This method is required for classes implementing the SeqAnalysisParserI interface, and is merely an alias for next_exonset() at present. Example : Returns : A Bio::SeqFeature::Generic object. Args : perl v5.14.2 2012-03-02 Bio::Tools::Sim4::Results(3pm)
All times are GMT -4. The time now is 11:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy