[hg] galaxy 2372: Added an option to mask non-CpG sites to the \...
details: http://www.bx.psu.edu/hg/galaxy/rev/ea9235523069 changeset: 2372:ea9235523069 user: guru date: Mon Apr 27 11:59:42 2009 -0400 description: Added an option to mask non-CpG sites to the \"Mask CpG sites\" tool. 2 file(s) affected in this change: tools/regVariation/maf_cpg_filter.py tools/regVariation/maf_cpg_filter.xml diffs (115 lines): diff -r 76bd876ed230 -r ea9235523069 tools/regVariation/maf_cpg_filter.py --- a/tools/regVariation/maf_cpg_filter.py Mon Apr 27 11:39:58 2009 -0400 +++ b/tools/regVariation/maf_cpg_filter.py Mon Apr 27 11:59:42 2009 -0400 @@ -1,5 +1,5 @@ #!/usr/bin/python - +#Guruprasad Ananda #Adapted from bx/scripts/maf_mask_cpg.py """ Mask out potential CpG sites from a maf. Restricted or inclusive definition @@ -27,12 +27,11 @@ def main(): options, args = doc_optparse.parse( __doc__ ) try: - inp_file, out_file, definition = args + inp_file, out_file, sitetype, definition = args if options.mask: mask = int(options.mask) else: mask = 0 - definition = int(definition) except: print >> sys.stderr, "Tool initialization error." sys.exit() @@ -43,14 +42,19 @@ mask_chr_dict = {0:'#', 1:'$', 2:'^', 3:'*', 4:'?'} mask = mask_chr_dict[mask] - if definition == 1: - cpgfilter = bx.align.sitemask.cpg.Restricted( mask=mask ) - defn = "Restricted" + if sitetype == "CpG": + if int(definition) == 1: + cpgfilter = bx.align.sitemask.cpg.Restricted( mask=mask ) + defn = "CpG-Restricted" + else: + cpgfilter = bx.align.sitemask.cpg.Inclusive( mask=mask ) + defn = "CpG-Inclusive" else: - cpgfilter = bx.align.sitemask.cpg.Inclusive( mask=mask ) - defn = "Inclusive" + cpgfilter = bx.align.sitemask.cpg.nonCpG( mask=mask ) + defn = "non-CpG" cpgfilter.run( reader, writer.write ) print "%2.2f percent bases masked; Mask character = %s, Definition = %s" %(float(cpgfilter.masked)/float(cpgfilter.total) * 100, mask, defn) + if __name__ == "__main__": main() diff -r 76bd876ed230 -r ea9235523069 tools/regVariation/maf_cpg_filter.xml --- a/tools/regVariation/maf_cpg_filter.xml Mon Apr 27 11:39:58 2009 -0400 +++ b/tools/regVariation/maf_cpg_filter.xml Mon Apr 27 11:59:42 2009 -0400 @@ -1,11 +1,16 @@ -<tool id="cpgFilter" name="Mask CpG sites"> +<tool id="cpgFilter" name="Mask CpG/non-CpG sites" version="1.0.0"> <description> from MAF file</description> <command interpreter="python"> maf_cpg_filter.py - $input - $out_file1 - $definition - -m $mask_char + $input + $out_file1 + $masksite.type + #if $masksite.type == "CpG": + $masksite.definition + #else: + "NA" + #end if + -m $mask_char </command> <inputs> <page> @@ -17,10 +22,19 @@ <option value="3">*</option> <option value="4">?</option> </param> - <param name="definition" size="5" type="select" label="Definition"> - <option value="0" selected="true">Inclusive</option> - <option value="1">Restricted</option> - </param> + <conditional name="masksite"> + <param name="type" size="5" type="select" label="Sites to be masked"> + <option value="CpG" selected="true">CpG sites</option> + <option value="nonCpG">non-CpG sites</option> + </param> + <when value="CpG"> + <param name="definition" size="5" type="select" label="Definition"> + <option value="0" selected="true">Inclusive</option> + <option value="1">Restricted</option> + </param> + </when> + <when value="nonCpG" /> + </conditional> </page> </inputs> <outputs> @@ -33,8 +47,16 @@ <test> <param name="input" value="6.maf"/> <param name="mask_char" value="0"/> + <param name="type" value="CpG" /> <param name="definition" value="0" /> <output name="out_file1" file="6_mask_cpg.maf"/> + </test> + <test> + <param name="input" value="6.maf"/> + <param name="mask_char" value="0"/> + <param name="type" value="nonCpG" /> + <param name="definition" value="NA" /> + <output name="out_file1" file="6_mask_noncpg.maf"/> </test> </tests> <help>
participants (1)
-
Greg Von Kuster