This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bedtools, linux, rnaseq

I have 6 files where I have the number of reads mapping to each gene on chr22. and a a Rnagene file which has number of reads mapping every gene. How do I create a tab delineated file contianing the number of reads mapping to each gene on chr22 using coverage bed ?

linux coveragebed rna-seq

2 answers

join, a little python script, a little perl script, R, grep, etc.

There are many ways to do this. What have you tried that didn't work?

i did it using join but I am unable to add a header to the table

The join tool glues columns. You could use a different tool to write a header, such as awk, echo, Perl, Python, etc. What else have you tried?

If you want to write a header, you could use a variety of tools, such as awk, echo and others.

For example, to add the tab-delimited header A \t B \t C to foo.txt:

$ awk 'BEGIN{print "A\tB\tC"} {print $0;}' foo.txt > foo-with-header.txt

Or via echo:

$ echo -e "A\tB\tC" | cat - foo.txt > foo-with-header.txt

Lots of ways to do this.

Log in to answer this question.