I'm doing an exercise that asks for two files:

  • Input 1: A target file (.bed format) contains multiple regions from chr7:40000000-50000000 of human reference genome GRCh37 (hg19)
  • Input 2: Refseq exon list file (.bed format) for all human coding genes (hg19 position)

The final goal is:

For all genes located in chr7:40000000-50000000, get the summary statistics of the target file coverage. (For each gene, get the fraction of exonic bases that was covered by the target file).

  • I believe what they refer in this exercise is that the target file should be something like the whole chr sizes of hg19 hg19.chr.sizes and refseq_exon_list the list of exons from reqseq database. Both can be downloaded from tools like table browser .Is that correct ?

  • I'm not sure which files I should download here to perform this task. Once downloaded the file I believe what I need to do is to restrict the refseq_exon_list by the requested region and then perform coverage with something like bedtools. Something on those lines bedtools coverage -a hg19.chr.sizes -b reqseq_exon_list.

Am i right here ? Any input is appreciated, thanks.


2 Answers 2


Based on the description in your question, I don't think this assumption is correct:

I believe what they refer in this exercise is that the target file should be something like the whole chr sizes of hg19 hg19.chr.sizes [. . .]

I understand that the question is asking you to simply produce a random selection of sub-regions from chromosome 7, all of which fall within the larger region 40000000-50000000. It can't be the list of chromosome sizes since, first of all, the question is asking you to get regions from chr17 only, and second because that just wouldn't make sense: only chr17 is relevant here, so the rest would be useless and, in any case, the length of the chromosome itself isn't helpful information.

The idea here is to demonstrate that given a set of genomic regions and a list of start and end coordinates of exons, you can calculate how many of your exons overlap the target regions. Therefore, the steps to follow would be:

  1. Generate random intervals in the 40000000-50000000 range.
  2. Get the bed file for all human coding genes on hg19. You should indeed be able to download this from the UCSC genome browser, among other places.
  3. Use a tool, bedtools or build your own using awk, or anything else that takes your fancy and for each gene found in the chr7:40000000-50000000 range, calculate how many bases of its exons fall within your randomly chosen selection of regions.

Of course, the best thing to do would be to ask your teacher to clarify.


This sounds like homework - can you post what you have tried so far + a few lines of the input files + your code? Also, please add the "homework" tag if this is homework, or a task from a learning exercise.

Without giving it away think about the information in your Refseq exon list file. Is it a 3-field bed file with just coordinates, or is it the expanded file format with fields 4-12? Do you really need to download the RefSeq annotation, or can you parse the information in your bed file to answer your question?

It sounds like this is your ultimate goal:

For each gene, get the fraction of exonic bases that was covered by the target file.

What information from the output of bedtools coverage will give you this answer? Does this information exactly match the spec you provided? Are there other tools in bedtools you could use to achieve the same thing?

Side note: It isn't 100% clear what you are asking and what your inputs are. I think the policy here isn't to outright answer homework questions without seeing evidence of some attempts. Someone can provide a better answer if you can update your question.

  • $\begingroup$ The problem is that I don't have the input files. The question implicitly hints on what should be downloaded from public resources but I don't know what to download in the first place =(. If I knew it then surely my attempt would be here. $\endgroup$
    – moth
    Commented Nov 7, 2021 at 16:36
  • $\begingroup$ Download the refseq human genome annotation in gff format. You can find that in the older versions here: ncbi.nlm.nih.gov/genome/?term=human . You can use this gff file to do all of the things that you mentioned above. $\endgroup$
    – conchoecia
    Commented Nov 7, 2021 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.