This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is it possible to get .bed file of sequenced regions after NGS experiment?

Hello,

As it is in post title, Is it possible to get .bed file of sequenced regions after NGS experiment? I mean that you have results of NGS experiment, let's take WES of 6 samples. Than I'd like to generate .bed file with regions of sequenced regions.

To be honest I need this to generate opportunity matrix which is created from those regions:

3.1 of below vignette https://www.bioconductor.org/packages/3.7/bioc/vignettes/signeR/inst/doc/signeR-vignette.html

Unfortunately I didn't recieve any of .bed files from the company that performed the experiment. All I got are .bam's.

In addition to this, can I take regions of coding sequences from UCSC's table browser?

Best regards, Adam

ngs bed

1 answer

You can use BEDOPS bam2bed:

$ bam2bed < reads.bam > reads.bed

Or BEDOPS convert2bed, to do the same thing:

$ convert2bed -i bam < reads.bam > reads.bed

If you have a bunch of BAM files in one directory and you're running bash:

$ for fn in `ls *.bam`; do bam2bed < ${fn} > ${fn%.*}.bed; done

To get coding sequences, you could download Gencode records and filter them for CDS entries (assuming hg38):

$ wget -qO- ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_28/gencode.v28.annotation.gff3.gz \
    | gunzip --stdout - \
    | awk '$3 == "CDS"' - \
    | convert2bed -i gff - \
    > CDS.bed

Amazing! That is what I need, many thanks!

GNU Parallel is great, but it is IO limited when running on serial hardware.

If you really want to take advantage of parallelization, and you have indexed BAM files, and you have a Slurm or SGE cluster, take a look at bam2bed_slurm or bam2bed_sge. Or, preferably, bam2starch_slurm or bam2starch_sge to make Starch archives.

I fixed the link to the Gencode v28 URL.

URL fixed. Thanks.@Alex.

BEDOPS and Unix streams are an awesome combination. Use them where you can!

Log in to answer this question.