Sponsored Content
Top Forums Shell Programming and Scripting Grep two files: -F flag gives weird output Post 303007366 by genome on Wednesday 15th of November 2017 05:02:26 PM
Old 11-15-2017
Grep two files: -F flag gives weird output

Hi Members,

I'm confused with grep -F option. Goal is to get all the lines from file2 that have exact gene name from gene list (file one).

File one has list of genes:
Quote:
CR1
PSEN2
GYPC
BIN1
CYP27C1
ERCC3
MAP3K2
PROC
MIR4783
IWS1
File two has lot more information pertinent to genes in file one:
Quote:
19 19256812 19256812 exonic MEF2B,MEF2BNB-MEF2B nonsynonymous SNV
19 19257646 19257646 exonic MEF2B,MEF2BNB-MEF2B nonsynonymous SNV
I use three following commands:

1)
Code:
grep -wf gene file2

Not output. This is expected.

2)
Code:
 grep -Ff gene file2

This gives me both the lines in file2:

Quote:
19 19256812 19256812 exonic MEF2B,MEF2BNB-MEF2B nonsynonymous SNV
19 19257646 19257646 exonic MEF2B,MEF2BNB-MEF2B nonsynonymous SNV
However, there's no gene as MEF2B or MEF2BNB-MEF2B in gene list.

But gene MEF2C is present in gene list.

That means -F options collects anything. Am I understanding this correctly?

3)
Code:
 grep -Fxf gene file2

No output
I guess x looks per line basis

4)

Code:
grep -Fwf gene file2

This matches with grep -wf gene file2

I'm confused which is correct way to get appropriate answer. Data is humongous so I'd not know where I made mistake.

Command one and four look good to go.

Would appreciate any help here.

Last edited by genome; 11-15-2017 at 06:11 PM.. Reason: added fourth command
 

10 More Discussions You Might Find Interesting

1. AIX

Weird bootlist output

just setup a new system today - 9117 570, using HMC for console but not partitioned. I installed this system twice. the first time it started off as 5300-00, then updated to ML03. before the update, I believe I mirrored the rootvg, and then altered the bootlist, at that point, the display was... (4 Replies)
Discussion started by: davew1099
4 Replies

2. Shell Programming and Scripting

weird behavior of grep -P

I met a problem in using grep -P. There is a text file, temp.txt, whose content is: dddd abc I ran the command: grep -P "\s*abc" temp.txt The result I expected is: abc But, the actual result is: dddd abc Could anyone tell me what is wrong? Thanks. (2 Replies)
Discussion started by: pankai
2 Replies

3. Shell Programming and Scripting

weird echo output?

#!/bin/bash INPUT=$1 if then INPUT=0$1 TRACKNUMBER=$INPUT fi TRACKNUMBER=$INPUT echo "Track Number:" $TRACKNUMBER if then echo "File Does Not Exist!: split-track"${TRACKNUMBER}".wav" exit 0 fi CUEFILE="$2" (6 Replies)
Discussion started by: TinCanFury
6 Replies

4. Shell Programming and Scripting

format of output is weird

hi all, have a ksh script which connects to a database and runs a sql and dumps it to a '.csv' file. The problem is the result is in multiple rows with long spaces in between when it should be just a single line and this screws up the format in the '.csv' file. script is : #!/bin/ksh... (1 Reply)
Discussion started by: cesarNZ
1 Replies

5. UNIX for Dummies Questions & Answers

weird 'ls' output

Hi, Anyone knows why I can't display the contents of my directory and how to fix this? http://i50.tinypic.com/4smfth.jpg Thanks in advance for any advise. Deanne Double post. Continued here. (0 Replies)
Discussion started by: Deanne
0 Replies

6. Shell Programming and Scripting

In bash getting weird output from function ?

My script- result="" times() { echo "inside the times function" result=8 echo "Inside function $result" return $result } result=$(times) echo "the value is "$? echo "the value of result $result" when I run I get this, why the value still remain 0. $ ./func the value is 0 the value... (5 Replies)
Discussion started by: boy18nj
5 Replies

7. Shell Programming and Scripting

Traceroute script weird output

This script is giving weird output #!/bin/bash NETPATH=(`/bin/traceroute -n 4.2.2.2 | awk '{print $2}'`) for i in "${NETPATH}" do echo $i done The output: to 11.11.11.1 1.1.1.1 99.111.208.2 traceroute_test.sh traceroute_test.sh (7 Replies)
Discussion started by: thumbs
7 Replies

8. Shell Programming and Scripting

Weird tail output over ssh

Hello; Am trying to correct the formatting of tail output over ssh. Using the following code: echo "" > $FILE for BOX in $SERVERS do echo "Processing on $BOX" |tee -a $FILE echo "===============================" >> $FILE sudo ssh $BOX 'TERMINAL="vt100" /usr/bin/sh -s' <... (2 Replies)
Discussion started by: delphys
2 Replies

9. HP-UX

[Solved] Weird 'ls -l' output

Hello folks, I've found an HP-UX server with a rare 'ls -l' output. Please see the attached file. Anybody knows how can I change the output to not have this extra tabulations? Thanks in advance! (10 Replies)
Discussion started by: carpannav
10 Replies

10. UNIX for Advanced & Expert Users

Weird output from ps command

Hi Guys, I am regular Solaris user. I came across a weird problem that puzzled me. Hope you guys can help. I found that process's state(command & arguments) in two different variants of ps command is different. Can anyone explain how is this possible? bash-3.2$ ps -eLo pid,s,comm,args |... (2 Replies)
Discussion started by: brij123
2 Replies
Bio::SeqFeature::Gene::GeneStructure(3pm)		User Contributed Perl Documentation		 Bio::SeqFeature::Gene::GeneStructure(3pm)

NAME
Bio::SeqFeature::Gene::GeneStructure - A feature representing an arbitrarily complex structure of a gene SYNOPSIS
# See documentation of methods. DESCRIPTION
A feature representing a gene structure. As of now, a gene structure really is only a collection of transcripts. See Bio::SeqFeature::Gene::TranscriptI (interface) and Bio::SeqFeature::Gene::Transcript (implementation) for the features of such objects. 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 - Hilmar Lapp Email hlapp-at-gmx.net APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ transcripts Title : transcripts Usage : @transcripts = $gene->transcripts(); Function: Get the transcripts of this gene structure. Many gene structures will have only one transcript. Returns : An array of Bio::SeqFeature::Gene::TranscriptI implementing objects. Args : add_transcript Title : add_transcript() Usage : $gene->add_transcript($transcript); Function: Add a transcript to this gene structure. Returns : Args : A Bio::SeqFeature::Gene::TranscriptI implementing object. flush_transcripts Title : flush_transcripts() Usage : $gene->flush_transcripts(); Function: Remove all transcripts from this gene structure. Returns : Args : add_transcript_as_features Title : add_transcript_as_features Usage : $gene->add_transcript_as_features(@featurelist); Function: take a list of Bio::SeqFeatureI objects and turn them into a Bio::SeqFeature::Gene::Transcript object. Add that transcript to the gene. Returns : nothing Args : a list of Bio::SeqFeatureI compliant objects promoters Title : promoters Usage : @prom_sites = $gene->promoters(); Function: Get the promoter features of this gene structure. This method basically merges the promoters returned by transcripts. Note that OO-modeling of regulatory elements is not stable yet. This means that this method might change or even disappear in a future release. Be aware of this if you use it. Returns : An array of Bio::SeqFeatureI implementing objects. Args : exons Title : exons() Usage : @exons = $gene->exons(); @inital_exons = $gene->exons('Initial'); Function: Get all exon features or all exons of a specified type of this gene structure. Exon type is treated as a case-insensitive regular expression and optional. For consistency, use only the following types: initial, internal, terminal, utr, utr5prime, and utr3prime. A special and virtual type is 'coding', which refers to all types except utr. This method basically merges the exons returned by transcripts. Returns : An array of Bio::SeqFeature::Gene::ExonI implementing objects. Args : An optional string specifying the type of exon. introns Title : introns() Usage : @introns = $gene->introns(); Function: Get all introns of this gene structure. Note that this class currently generates these features on-the-fly, that is, it simply treats all regions between exons as introns. It assumes that the exons in the transcripts do not overlap. This method basically merges the introns returned by transcripts. Returns : An array of Bio::SeqFeatureI implementing objects. Args : poly_A_sites Title : poly_A_sites() Usage : @polyAsites = $gene->poly_A_sites(); Function: Get the poly-adenylation sites of this gene structure. This method basically merges the poly-adenylation sites returned by transcripts. Returns : An array of Bio::SeqFeatureI implementing objects. Args : utrs Title : utrs() Usage : @utr_sites = $gene->utrs('3prime'); @utr_sites = $gene->utrs('5prime'); @utr_sites = $gene->utrs(); Function: Get the features representing untranslated regions (UTR) of this gene structure. You may provide an argument specifying the type of UTR. Currently the following types are recognized: 5prime 3prime for UTR on the 5' and 3' end of the CDS, respectively. This method basically merges the UTRs returned by transcripts. Returns : An array of Bio::SeqFeature::Gene::ExonI implementing objects representing the UTR regions or sites. Args : Optionally, either 3prime, or 5prime for the the type of UTR feature. sub_SeqFeature Title : sub_SeqFeature Usage : @feats = $gene->sub_SeqFeature(); Function: Returns an array of all subfeatures. This method is defined in Bio::SeqFeatureI. We override this here to include the transcripts. Returns : An array Bio::SeqFeatureI implementing objects. Args : none flush_sub_SeqFeature Title : flush_sub_SeqFeature Usage : $gene->flush_sub_SeqFeature(); $gene->flush_sub_SeqFeature(1); Function: Removes all subfeatures. This method is overridden from Bio::SeqFeature::Generic to flush all additional subfeatures, i.e., transcripts, which is almost certainly not what you want. To remove only features added through $gene->add_sub_SeqFeature($feature) pass any argument evaluating to TRUE. Example : Returns : none Args : Optionally, an argument evaluating to TRUE will suppress flushing of all gene structure-specific subfeatures (transcripts). perl v5.14.2 2012-03-02 Bio::SeqFeature::Gene::GeneStructure(3pm)
All times are GMT -4. The time now is 03:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy