Author Topic: is there a feature to concatenate values using bedmap or bedops?  (Read 4127 times)

cohendm

  • Newbie
  • *
  • Posts: 5
Is there a feature in the bedops program that enables concatenation of all scores that intersect a certain region of interest? My goal is to get 3 metrics. First, the mean of all scores intersecting a region of interest (I know how to use bedmap to do this). Second and third are to get the score at the first (5' edge) and last (3' edge) position of a region of interest. In principle, I could approach this task by making 3 different map files (total interval size, 5' edge only, 3' edge only). But I'm wondering if there is a more efficient way. The rationale for inquiring about concatenating the scores would be if bedops can not output this information on edge-associated scores directly. It is feasible to extract this information from a concatenated score list using other software. Any suggestions on the best path here?

sjn

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
Re: is there a feature to concatenate values using bedmap or bedops?
« Reply #1 on: May 29, 2015, 11:02:38 AM »
bedmap --echo-map-score

will spit out all scores of all overlapping regions, and the list order will correspond to the genomic order of the overlapping elements.

bedmap --echo --mean --echo-map-score file1.bed file2.bed \
  | awk -F"|" '{ length=split($3, a, ";"); print $1"\t"$2"\t"a[1]"\t"a[length]; }'

will probably give you what you want.  I didn't run the code, so there may be a slight bug - I think it will work as-is.

Shane