extracting multiple columns from a file
2
0
Entering edit mode
7.1 years ago
zizigolu ★ 4.3k

Hi,

I have a file like below

https://k52i.imgup.net/Untitled763f.jpg

I want to extract rest of columns if in gene column we have MYC, YY1 and TP53 and in organism column we have human

how I can do that please?

Excel • 1.9k views
ADD COMMENT
1
Entering edit mode

Have you tried anything in R?

Since you have an Excel file, I would save as text tab-delimited.

egrep 'MYC|YY1|TP53' transmir_v1.2.txt | awk -F'\t' '{if ($6=="human") { print } } > filtered.txt
ADD REPLY
1
Entering edit mode

Please do not use irrelevant tags. You're using Excel here, why use the R tag?

ADD REPLY
0
Entering edit mode

Thank you Ram. I edited the tag. Actually at first I was only thinking about R (in the absence of Linux) but genomax2 abruptly solved the problem by Excel.

ADD REPLY
0
Entering edit mode

I think the OP had an excel file, but wanted to use R.

ADD REPLY
2
Entering edit mode
7.1 years ago

You just need the auto-filter of Excel: http://www.wikihow.com/Use-AutoFilter-in-MS-Excel

ADD COMMENT
1
Entering edit mode

After saving the table, check if excel hasn't modified some gene names.

ADD REPLY
1
Entering edit mode
7.1 years ago
GenoMax 141k

First sort on the organism column (and save the part with "human") as text (comma or tab delimited format) from Excel.

Take inspiration from this post and try a few things out: A: Split single columm into multiple colums

You can also use awk with correct delimiter, along with a checking if/else construct as an alternative.

Note: Someone will spoil your learning by posting a ready-made solution before long but resist the urge to use that solution :)

ADD COMMENT
0
Entering edit mode

thank you I will try that. no access to Linux at the time but I will try in R and excel.

ADD REPLY
1
Entering edit mode

If you only have excel then use the data --> filter options.

ADD REPLY
0
Entering edit mode

thank you, data -- > filter worked well.

ADD REPLY

Login before adding your answer.

Traffic: 1703 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