root/galaxy-central/eggs/bx_python-0.5.0_dev_f74aec067563-py2.6-macosx-10.6-universal-ucs2.egg/EGG-INFO/scripts/maf_mask_cpg.py @ 3

リビジョン 3, 1.1 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1#!/usr/bin/python2.6
2
3"""
4Mask out potential CpG sites from a maf. Restricted or inclusive definition
5of CpG sites can be used. The total fraction masked is printed to stderr.
6
7usage: %prog < input > output
8    -m, --mask=N: Character to use as mask ('?' is default)
9    -r, --restricted: Use restricted definition of CpGs
10"""
11
12import bx.align
13import bx.align.maf
14from bx.cookbook import doc_optparse
15import sys
16import bx.align.sitemask.cpg
17
18def main():
19    options, args = doc_optparse.parse( __doc__ )
20    try:
21        if options.mask:
22            mask = options.mask
23        else:
24            mask = "?"
25    except:
26        doc_optparse.exception()
27
28    reader = bx.align.maf.Reader( sys.stdin )
29    writer = bx.align.maf.Writer( sys.stdout )
30
31    if options.restricted:
32        cpgfilter = bx.align.sitemask.cpg.Restricted( mask=mask )
33    else:
34        cpgfilter = bx.align.sitemask.cpg.Inclusive( mask=mask )
35    cpgfilter.run( reader, writer.write )
36
37    print >> sys.stderr, str( float(cpgfilter.masked)/float(cpgfilter.total) * 100 ) + "% bases masked."
38
39if __name__ == "__main__":
40    main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。