File: makeBashScripts.py

package info (click to toggle)
bedtools 2.31.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 57,304 kB
  • sloc: ansic: 38,507; cpp: 29,721; sh: 8,001; makefile: 663; python: 240; javascript: 16
file content (61 lines) | stat: -rwxr-xr-x 2,054 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
# encoding: utf-8
"""
makeBashScripts.py
"""

import sys
import os


def main():
    tool_map =  {'annotate': 'annotateBed', 
                 'bamtobed': 'bamToBed',
                 'bamtofastq': 'bamToFastq', 
                 'bed12tobed6': 'bed12ToBed6', 
                 'bedpetobam': 'bedpeToBam', 
                 'bedtobam': 'bedToBam', 
                 'closest': 'closestBed',
                 'cluster': 'clusterBed',
                 'complement': 'complementBed',
                 'coverage': 'coverageBed', 
                 'expand': 'expandCols',
                 'flank': 'flankBed', 
                 'genomecov': 'genomeCoverageBed', 
                 'getfasta': 'fastaFromBed',
                 'groupby': 'groupBy',
                 'igv': 'bedToIgv', 
                 'intersect': 'intersectBed', 
                 'links': 'linksBed', 
                 'map': 'mapBed', 
                 'maskfasta': 'maskFastaFromBed', 
                 'merge': 'mergeBed', 
                 'multicov': 'multiBamCov', 
                 'multiinter': 'multiIntersectBed', 
                 'nuc': 'nucBed',
                 'overlap': 'getOverlap', 
                 'pairtobed': 'pairToBed', 
                 'pairtopair': 'pairToPair', 
                 'random': 'randomBed', 
                 'shift': 'shiftBed',
                 'shuffle': 'shuffleBed', 
                 'slop': 'slopBed', 
                 'sort': 'sortBed', 
                 'subtract': 'subtractBed', 
                 'tag': 'tagBam', 
                 'unionbedg': 'unionBedGraphs', 
                 'window': 'windowBed',
                 'makewindows': 'windowMaker'}

    # create a BASH script for each old tool, mapping to the new CLI command.
    for tool in tool_map:
        new = tool
        old = tool_map[tool]
        
        script = open('bin/'  + old, 'w')
        script.write("#!/bin/sh\n")
        script.write("${0%/*}/bedtools " + new + " \"$@\"\n")
        script.close()

if __name__ == "__main__":
    main()