Question: Split bam files from ATAC-seq PE data into nucleosome free and nucleosomal regions
1
gravatar for anlo
2.1 years ago by
anlo10
anlo10 wrote:

Hi guys,

I am looking for some options to split a BAM file based on the insert size with the purpose of separating nucleosome free regions (i.e. regions below approx. 100bp) in ATAC-seq data from larger nucleosomal regions. As far as I can see from discussions at this site, some use deeptools/bamCoverage with specification of --maxFragmentLength to generate a bedgraph/bigwig file that only contains nucleosome free region. I would preferably like to keep the bam file format, so do any of you have some ideas to a commando/tool that do the job of splitting a bam file based on insert sizes.

Thanks, Anne

nfr atac-seq bam • 1.9k views
ADD COMMENTlink modified 2.1 years ago by Friederike5.7k • written 2.1 years ago by anlo10
5
gravatar for ATpoint
2.1 years ago by
ATpoint35k
Germany
ATpoint35k wrote:

This piece of code can extract fragments of a certain length and write to a new bam file:

#!/bin/bash
samtools view -h $1 | \
  awk -v LEN=$2 '{if ($9 <= LEN && $9 >= -(LEN) && $9 != 0 || $1 ~ /^@/) print $0}' | \
  samtools view -bh -o out.bam -

## Example to get fragments of 147bp or smaller:
./code.sh in.bam 147

For matters of completeness, you may check out the NucleoATAC software, which is designed to infer nucleosome-free and nucleosome-occupied regions within open chromatin domains. Documentation is (at least for me) quiet bulky and uneasy to digest, but maybe it can help you.

ADD COMMENTlink modified 2.1 years ago • written 2.1 years ago by ATpoint35k
0
gravatar for Friederike
2.1 years ago by
Friederike5.7k
United States
Friederike5.7k wrote:

haven't used it myself, but I remember that ATACseqQC did something along those lines -- check out their vignette

ADD COMMENTlink written 2.1 years ago by Friederike5.7k
Please log in to add an answer.

Help
Access

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