Module Expr Str Import alias Import alias Import alias Import alias Import alias identifier FunctionDef arguments args NameParam NameParam NameParam defaults Str body Expr Str Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore NameLoad body If BoolOpOr CompareLt NameLoad Num CompareGt NameLoad Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad Continue For NameStore Call NameLoad NameLoad NameLoad body If CompareNotEq SubscriptLoad NameLoad Index NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad NameLoad AugAssignAdd NameStore Num Return TupleLoad Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword TupleLoad Str Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr keyword Num keyword Str keyword NameLoad keyword NameLoad keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad If AttributeLoad NameLoad attr body Assign NameStore Dict Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str Assign NameStore Num For NameStore NameLoad body If CompareEq SubscriptLoad NameLoad Index Num Str body Continue Assign TupleStore NameStore NameStore NameStore Call AttributeLoad SubscriptLoad NameLoad Slice Num attr Str If CompareNotIn NameLoad NameLoad body Assign SubscriptStore NameLoad Index NameLoad ListLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr TupleLoad Call NameLoad NameLoad Call NameLoad NameLoad AugAssignAdd NameStore Num If CompareGtE AttributeLoad NameLoad attr Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad Call NameLoad NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr orelse Assign NameStore NameLoad If AttributeLoad NameLoad attr body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str orelse Assign NameStore AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore ListLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign TupleStore NameStore NameStore NameStore NameStore TupleLoad Num Num Num Num Assign NameStore AttributeLoad NameLoad attr For NameStore NameLoad body If CompareEq SubscriptLoad NameLoad Index Num Str body Continue If CompareEq SubscriptLoad NameLoad Index Num Str body If NameLoad body If CompareGtE AttributeLoad NameLoad attr Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr If CompareIn NameLoad NameLoad body Assign TupleStore NameStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Str SubscriptLoad NameLoad Index NameLoad AttributeLoad NameLoad attr If NameLoad body AugAssignAdd NameStore Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str Call NameLoad NameLoad For NameStore NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str If NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad AugAssignAdd NameStore NameLoad AugAssignAdd NameStore Num AugAssignAdd NameStore Call NameLoad NameLoad Assign NameStore ListLoad Assign NameStore Call AttributeLoad NameLoad attr Str SubscriptLoad NameLoad Slice Num Num Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num Str Continue Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice Num If NameLoad body If CompareIn NameLoad NameLoad body Assign TupleStore NameStore NameStore NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Str SubscriptLoad NameLoad Index NameLoad AttributeLoad NameLoad attr If NameLoad body AugAssignAdd NameStore Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str Call NameLoad NameLoad For NameStore NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str AugAssignAdd NameStore NameLoad AugAssignAdd NameStore Num AugAssignAdd NameStore Call NameLoad NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr If CompareGtE AttributeLoad NameLoad attr Num body Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr
N/A N/A 
mask_fasta.py - mask fasta formatted sequences
==============================================

:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python

Purpose
-------

If the file contains multiple sequence entries, it is split
at entry boundaries. Currently, individual entries are not
split.

Usage
-----

Example::

   python mask_fasta.py --help

Type::

   python mask_fasta.py --help

for command line help.

Command line options
--------------------

 N/A sys N/A string N/A re N/A array N/A CGAT.Experiment E maskSequence N/A N/A sequence regions mask_char N/A N N/A N/A mask sequence with regions. N/A nmasked 0 N/A v N/A N/A array array c N/A N/A N/A v fromstring sequence N/A errors N/A N/A N/A start end regions N/A N/A N/A N/A start 0 N/A end N/A len sequence N/A N/A N/A N/A errors append N/A out of bounds: %i-%i N/A start end N/A N/A x N/A range start end N/A N/A N/A N/A v N/A x mask_char N/A N/A N/A v N/A x mask_char N/A nmasked 1 N/A N/A N/A N/A v tostring nmasked errors N/A main N/A N/A argv N/A None N/A N/A script main.

    parses command line options in sys.argv, unless *argv* is given.
     N/A N/A argv None N/A N/A argv N/A sys argv N/A parser N/A N/A E OptionParser version %prog version: $Id: mask_fasta.py 2782 2009-09-10 11:40:29Z andreas $ N/A N/A N/A parser add_option -e --extend dest extend type int help extend sequences by # residues. N/A N/A N/A parser add_option -o --output-filename-pattern dest output_pattern type string help output pattern for the genomic files. Should contain a %i. N/A N/A N/A parser add_option -s --sequence dest filename_sequence type string help sequence filename. N/A N/A N/A parser add_option -c --chunk-size dest chunk_size type int help chunk size in nucleotides. N/A N/A N/A parser add_option -f --format dest format type choice choices N/A fasta ranges help output format options. N/A N/A N/A parser add_option -m --mask-regions dest filename_mask_regions type string help mask regions - parameter is a filename of regions with forward strand coordinates in the format 'contig <tab> start <tab> end'. N/A N/A N/A parser set_defaults extend 0 format fasta filename_sequence None filename_mask_regions None mask_char N N/A N/A options args N/A N/A E Start parser add_pipe_options True N/A N/A options filename_mask_regions N/A N/A mask_regions N/A N/A infile N/A open N/A options filename_mask_regions r N/A nregions 0 N/A line infile N/A N/A N/A N/A line N/A 0 # N/A N/A N/A N/A contig start end N/A N/A N/A line N/A -1 split N/A N/A contig mask_regions N/A N/A N/A mask_regions N/A contig N/A N/A N/A N/A N/A mask_regions N/A contig append N/A N/A int start N/A int end N/A nregions 1 N/A N/A N/A options loglevel 1 N/A N/A N/A N/A N/A options stdlog write N/A # masking %i regions on %i contigs
 N/A nregions N/A len mask_regions N/A N/A contig regions N/A N/A mask_regions items N/A N/A N/A N/A regions sort N/A N/A N/A infile close N/A N/A mask_regions None N/A N/A options filename_sequence N/A N/A infile N/A open N/A options filename_sequence r N/A N/A infile N/A sys stdin N/A fragments N/A N/A sequences N/A N/A key None N/A description_rest None N/A N/A total_keys total_written total_masked nerrors N/A 0 0 0 0 N/A outfile N/A options stdout N/A line infile N/A N/A N/A N/A line N/A 0 # N/A N/A N/A N/A N/A line N/A 0 > N/A N/A fragments N/A N/A N/A N/A options loglevel 1 N/A N/A N/A N/A N/A options stdlog write N/A # processing sequence %s
 key N/A N/A N/A N/A options stdlog flush N/A N/A key mask_regions N/A N/A N/A sequence nmasked errors N/A maskSequence N/A N/A string join fragments N/A mask_regions N/A key N/A options mask_char N/A errors N/A N/A nerrors N/A len errors N/A N/A N/A N/A options stdlog write N/A # %i errors while masking
 N/A len errors N/A e errors N/A N/A N/A N/A N/A options stdlog write N/A # %s
 e N/A N/A sequence N/A N/A string join fragments N/A description_rest N/A N/A N/A N/A outfile write N/A >%s %s
%s
 N/A key description_rest sequence N/A N/A N/A N/A outfile write N/A >%s
%s
 N/A key sequence N/A total_masked nmasked N/A total_keys 1 N/A total_written N/A len sequence N/A fragments N/A N/A x N/A N/A re split \s N/A line N/A 1 -1 N/A key N/A x N/A 0 N/A description_rest N/A N/A string join N/A x N/A 1 N/A N/A N/A N/A fragments append N/A line N/A -1 N/A fragments N/A N/A N/A key mask_regions N/A N/A N/A sequence nmasked errors N/A maskSequence N/A N/A string join fragments N/A mask_regions N/A key N/A options mask_char N/A errors N/A N/A nerrors N/A len errors N/A N/A N/A N/A options stdlog write N/A # %i errors while masking
 N/A len errors N/A e errors N/A N/A N/A N/A N/A options stdlog write N/A # %s
 e N/A N/A sequence N/A N/A string join fragments N/A total_masked nmasked N/A total_keys 1 N/A total_written N/A len sequence N/A description_rest N/A N/A N/A N/A outfile write N/A >%s %s
%s
 N/A key description_rest sequence N/A N/A N/A N/A outfile write N/A >%s
%s
 N/A key sequence N/A N/A options filename_sequence N/A N/A N/A N/A infile close N/A N/A N/A options loglevel 1 N/A N/A N/A N/A N/A options stdlog write N/A # nkeys=%i, nwritten=%i, nmasked=%i, nerrors=%i
 N/A total_keys total_written total_masked nerrors N/A N/A N/A E Stop N/A N/A N/A __name__ __main__ N/A N/A N/A N/A sys exit N/A main N/A sys argv