Question: extracting multiple columns from a file
0
gravatar for F
24 months ago by
F3.4k
Iran
F3.4k 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 • 786 views
ADD COMMENTlink modified 5 weeks ago by wag0 • written 24 months ago by F3.4k
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 24 months ago • written 24 months ago by st.ph.n2.4k
1

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

ADD REPLYlink written 24 months ago by RamRS20k

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 24 months ago • written 24 months ago by F3.4k

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

ADD REPLYlink written 24 months ago by st.ph.n2.4k
2
gravatar for Santosh Anand
24 months ago by
Santosh Anand4.7k
Santosh Anand4.7k wrote:

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

ADD COMMENTlink modified 24 months ago • written 24 months ago by Santosh Anand4.7k
1

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

ADD REPLYlink modified 24 months ago • written 24 months ago by h.mon24k
1
gravatar for genomax
24 months ago by
genomax64k
United States
genomax64k 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 24 months ago • written 24 months ago by genomax64k

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

ADD REPLYlink modified 24 months ago • written 24 months ago by F3.4k
1

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

ADD REPLYlink written 24 months ago by genomax64k

thank you, data -- > filter worked well.

ADD REPLYlink written 24 months ago by F3.4k
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: 1210 users visited in the last hour