-
-
Save icaoberg/0534d2de204cdcc321eab224a2ed4d3d to your computer and use it in GitHub Desktop.
[bedtools] Compute average scores for share intervals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# icaoberg - this example is fork that uses a bedtools in a Singularity container | |
CONTAINER=../../singularity-bedtools.simg | |
echo "chr1 10 50 10" > a.bed | |
echo "chr1 20 40 20" > b.bed | |
echo "chr1 30 33 30" > c.bed | |
# Find the sub-intervals shared and unique to each file. | |
if [ -f $CONTAINER ]; then | |
singularity run --app bedtools $CONTAINER multiinter -i a.bed b.bed c.bed | column -t | |
fi | |
# Intersect the sub-intervals with the original intervals to collect the scores | |
if [ -f $CONTAINER ]; then | |
singularity run --app bedtools $CONTAINER multiinter -i a.bed b.bed c.bed \ | |
| singularity run --app bedtools $CONTAINER intersect -a - -b a.bed b.bed c.bed -wa -wb \ | |
| column -t | |
fi | |
# Grooupby the sub-intervals with the mean score from each of the original files. | |
if [ -f $CONTAINER ]; then | |
singularity run --app bedtools $CONTAINER multiinter -i a.bed b.bed c.bed \ | |
| singularity run --app bedtools $CONTAINER intersect -a - -b a.bed b.bed c.bed -wa -wb \ | |
| singularity run --app bedtools $CONTAINER groupby -g 1-5 -c 13 -o mean \ | |
| column -t | |
fi | |
rm -f *.bed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment