I have many .txt files with the following information in 4 columns and thousands of rows:
chr10 73121691 18 SLC29A3
chr10 73121692 14 SLC29A3
chr10 73121693 10 SLC29A3
chr10 73120590 15 SLC29A3
chr10 73120591 15 SLC29A3
chr10 73120592 6 SLC29A3
chr10 12345678 25 COL1A1
chr10 12345679 8 COL1A1
chr10 12345680 6 COL1A1
chr17 48431036 5 LRP5
chr17 48431037 8 LRP5
chr17 48431038 5 LRP5
What I would like as an output is the following:
chr10 73121691 - 73121693 , 14, SLC29A3
chr10 73120590 - 73120592 , 12, SLC29A3
chr10 12345679 - 12345680 , 13, COL1A1
chr17 48431036 - 48431038 , 6, LRP5
The chr# range of consecutive numbers, average of column 3 and name associated with the range.
Is there a script I could use to do this on multiple files in one go?
Thanks