diff SMART/Java/Python/CompareOverlappingSmallRef.py @ 46:169d364ddd91

Uploaded
author m-zytnicki
date Mon, 30 Sep 2013 03:19:26 -0400
parents 44d5973c188c
children 2ac71607aa60
line wrap: on
line diff
--- a/SMART/Java/Python/CompareOverlappingSmallRef.py	Wed Sep 18 08:51:22 2013 -0400
+++ b/SMART/Java/Python/CompareOverlappingSmallRef.py	Mon Sep 30 03:19:26 2013 -0400
@@ -72,11 +72,8 @@
 		self.antisense      = False
 		self.collinear      = False
 		self.distance       = None
-		self.minOverlap     = False
 		self.pcOverlapQuery = False
 		self.pcOverlapRef   = False
-		self.included       = False
-		self.including      = False
 		self.bins	        = {}
 		self.notOverlapping = False
 
@@ -109,10 +106,6 @@
 		self.pcOverlapQuery = pcOverlapQuery
 		self.pcOverlapRef   = pcOverlapRef
 
-	def setInclude(self, included, including):
-		self.included  = included
-		self.including = including
-
 	def includeNotOverlapping(self, boolean):
 		self.notOverlapping = boolean
 
@@ -146,18 +139,12 @@
 			return False
 		if self.antisense and queryTranscript.getDirection() == refTranscript.getDirection():
 			return False
-		if self.included and not queryTranscript.isIncluded(refTranscript):
-			return False
-		if self.including and not refTranscript.isIncluded(queryTranscript):
-			return False
 		querySize = queryTranscript.getSize()
 		if self.pcOverlapQuery and not queryTranscript.overlapWithExon(refTranscript, int(querySize * self.pcOverlapQuery / 100.0)):
 			return False
 		refSize = refTranscript.getSize()
 		if self.pcOverlapRef and not queryTranscript.overlapWithExon(refTranscript, int(refSize * self.pcOverlapRef / 100.0)):
 			return False
-		if self.minOverlap and not queryTranscript.overlapWithExon(refTranscript, self.minOverlap):
-			return False
 		return True
 
 	def _compareTranscript(self, queryTranscript):
@@ -180,9 +167,11 @@
 		return overlaps
 
 	def _updateTranscript(self, queryTranscript, overlaps):
-		queryTranscript.setTagValue("nbOverlaps", sum(overlaps.values()))
 		if overlaps:
+			queryTranscript.setTagValue("nbOverlaps", sum(overlaps.values()))
 			queryTranscript.setTagValue("overlapsWith", "--".join(overlaps.keys())[:100])
+		else:
+			queryTranscript.setTagValue("nbOverlaps", "0")
 		return queryTranscript
 
 	def compare(self):
@@ -222,17 +211,14 @@
 	parser.add_option("-j", "--input2",	        dest="inputFileName2", action="store",			           type="string", help="reference input file [compulsory] [format: file in transcript format given by -g]")
 	parser.add_option("-g", "--format2",        dest="format2",		  action="store",			           type="string", help="format of previous file [compulsory] [format: transcript file format]")
 	parser.add_option("-o", "--output",	        dest="outputFileName", action="store",			           type="string", help="output file [format: output file in GFF3 format]")
-	parser.add_option("-O", "--notOverlapping", dest="notOverlapping", action="store_true", default=False,				  help="also output not overlapping data [format: bool] [default: false]")
-	parser.add_option("-d", "--distance",		dest="distance",	   action="store",	    default=0,	   type="int",	  help="accept some distance between query and reference [format: int]")
-	parser.add_option("-c", "--collinear",		dest="collinear",	   action="store_true", default=False,			 	  help="provide collinear features [format: bool] [default: false]")
-	parser.add_option("-a", "--antisense",		dest="antisense",	   action="store_true", default=False,			 	  help="provide antisense features [format: bool] [default: false]")
-	parser.add_option("-m", "--minOverlap",	    dest="minOverlap",     action="store",      default=False, type="int",	  help="min. #nt overlap [format: bool] [default: false]")
-	parser.add_option("-p", "--pcOverlapQuery",	dest="pcOverlapQuery", action="store",      default=False, type="int",	  help="min. % overlap of the query [format: bool] [default: false]")
-	parser.add_option("-P", "--pcOverlapRef",	dest="pcOverlapRef",   action="store",      default=False, type="int",    help="min. % overlap of the reference [format: bool] [default: false]")
-	parser.add_option("-k", "--included",		dest="included",	   action="store_true", default=False,			 	  help="provide query elements which are nested in reference elements [format: bool] [default: false]")
-	parser.add_option("-K", "--including",		dest="including",	   action="store_true", default=False,			 	  help="provide query elements in which reference elements are nested [format: bool] [default: false]")
-	parser.add_option("-x", "--exclude",		dest="exclude",		   action="store_true", default=False,			 	  help="invert the match [format: bool] [default: false]")
-	parser.add_option("-v", "--verbosity",      dest="verbosity",	   action="store",      default=1,     type="int",	  help="trace level [format: int]")
+	parser.add_option("-O", "--notOverlapping", dest="notOverlapping", action="store_true", default=False,				 help="also output not overlapping data [format: bool] [default: false]")
+	parser.add_option("-d", "--distance",		dest="distance",	   action="store",	    default=0,	   type="int",	 help="accept some distance between query and reference [format: int]")
+	parser.add_option("-c", "--collinear",		dest="collinear",	   action="store_true", default=False,			 	 help="provide collinear features [format: bool] [default: false]")
+	parser.add_option("-a", "--antisense",		dest="antisense",	   action="store_true", default=False,			 	 help="provide antisense features [format: bool] [default: false]")
+	parser.add_option("-p", "--pcOverlapQuery",	dest="pcOverlapQuery", action="store",      default=False, type="int",	 help="min. % overlap of the query [format: bool] [default: false]")
+	parser.add_option("-P", "--pcOverlapRef",	dest="pcOverlapRef",   action="store",      default=False, type="int",   help="min. % overlap of the reference [format: bool] [default: false]")
+	parser.add_option("-x", "--exclude",		dest="exclude",		   action="store_true", default=False,			 	 help="invert the match [format: bool] [default: false]")
+	parser.add_option("-v", "--verbosity",      dest="verbosity",	   action="store",      default=1,     type="int",	 help="trace level [format: int]")
 	(options, args) = parser.parse_args()
 
 	cosr = CompareOverlappingSmallRef(options.verbosity)
@@ -242,9 +228,7 @@
 	cosr.includeNotOverlapping(options.notOverlapping)
 	cosr.setDistance(options.distance)
 	cosr.setAntisense(options.antisense)
-	cosr.setInclude(options.included, options.including)
 	cosr.setInvert(options.exclude)
-	cosr.setMinOverlap(options.minOverlap)
 	cosr.setMinPercentOverlap(options.pcOverlapQuery, options.pcOverlapRef)
 	cosr.run()