Question: Trying to get a GREP of things...
0
gravatar for Hushus
14 months ago by
Hushus 20
Hushus 20 wrote:

Hi all,

First time poster, long time reader.

I have a list of genes in a .txt file. This is a simple column of all the genes I want to know more about I also have a flyBaseGene.txt file, a tab delimited file containing information like TSS start, stop, and all the other fun stuff. [My genes of interest match those in flybasegene by simple Ctrl+F]

I've tried for a while running the following command with some variations in Linux with no desired outcome.

grep -F Genes_of_interest.txt flyBaseGene.txt > Pleasework.txt

Please help!!11!11!1!!1!!!!!

awk grep gene • 431 views
ADD COMMENTlink modified 14 months ago by Pierre Lindenbaum116k • written 14 months ago by Hushus 20
cat Genes_of_interest.txt | grep -e "$1" flyBaseGene.txt > results.txt
ADD REPLYlink modified 14 months ago • written 14 months ago by st.ph.n2.4k

This gave me the flybasegene.txt file + the genes of interest listed at the bottom...

ADD REPLYlink written 14 months ago by Hushus 20

put this in bash script:

#!/usr/bin/bash

grep -e "$1" flyBaseGene.txt >> results.txt

save as grep_gene.sh, then:

cat Genes_of_interest.txt | xargs -n 1 bash grep_gene.sh
ADD REPLYlink modified 14 months ago • written 14 months ago by st.ph.n2.4k
1
gravatar for Pierre Lindenbaum
14 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum116k wrote:

you're using

   -F, --fixed-strings
          Interpret PATTERN as a  list  of  fixed  strings,  separated  by
          newlines,  any  of  which is to be matched.  (-F is specified by
          POSIX.)

you want

   -f FILE, --file=FILE
          Obtain  patterns  from  FILE,  one  per  line.   The  empty file
          contains zero patterns, and therefore matches nothing.   (-f  is
          specified by POSIX.)


grep -f Genes_of_interest.txt flyBaseGene.txt > Pleasework.txt
ADD COMMENTlink modified 14 months ago • written 14 months ago by Pierre Lindenbaum116k

better than grep , use join:

join -t $'\t' -1 1 -2 1 <(sort -t $'\t' -k1,1 list1.txt)   <(sort -t $'\t' -k1,1 list2.txt)
ADD REPLYlink written 14 months ago by Pierre Lindenbaum116k

"sort: cannot read: '\t': No such file or directory"

ADD REPLYlink written 14 months ago by Hushus 20

This didnt work :(

btw big fan of you

ADD REPLYlink written 14 months ago by Hushus 20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1713 users visited in the last hour