# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User jeremy goecks <jeremy.goecks@emory.edu> # Date 1277304197 14400 # Node ID 03eb69c6e92ea5472b7627bd9990327f7546a8a7 # Parent 45e1d5636fffd284ea6cda2f14318b364370e985 Improvements to GOPS subtract: (a) preserve metadata for interval inputs; (b) allow arbitrary mix of interval and GFF inputs; and (c) functional tests updated to test new functionality. --- a/tools/new_operations/gops_subtract.py +++ b/tools/new_operations/gops_subtract.py @@ -8,7 +8,8 @@ usage: %prog bed_file_1 bed_file_2 out_f -2, --cols2=N,N,N,N: Columns for start, end, strand in second file -m, --mincols=N: Require this much overlap (default 1bp) -p, --pieces: just print pieces of second set (after padding) - -G, --gff: inputs are GFF format, meaning start and end coordinates are 1-based, closed interval + -G, --gff1: input 1 is GFF format, meaning start and end coordinates are 1-based, closed interval + -H, --gff2: input 2 is GFF format, meaning start and end coordinates are 1-based, closed interval """ from galaxy import eggs import pkg_resources @@ -35,24 +36,29 @@ def main(): chr_col_2, start_col_2, end_col_2, strand_col_2 = parse_cols_arg( options.cols2 ) if options.mincols: mincols = int( options.mincols ) pieces = bool( options.pieces ) - gff_format = bool( options.gff ) + in1_gff_format = bool( options.gff1 ) + in2_gff_format = bool( options.gff2 ) in_fname, in2_fname, out_fname = args except: doc_optparse.exception() - # Set reader to handle either GFF or default format. - if gff_format: - reader_wrapper = GFFReaderWrapper + # Set readers to handle either GFF or default format. + if in1_gff_format: + in1_reader_wrapper = GFFReaderWrapper else: - reader_wrapper = NiceReaderWrapper + in1_reader_wrapper = NiceReaderWrapper + if in2_gff_format: + in2_reader_wrapper = GFFReaderWrapper + else: + in2_reader_wrapper = NiceReaderWrapper - g1 = reader_wrapper( fileinput.FileInput( in_fname ), + g1 = in1_reader_wrapper( fileinput.FileInput( in_fname ), chrom_col=chr_col_1, start_col=start_col_1, end_col=end_col_1, strand_col=strand_col_1, fix_strand=True ) - g2 = reader_wrapper( fileinput.FileInput( in2_fname ), + g2 = in2_reader_wrapper( fileinput.FileInput( in2_fname ), chrom_col=chr_col_2, start_col=start_col_2, end_col=end_col_2, @@ -64,7 +70,7 @@ def main(): try: for line in subtract( [g1,g2], pieces=pieces, mincols=mincols ): if type( line ) is GenomicInterval: - if gff_format: + if in1_gff_format: line = convert_to_gff_coordinates( line ) out_file.write( "%s\n" % "\t".join( line.fields ) ) else: --- a/tools/new_operations/operation_filter.py +++ b/tools/new_operations/operation_filter.py @@ -28,13 +28,17 @@ def validate_input( trans, error_map, pa # check meta data try: param = param_values[name] - startCol = int( param.metadata.startCol ) - endCol = int( param.metadata.endCol ) - chromCol = int( param.metadata.chromCol ) - if param.metadata.strandCol is not None: - strandCol = int ( param.metadata.strandCol ) - else: - strandCol = 0 + if isinstance( param.datatype, trans.app.datatypes_registry.get_datatype_by_extension( 'gff' ).__class__ ): + # TODO: currently cannot validate GFF inputs b/c they are not derived from interval. + pass + else: # Validate interval datatype. + startCol = int( param.metadata.startCol ) + endCol = int( param.metadata.endCol ) + chromCol = int( param.metadata.chromCol ) + if param.metadata.strandCol is not None: + strandCol = int ( param.metadata.strandCol ) + else: + strandCol = 0 except: error_msg = "The attributes of this dataset are not properly set. " + \ "Click the pencil icon in the history item to set the chrom, start, end and strand columns." --- /dev/null +++ b/test-data/gops_subtract_in2.bed @@ -0,0 +1,500 @@ +chr13 3633323 3651020 transcript 0 + +chr13 3633323 3633421 exon 0 + +chr13 3641310 3641498 exon 0 + +chr13 3642720 3642871 exon 0 + +chr13 3644161 3644296 exon 0 + +chr13 3648564 3648756 exon 0 + +chr13 3649425 3651020 exon 0 + +chr13 3802138 3803564 transcript 0 - +chr13 3802138 3803564 exon 0 - +chr13 3881808 3892824 transcript 0 - +chr13 3881808 3883719 exon 0 - +chr13 3884048 3884235 exon 0 - +chr13 3885293 3885464 exon 0 - +chr13 3885783 3886041 exon 0 - +chr13 3886616 3886693 exon 0 - +chr13 3886816 3886913 exon 0 - +chr13 3887223 3887286 exon 0 - +chr13 3887600 3887768 exon 0 - +chr13 3888116 3888224 exon 0 - +chr13 3892538 3892824 exon 0 - +chr13 4131872 4149877 transcript 0 - +chr13 4131872 4132082 exon 0 - +chr13 4134448 4134531 exon 0 - +chr13 4135847 4136013 exon 0 - +chr13 4136379 4136489 exon 0 - +chr13 4141372 4141495 exon 0 - +chr13 4142463 4142541 exon 0 - +chr13 4143535 4143652 exon 0 - +chr13 4144451 4144619 exon 0 - +chr13 4149760 4149877 exon 0 - +chr13 4232985 4247605 transcript 0 + +chr13 4232985 4233100 exon 0 + +chr13 4235334 4235502 exon 0 + +chr13 4236281 4236398 exon 0 + +chr13 4237639 4237717 exon 0 + +chr13 4238213 4238336 exon 0 + +chr13 4241797 4241907 exon 0 + +chr13 4242172 4242338 exon 0 + +chr13 4246048 4246131 exon 0 + +chr13 4247323 4247605 exon 0 + +chr13 4247980 4249023 transcript 0 + +chr13 4247980 4249023 exon 0 + +chr13 4591735 4608410 transcript 0 - +chr13 4591735 4592544 exon 0 - +chr13 4592807 4592890 exon 0 - +chr13 4594316 4594400 exon 0 - +chr13 4594905 4594978 exon 0 - +chr13 4596730 4596828 exon 0 - +chr13 4598015 4598138 exon 0 - +chr13 4600463 4600541 exon 0 - +chr13 4601926 4602043 exon 0 - +chr13 4606636 4606804 exon 0 - +chr13 4608330 4608410 exon 0 - +chr13 5860734 5869639 transcript 0 + +chr13 5860734 5861088 exon 0 + +chr13 5864013 5864590 exon 0 + +chr13 5865884 5866008 exon 0 + +chr13 5866477 5869639 exon 0 + +chr13 3537320 3565507 transcript 0 + +chr13 3537320 3537589 exon 0 + +chr13 3548108 3548216 exon 0 + +chr13 3550234 3550334 exon 0 + +chr13 3553657 3553792 exon 0 + +chr13 3555559 3555758 exon 0 + +chr13 3556171 3556303 exon 0 + +chr13 3559237 3559337 exon 0 + +chr13 3561111 3561283 exon 0 + +chr13 3563785 3563930 exon 0 + +chr13 3564104 3564159 exon 0 + +chr13 3564241 3565507 exon 0 + +chr13 3565280 3610354 transcript 0 - +chr13 3565280 3565913 exon 0 - +chr13 3566163 3566278 exon 0 - +chr13 3566681 3566863 exon 0 - +chr13 3567997 3568103 exon 0 - +chr13 3568733 3568887 exon 0 - +chr13 3569557 3569683 exon 0 - +chr13 3572732 3576446 exon 0 - +chr13 3580997 3581439 exon 0 - +chr13 3583745 3584619 exon 0 - +chr13 3587543 3587780 exon 0 - +chr13 3589186 3589894 exon 0 - +chr13 3593376 3593439 exon 0 - +chr13 3593538 3593611 exon 0 - +chr13 3594742 3594846 exon 0 - +chr13 3596022 3596123 exon 0 - +chr13 3598897 3598997 exon 0 - +chr13 3599082 3599102 exon 0 - +chr13 3599184 3599308 exon 0 - +chr13 3599437 3599580 exon 0 - +chr13 3610035 3610354 exon 0 - +chr13 8202154 8759554 transcript 0 + +chr13 8202154 8202566 exon 0 + +chr13 8558349 8558436 exon 0 + +chr13 8568912 8569820 exon 0 + +chr13 8671650 8671765 exon 0 + +chr13 8696865 8697034 exon 0 + +chr13 8700825 8700977 exon 0 + +chr13 8712845 8713014 exon 0 + +chr13 8731035 8731217 exon 0 + +chr13 8751818 8751997 exon 0 + +chr13 8756471 8759554 exon 0 + +chr13 8884851 8891641 transcript 0 + +chr13 8884851 8885242 exon 0 + +chr13 8885977 8886150 exon 0 + +chr13 8886730 8886823 exon 0 + +chr13 8887168 8887299 exon 0 + +chr13 8889563 8891641 exon 0 + +chr13 8802213 8870288 transcript 0 - +chr13 8802213 8805192 exon 0 - +chr13 8819108 8819223 exon 0 - +chr13 8819656 8819791 exon 0 - +chr13 8834542 8834684 exon 0 - +chr13 8836028 8836269 exon 0 - +chr13 8841975 8842052 exon 0 - +chr13 8844032 8844077 exon 0 - +chr13 8846860 8846932 exon 0 - +chr13 8848779 8848915 exon 0 - +chr13 8852915 8852980 exon 0 - +chr13 8853245 8853341 exon 0 - +chr13 8856077 8856174 exon 0 - +chr13 8860333 8860511 exon 0 - +chr13 8870115 8870288 exon 0 - +chr13 8849724 8870288 transcript 0 - +chr13 8849724 8852980 exon 0 - +chr13 8853245 8853341 exon 0 - +chr13 8856077 8856174 exon 0 - +chr13 8860333 8860511 exon 0 - +chr13 8870115 8870288 exon 0 - +chr13 8971723 8995258 transcript 0 - +chr13 8971723 8972520 exon 0 - +chr13 8973409 8973553 exon 0 - +chr13 8974190 8974256 exon 0 - +chr13 8976481 8976679 exon 0 - +chr13 8977773 8977874 exon 0 - +chr13 8978674 8978726 exon 0 - +chr13 8979147 8979225 exon 0 - +chr13 8984454 8984565 exon 0 - +chr13 8984883 8984973 exon 0 - +chr13 8986494 8986560 exon 0 - +chr13 8987001 8987193 exon 0 - +chr13 8988298 8988391 exon 0 - +chr13 8989943 8990044 exon 0 - +chr13 8990960 8991097 exon 0 - +chr13 8991177 8991281 exon 0 - +chr13 8991890 8992061 exon 0 - +chr13 8995194 8995258 exon 0 - +chr13 6547402 6579395 transcript 0 + +chr13 6547402 6547475 exon 0 + +chr13 6548825 6548928 exon 0 + +chr13 6551879 6551986 exon 0 + +chr13 6552427 6552579 exon 0 + +chr13 6554599 6554714 exon 0 + +chr13 6554797 6554894 exon 0 + +chr13 6555787 6555948 exon 0 + +chr13 6557007 6557134 exon 0 + +chr13 6557401 6557490 exon 0 + +chr13 6558600 6558729 exon 0 + +chr13 6559275 6559389 exon 0 + +chr13 6559847 6559944 exon 0 + +chr13 6561198 6561333 exon 0 + +chr13 6562621 6562760 exon 0 + +chr13 6564236 6564353 exon 0 + +chr13 6566595 6566728 exon 0 + +chr13 6567909 6568030 exon 0 + +chr13 6568144 6568221 exon 0 + +chr13 6568445 6568611 exon 0 + +chr13 6569847 6569948 exon 0 + +chr13 6572286 6572407 exon 0 + +chr13 6573605 6573677 exon 0 + +chr13 6574262 6574375 exon 0 + +chr13 6576635 6576761 exon 0 + +chr13 6577686 6577832 exon 0 + +chr13 6578663 6578766 exon 0 + +chr13 6578895 6579395 exon 0 + +chr13 6579119 6647970 transcript 0 - +chr13 6579119 6580838 exon 0 - +chr13 6581648 6581751 exon 0 - +chr13 6583846 6583946 exon 0 - +chr13 6585725 6585837 exon 0 - +chr13 6586297 6586359 exon 0 - +chr13 6587734 6587899 exon 0 - +chr13 6597104 6597257 exon 0 - +chr13 6597984 6598072 exon 0 - +chr13 6599841 6599912 exon 0 - +chr13 6601958 6602105 exon 0 - +chr13 6602324 6602394 exon 0 - +chr13 6602644 6602709 exon 0 - +chr13 6604201 6604327 exon 0 - +chr13 6604881 6604974 exon 0 - +chr13 6613949 6614045 exon 0 - +chr13 6618420 6618529 exon 0 - +chr13 6618765 6618810 exon 0 - +chr13 6620131 6620297 exon 0 - +chr13 6621152 6621342 exon 0 - +chr13 6624381 6624459 exon 0 - +chr13 6635170 6635244 exon 0 - +chr13 6647816 6647970 exon 0 - +chr13 9093150 9172336 transcript 0 + +chr13 9093150 9093426 exon 0 + +chr13 9121353 9121472 exon 0 + +chr13 9123148 9123208 exon 0 + +chr13 9136024 9136172 exon 0 + +chr13 9136400 9136547 exon 0 + +chr13 9142999 9143078 exon 0 + +chr13 9144627 9144764 exon 0 + +chr13 9146646 9146750 exon 0 + +chr13 9149071 9149182 exon 0 + +chr13 9150110 9150164 exon 0 + +chr13 9150260 9150470 exon 0 + +chr13 9157368 9157475 exon 0 + +chr13 9157796 9158048 exon 0 + +chr13 9163920 9163966 exon 0 + +chr13 9165562 9165727 exon 0 + +chr13 9167923 9168048 exon 0 + +chr13 9168143 9168252 exon 0 + +chr13 9169897 9172336 exon 0 + +chr13 9275771 9668171 transcript 0 + +chr13 9275771 9276312 exon 0 + +chr13 9492350 9492422 exon 0 + +chr13 9505824 9505935 exon 0 + +chr13 9532497 9532623 exon 0 + +chr13 9535901 9536111 exon 0 + +chr13 9549429 9549564 exon 0 + +chr13 9550991 9551111 exon 0 + +chr13 9552519 9552717 exon 0 + +chr13 9559916 9560008 exon 0 + +chr13 9562359 9562470 exon 0 + +chr13 9567076 9567200 exon 0 + +chr13 9567546 9567656 exon 0 + +chr13 9567836 9567939 exon 0 + +chr13 9570295 9570360 exon 0 + +chr13 9574379 9574473 exon 0 + +chr13 9574607 9574727 exon 0 + +chr13 9576049 9576164 exon 0 + +chr13 9583250 9583267 exon 0 + +chr13 9591989 9592004 exon 0 + +chr13 9600631 9600742 exon 0 + +chr13 9603734 9603871 exon 0 + +chr13 9605568 9605777 exon 0 + +chr13 9608189 9608304 exon 0 + +chr13 9609942 9610144 exon 0 + +chr13 9613592 9613702 exon 0 + +chr13 9614990 9615071 exon 0 + +chr13 9621124 9621248 exon 0 + +chr13 9621827 9621949 exon 0 + +chr13 9623002 9623114 exon 0 + +chr13 9623203 9623313 exon 0 + +chr13 9627218 9627349 exon 0 + +chr13 9633967 9634136 exon 0 + +chr13 9636340 9636511 exon 0 + +chr13 9646224 9646286 exon 0 + +chr13 9653848 9653906 exon 0 + +chr13 9655882 9655957 exon 0 + +chr13 9658490 9658665 exon 0 + +chr13 9661382 9661506 exon 0 + +chr13 9665023 9668171 exon 0 + +chr13 9684081 9764454 transcript 0 - +chr13 9684081 9686230 exon 0 - +chr13 9688308 9688494 exon 0 - +chr13 9688697 9688970 exon 0 - +chr13 9689691 9689760 exon 0 - +chr13 9690148 9690356 exon 0 - +chr13 9692675 9692794 exon 0 - +chr13 9693514 9693592 exon 0 - +chr13 9694374 9694430 exon 0 - +chr13 9694984 9695072 exon 0 - +chr13 9696889 9696982 exon 0 - +chr13 9697873 9697951 exon 0 - +chr13 9720018 9720178 exon 0 - +chr13 9734577 9734712 exon 0 - +chr13 9764300 9764454 exon 0 - +chr13 9875858 10360049 transcript 0 - +chr13 9875858 9878263 exon 0 - +chr13 10027698 10027745 exon 0 - +chr13 10121472 10121535 exon 0 - +chr13 10223890 10224003 exon 0 - +chr13 10359509 10360049 exon 0 - +chr13 11645369 12199212 transcript 0 - +chr13 11645369 11646878 exon 0 - +chr13 11647697 11647749 exon 0 - +chr13 11648864 11648965 exon 0 - +chr13 11650313 11650378 exon 0 - +chr13 11652790 11652947 exon 0 - +chr13 11659114 11659249 exon 0 - +chr13 11660738 11660885 exon 0 - +chr13 11664512 11664573 exon 0 - +chr13 11670046 11670180 exon 0 - +chr13 11676402 11676445 exon 0 - +chr13 11677674 11677805 exon 0 - +chr13 11679482 11679704 exon 0 - +chr13 11680408 11680495 exon 0 - +chr13 11683491 11683639 exon 0 - +chr13 11685359 11685424 exon 0 - +chr13 11686948 11688246 exon 0 - +chr13 11689337 11689419 exon 0 - +chr13 11690772 11690877 exon 0 - +chr13 11694025 11694154 exon 0 - +chr13 11695951 11696040 exon 0 - +chr13 11697422 11697503 exon 0 - +chr13 11710873 11710947 exon 0 - +chr13 11711736 11711813 exon 0 - +chr13 11713581 11713661 exon 0 - +chr13 11715168 11715268 exon 0 - +chr13 11727791 11727845 exon 0 - +chr13 11730698 11730750 exon 0 - +chr13 11732540 11732644 exon 0 - +chr13 11736070 11736167 exon 0 - +chr13 11738759 11738872 exon 0 - +chr13 11739968 11740004 exon 0 - +chr13 11741996 11742131 exon 0 - +chr13 11746632 11746692 exon 0 - +chr13 11747884 11748055 exon 0 - +chr13 11749299 11749392 exon 0 - +chr13 11751216 11751304 exon 0 - +chr13 11752367 11752608 exon 0 - +chr13 11754332 11754653 exon 0 - +chr13 11758147 11758278 exon 0 - +chr13 11759345 11759427 exon 0 - +chr13 11761079 11761318 exon 0 - +chr13 11762195 11762256 exon 0 - +chr13 11768464 11768514 exon 0 - +chr13 11773232 11773354 exon 0 - +chr13 11776728 11776793 exon 0 - +chr13 11779209 11779325 exon 0 - +chr13 11780156 11780280 exon 0 - +chr13 11782558 11782634 exon 0 - +chr13 11784905 11784983 exon 0 - +chr13 11792514 11792652 exon 0 - +chr13 11793045 11793135 exon 0 - +chr13 11795763 11795842 exon 0 - +chr13 11797901 11798065 exon 0 - +chr13 11798848 11798989 exon 0 - +chr13 11800048 11800139 exon 0 - +chr13 11800288 11800509 exon 0 - +chr13 11802183 11802353 exon 0 - +chr13 11804401 11804522 exon 0 - +chr13 11806783 11806889 exon 0 - +chr13 11809207 11809394 exon 0 - +chr13 11810636 11810772 exon 0 - +chr13 11814017 11814121 exon 0 - +chr13 11814997 11815130 exon 0 - +chr13 11816529 11816644 exon 0 - +chr13 11819123 11819397 exon 0 - +chr13 11822609 11822753 exon 0 - +chr13 11823912 11824018 exon 0 - +chr13 11827737 11827938 exon 0 - +chr13 11829988 11830787 exon 0 - +chr13 11834120 11834347 exon 0 - +chr13 11837444 11837531 exon 0 - +chr13 11837863 11838026 exon 0 - +chr13 11839754 11839915 exon 0 - +chr13 11841702 11841817 exon 0 - +chr13 11842955 11843308 exon 0 - +chr13 11844462 11844671 exon 0 - +chr13 11851937 11852112 exon 0 - +chr13 11853493 11853702 exon 0 - +chr13 11862118 11862266 exon 0 - +chr13 11864686 11864846 exon 0 - +chr13 11871451 11871535 exon 0 - +chr13 11877304 11877408 exon 0 - +chr13 11882525 11882630 exon 0 - +chr13 11884935 11885152 exon 0 - +chr13 11886808 11887001 exon 0 - +chr13 11891948 11892190 exon 0 - +chr13 11893404 11893538 exon 0 - +chr13 11894073 11894192 exon 0 - +chr13 11903149 11903245 exon 0 - +chr13 11916540 11916676 exon 0 - +chr13 11919800 11919984 exon 0 - +chr13 11921823 11921945 exon 0 - +chr13 11926190 11926355 exon 0 - +chr13 11943324 11943481 exon 0 - +chr13 11945382 11945457 exon 0 - +chr13 11960383 11960480 exon 0 - +chr13 11961383 11961483 exon 0 - +chr13 11971741 11971854 exon 0 - +chr13 11975311 11975390 exon 0 - +chr13 11977730 11977805 exon 0 - +chr13 11983100 11983115 exon 0 - +chr13 11995484 11995505 exon 0 - +chr13 12010577 12010682 exon 0 - +chr13 12038149 12038269 exon 0 - +chr13 12198665 12199212 exon 0 - +chr13 12279085 12350267 transcript 0 - +chr13 12279085 12279358 exon 0 - +chr13 12280307 12280420 exon 0 - +chr13 12281613 12281806 exon 0 - +chr13 12282470 12282671 exon 0 - +chr13 12285880 12286077 exon 0 - +chr13 12287504 12287660 exon 0 - +chr13 12290179 12290255 exon 0 - +chr13 12291312 12291411 exon 0 - +chr13 12292463 12292545 exon 0 - +chr13 12297009 12297130 exon 0 - +chr13 12297556 12297624 exon 0 - +chr13 12304654 12304755 exon 0 - +chr13 12304937 12305045 exon 0 - +chr13 12307679 12307832 exon 0 - +chr13 12309076 12309166 exon 0 - +chr13 12313688 12313829 exon 0 - +chr13 12314421 12314538 exon 0 - +chr13 12317728 12317908 exon 0 - +chr13 12319950 12320136 exon 0 - +chr13 12323211 12323352 exon 0 - +chr13 12325168 12325281 exon 0 - +chr13 12327723 12327803 exon 0 - +chr13 12330247 12330315 exon 0 - +chr13 12331915 12331977 exon 0 - +chr13 12333831 12333932 exon 0 - +chr13 12336201 12336296 exon 0 - +chr13 12336821 12336884 exon 0 - +chr13 12339585 12339692 exon 0 - +chr13 12340159 12340252 exon 0 - +chr13 12342111 12342181 exon 0 - +chr13 12342868 12342958 exon 0 - +chr13 12346030 12346245 exon 0 - +chr13 12350128 12350267 exon 0 - +chr13 12361693 12432999 transcript 0 - +chr13 12361693 12361919 exon 0 - +chr13 12363044 12363203 exon 0 - +chr13 12364965 12365031 exon 0 - +chr13 12367344 12367491 exon 0 - +chr13 12368629 12368809 exon 0 - +chr13 12369665 12369800 exon 0 - +chr13 12371060 12371243 exon 0 - +chr13 12372695 12372836 exon 0 - +chr13 12374781 12374890 exon 0 - +chr13 12380773 12380924 exon 0 - +chr13 12382940 12383088 exon 0 - +chr13 12383926 12384157 exon 0 - +chr13 12386576 12386669 exon 0 - +chr13 12388741 12388827 exon 0 - +chr13 12393201 12393283 exon 0 - +chr13 12396580 12396659 exon 0 - +chr13 12398540 12398628 exon 0 - +chr13 12401166 12401253 exon 0 - +chr13 12401861 12401981 exon 0 - +chr13 12403113 12403228 exon 0 - +chr13 12432641 12432999 exon 0 - +chr13 12487641 12531160 transcript 0 + +chr13 12487641 12487737 exon 0 + +chr13 12488006 12488180 exon 0 + +chr13 12488688 12488905 exon 0 + +chr13 12491169 12491311 exon 0 + +chr13 12493316 12493418 exon 0 + +chr13 12493716 12493857 exon 0 + +chr13 12494980 12495192 exon 0 + +chr13 12495411 12495545 exon 0 + +chr13 12497154 12497257 exon 0 + +chr13 12498289 12498400 exon 0 + +chr13 12498791 12498909 exon 0 + +chr13 12499783 12499891 exon 0 + +chr13 12500920 12501016 exon 0 + +chr13 12501475 12501564 exon 0 + +chr13 12502662 12502874 exon 0 + +chr13 12503486 12503608 exon 0 + +chr13 12504311 12504503 exon 0 + +chr13 12505491 12505675 exon 0 + +chr13 12505778 12505915 exon 0 + +chr13 12506639 12506832 exon 0 + +chr13 12507683 12507853 exon 0 + +chr13 12508217 12508376 exon 0 + +chr13 12509726 12509969 exon 0 + +chr13 12510364 12510496 exon 0 + +chr13 12513308 12513412 exon 0 + +chr13 12513544 12513688 exon 0 + +chr13 12514307 12514426 exon 0 + +chr13 12514507 12514629 exon 0 + +chr13 12515900 12516029 exon 0 + +chr13 12516886 12517117 exon 0 + +chr13 12518420 12518547 exon 0 + +chr13 12519028 12519189 exon 0 + +chr13 12522033 12522080 exon 0 + +chr13 12522407 12522531 exon 0 + +chr13 12523177 12523318 exon 0 + +chr13 12523946 12524239 exon 0 + +chr13 12524895 12525046 exon 0 + +chr13 12525878 12526037 exon 0 + +chr13 12526183 12526318 exon 0 + +chr13 12526453 12526558 exon 0 + +chr13 12526640 12526809 exon 0 + +chr13 12527313 12527468 exon 0 + +chr13 12527936 12528095 exon 0 + +chr13 12530100 12530209 exon 0 + +chr13 12530855 12531160 exon 0 + +chr13 12531685 12553757 transcript 0 - +chr13 12531685 12533261 exon 0 - +chr13 12539413 12539579 exon 0 - +chr13 12540685 12540774 exon 0 - +chr13 12543667 12543694 exon 0 - +chr13 12544988 12545045 exon 0 - +chr13 12545551 12545671 exon 0 - +chr13 12547001 12547212 exon 0 - +chr13 12548610 12548699 exon 0 - +chr13 12551440 12551583 exon 0 - +chr13 12553693 12553757 exon 0 - +chr13 12569174 12612715 transcript 0 - +chr13 12569174 12570841 exon 0 - +chr13 12575866 12575912 exon 0 - --- a/tools/new_operations/subtract.xml +++ b/tools/new_operations/subtract.xml @@ -1,46 +1,33 @@ <tool id="gops_subtract_1" name="Subtract"><description>the intervals of two queries</description><command interpreter="python">gops_subtract.py - #if $inputs.type == "Interval": - $inputs.interval_input1 $inputs.interval_input2 $output - -1 ${inputs.interval_input1.metadata.chromCol},${inputs.interval_input1.metadata.startCol},${inputs.interval_input1.metadata.endCol},${inputs.interval_input1.metadata.strandCol} - -2 ${inputs.interval_input2.metadata.chromCol},${inputs.interval_input2.metadata.startCol},${inputs.interval_input2.metadata.endCol},${inputs.interval_input2.metadata.strandCol} - #else - $inputs.gff_input1 $inputs.gff_input2 $output - ## TODO: can we use metadata like above to set these columns rather than hardcode them? - -1 1,4,5,7 - -2 1,4,5,7 - --gff + $input1 $input2 $output + + ##if $input1.ext in ['gff','gtf','gff3']: + #if isinstance( $input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gff').__class__): + -1 1,4,5,7 --gff1 + #else: + -1 ${input1.metadata.chromCol},${input1.metadata.startCol},${input1.metadata.endCol},${input1.metadata.strandCol} #end if + + #if isinstance( $input2.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gff').__class__): + -2 1,4,5,7 --gff2 + #else: + -2 ${input2.metadata.chromCol},${input2.metadata.startCol},${input2.metadata.endCol},${input2.metadata.strandCol} + #end if + -m $min $returntype </command><inputs> - <conditional name="inputs"> - <param name="type" type="select" label="File Format to Use"> - <option value="Interval">Interval</option> - <option value="GFF">GFF</option> - </param> - <when value="Interval"> - <param format="interval" name="interval_input2" type="data" help="Second query"> - <label>Subtract</label> - </param> - - <param format="interval" name="interval_input1" type="data" help="First query"> - <label>from</label> - </param> - </when> - <when value="GFF"> - <param format="gff" name="gff_input2" type="data" help="Second query"> - <label>Subtract</label> - </param> - - <param format="gff" name="gff_input1" type="data" help="First query"> - <label>from</label> - </param> - </when> - </conditional> + <param format="interval,gff" name="input2" type="data" help="Second query"> + <label>Subtract</label> + </param> -<param name="returntype" type="select" label="Return" help="of the first query (see figure below)"> + <param format="interval,gff" name="input1" type="data" help="First query"> + <label>from</label> + </param> + + <param name="returntype" type="select" label="Return" help="of the first query (see figure below)"><option value="">Intervals with no overlap</option><option value="-p">Non-overlapping pieces of intervals</option></param> @@ -48,59 +35,57 @@ <param name="min" size="4" type="integer" value="1" help="(bp)"><label>where minimal overlap is</label></param> - </inputs><outputs> - <data format="input" name="output"> - #if inputs.type == "Interval": - metadata_source="inputs.interval_input1" - #else: - metadata_source="inputs.gff_input1" - #end if - </data> + <data format="input" name="output" metadata_source="input1"/></outputs><code file="operation_filter.py"/><tests><test> - <param name="type" value="Interval"/> - <param name="interval_input1" value="1.bed" /> - <param name="interval_input2" value="2.bed" /> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /><param name="min" value="1" /><param name="returntype" value="" /><output name="output" file="gops-subtract.dat" /></test><test> - <param name="type" value="Interval"/> - <param name="interval_input1" value="1.bed" /> - <param name="interval_input2" value="2_mod.bed" ftype="interval"/> + <param name="input1" value="1.bed" /> + <param name="input2" value="2_mod.bed" ftype="interval"/><param name="min" value="1" /><param name="returntype" value="" /><output name="output" file="gops_subtract_diffCols.dat" /></test><test> - <param name="type" value="Interval"/> - <param name="interval_input1" value="gops_subtract_bigint.bed" /> - <param name="interval_input2" value="2.bed" /> + <param name="input1" value="gops_subtract_bigint.bed" /> + <param name="input2" value="2.bed" /><param name="min" value="1" /><param name="returntype" value="" /><output name="output" file="gops-subtract.dat" /></test><test> - <param name="type" value="Interval"/> - <param name="interval_input1" value="1.bed" /> - <param name="interval_input2" value="2.bed" /> + <param name="input1" value="1.bed" /> + <param name="input2" value="2.bed" /><param name="min" value="10" /><param name="returntype" value="Non-overlapping pieces of intervals" /><output name="output" file="gops-subtract-p.dat" /></test> + <!-- Subtract two GFF files. --><test> - <param name="type" value="GFF"/> - <param name="gff_input1" value="gops_subtract_in1.gff" /> - <param name="gff_input2" value="gops_subtract_in2.gff" /> + <param name="input1" value="gops_subtract_in1.gff" /> + <param name="input2" value="gops_subtract_in2.gff" /><param name="min" value="1" /><param name="returntype" value="" /> - <output name="output" file="gops_subtract_out1.gff" /> + <output name="output" file="gops_subtract_out1.gff" /></test> + <!-- Subtract BED file from GFF file. --> + <test> + <param name="input1" value="gops_subtract_in1.gff" /> + <param name="input2" value="gops_subtract_in2.bed" /> + <param name="min" value="1" /> + <param name="returntype" value="" /> + <output name="output" file="gops_subtract_out1.gff" /> + </test> + </tests><help>