Question: extracting multiple columns from a file
0
gravatar for A
2.7 years ago by
A3.6k
A3.6k wrote:

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 • 959 views
ADD COMMENTlink modified 9 months ago by wag0 • written 2.7 years ago by A3.6k
1

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 REPLYlink modified 2.7 years ago • written 2.7 years ago by st.ph.n2.5k
1

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

ADD REPLYlink written 2.7 years ago by RamRS25k

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 REPLYlink modified 2.7 years ago • written 2.7 years ago by A3.6k

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

ADD REPLYlink written 2.7 years ago by st.ph.n2.5k
2
gravatar for Santosh Anand
2.7 years ago by
Santosh Anand5.0k
Santosh Anand5.0k wrote:

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

ADD COMMENTlink modified 2.7 years ago • written 2.7 years ago by Santosh Anand5.0k
1

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

ADD REPLYlink modified 2.7 years ago • written 2.7 years ago by h.mon28k
1
gravatar for genomax
2.7 years ago by
genomax75k
United States
genomax75k wrote:

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 COMMENTlink modified 2.7 years ago • written 2.7 years ago by genomax75k

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

ADD REPLYlink modified 2.7 years ago • written 2.7 years ago by A3.6k
1

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

ADD REPLYlink written 2.7 years ago by genomax75k

thank you, data -- > filter worked well.

ADD REPLYlink written 2.7 years ago by A3.6k
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: 1549 users visited in the last hour