Biostar Beta. Not for public use.
Trying to get a GREP of things...
0
Entering edit mode
2.7 years ago
Hushus • 20

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!!!!!

gene grep awk • 556 views
ADD COMMENTlink
0
Entering edit mode
cat Genes_of_interest.txt | grep -e "$1" flyBaseGene.txt > results.txt
ADD REPLYlink
0
Entering edit mode

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

ADD REPLYlink
0
Entering edit mode

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
1
Entering edit mode
19 months ago
France/Nantes/Institut du Thorax - INSE…

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
0
Entering edit mode

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
0
Entering edit mode

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

ADD REPLYlink
0
Entering edit mode

This didnt work :(

btw big fan of you

ADD REPLYlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.3.1