...
One useful way to compare two experiments (especially biological replicates, or similar experiments in two yeast strains/cell lines/mouse strains) is to compare where reads in one experiment overlap with reads in another experiment. Bedtools offers a simple way to do this using the intersect function.
The intersect function has many options that control how to report the intersection. We'll be focusing on just a few of these options, listed below.
-a and -b indicate what files to intersect. in -b, you can specify one, or several files to intersect with the file specified in -a.
In this section, we'll intersect two human experiments - one from sequencing RNA, and one from sequencing miRNA. Copy these files over to your directory:
Code Block | ||||
---|---|---|---|---|
| ||||
cds
mkdir intersect
cd intersect
cp /scratch/02423/nsabell/core_ngs/alignment/bam/human_rnaseq_bwa.bam .
cp /scratch/02423/nsabell/core_ngs/alignment/bam/human_mirnaseq.bam . |
As above, let's convert the high quality reads from these files over into a filtered bam file, then a bed file.
Exercise 5: Intersect two experiments using intersect and examine the output
Using the options we've specified (-wao) the resulting file will have entries for file A, file B and the number of base pairs overlap between the feature in A and the features in B.