Question: (Closed) Filter .bed file by numbers in final column
0
gravatar for kdc15
4 months ago by
kdc1530
kdc1530 wrote:

Hi,

I would like to filter a .bed file by numbers in the last column:

chr1    0       14400   18
chr1    14400   19000   6
chr1    19000   567400  18
chr1    567400  567800  10
chr1    567800  713200  18
chr1    713200  713800  2
chr1    713800  714600  1
chr1    714600  715400  2
chr1    715400  724000  6

How can I create a new file with lines that only contain 1,2 and 18? like this:

chr1    0       14400   18
chr1    19000   567400  18
chr1    567800  713200  18 
chr1    713200  713800  2
chr1    713800  714600  1
chr1    714600  715400  2

Would it involve using the awk command?

Many Thanks

filter file genomic sequence bed • 150 views
ADD COMMENTlink written 4 months ago by kdc1530
3

I googled and the first hit for "awk filter column by value" was "Using AWK to Filter Rows" : https://www.tim-dennis.com/data/tech/2016/08/09/using-awk-filter-rows.html

ADD REPLYlink written 4 months ago by Pierre Lindenbaum120k

Hello kdecoteau!

We believe that this post does not fit the main topic of this site.

Just an awk question, not really bioinformatics.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink written 4 months ago by RamRS21k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1825 users visited in the last hour