/* intervalToBed - Simple little paraFlow utility ... yeah a fancy awk */ /* could've done the job too. */ to usage() { prin(' Convert simple WindowMasker output into BED 5. The 5th column is all 1000, which is dumb, but the score will be used in similar BED 5 tables from other denovo repeat programs. usage: intervalToBed input.int output.bed '); } to intervalToBed(string input, string output) { file intFile = fileOpen(args[0], 'r'); file bedFile = fileOpen(args[1], 'w'); string chrom = intFile.readLine().trim().rest(5); int repNum = 1; for (line in intFile.readLine()) { array of string parts = line.split(" -\n"); int start = parts[0].asInt(); int end = parts[3].asInt() + 1; bedFile.write("$chrom\t$start\t$end\t$chrom.$repNum\t1000\n"); repNum += 1; } } /*** Main! ***/ if (args.size == 2) intervalToBed(args[0], args[1]); else usage();