Extracting features from a file from another file with an ID list
1
1
Entering edit mode
10.3 years ago
ljohanam ▴ 30

Guys,

I need to extract some features from a DEG file like a Log2 Fold change from an ID gene list. I'm trying with python but I haven't enough experience with programming, this task is resulting complex. I don't know if this is the best way or is better to construct a database using SQlite. What is your advice or somebody have already one script for python or R.....

From already thank you very much.

SQLite Python • 5.0k views
ADD COMMENT
0
Entering edit mode
10.3 years ago

I may be wrong but I assume you want to print or extract lines from a file using some patterns or id stored in another file. If this is the case try "grep -F -f file1(with geneids) file2 (big file with expression information)"

ADD COMMENT
0
Entering edit mode

Ashutosh Pandey I try with this: grep -F -f thatineed.txt searchhere.txt but is not work, I don't receive any result... these are my example files:

thatineed.txt

evm.TU.supercontig_32.161
evm.TU.supercontig_19.58
evm.TU.supercontig_125.26
evm.TU.supercontig_27.252

searchhere.txt

evm.TU.supercontig_32.161    -3,9
evm.TU.supercontig_19.58    -3,9
evm.TU.supercontig_125.26    -3,8
evm.TU.supercontig_27.252    -3,8
evm.TU.supercontig_7.165    -3,6
evm.TU.supercontig_112.75    -3,5
evm.TU.supercontig_81.9    -3,5
evm.TU.supercontig_91.13    -3,5
evm.TU.supercontig_23.147    -3,4
evm.TU.supercontig_190.11    -3,4
evm.TU.supercontig_2.268    -3,4
evm.TU.supercontig_53.153    -3,4
evm.TU.supercontig_131.79    -3,3
evm.TU.supercontig_19.175    -3,3
evm.TU.supercontig_146.42    -3,3
evm.TU.supercontig_95.62    -3,3

What I would expect:

evm.TU.supercontig_32.161    -3,9
evm.TU.supercontig_19.58    -3,9
evm.TU.supercontig_125.26    -3,8
evm.TU.supercontig_27.252    -3,8

Thank you again :)

ADD REPLY
0
Entering edit mode

I copied your example and it worked for me. I assume you are using UNIX to do this. In your case the command would be

grep -F -f thatineed.txt searchhere.txt

What error are you getting or the command doesn't print anything in your case?

ADD REPLY
0
Entering edit mode

Not, I'm using Linux (ubuntu) and yes, doesn't print anything.... I think for Linux is the same command or doesn't?

ADD REPLY
0
Entering edit mode

Hi,

I checked it on CentOS like that:

$ grep -wFf thatineed.txt searchhere.txt

and what I got is:

evm.TU.supercontig_32.161    -3,9
evm.TU.supercontig_19.58    -3,9
evm.TU.supercontig_125.26    -3,8
evm.TU.supercontig_27.252    -3,8

If that does not work for you maybe something is strange with your POSIX?

ADD REPLY
0
Entering edit mode

I don't know what happen I did everything... and when I try with a word it work:

grep -F 'evm.TU.supercontig_32.161' searchhere.txt > results.txt
evm.TU.supercontig_32.161    -3,9

but when I try with a file it returns me an empty file:

bioinformatica@bioinformatica2:~/Área de Trabalho$ grep -F -f thatineed.txt searchhere.txt
bioinformatica@bioinformatica2:~/Área de Trabalho$

I think grep is perfect for my task if it get work :D.

Really, thank you for your patience.

ADD REPLY
1
Entering edit mode

I had the exact same problem and want to share the solution for future readers: check the line-endings in your files (files created in windows use '\r\n', while linux expects '\n'). You can find-and-replace with almost any text-editor.

ADD REPLY

Login before adding your answer.

Traffic: 2165 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6