Mercurial > repos > guerler > springsuite
comparison spring_roc.py @ 31:3071750405c9 draft
"planemo upload commit b306c715d8284c097220bc5c8461399fdc05eac7-dirty"
| author | guerler | 
|---|---|
| date | Tue, 24 Nov 2020 17:12:07 +0000 | 
| parents | b0e195a47df7 | 
| children | b300ddbbf9d0 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 30:b0e195a47df7 | 31:3071750405c9 | 
|---|---|
| 208 prediction, _ = getReference(args.input, scoreCol=2) | 208 prediction, _ = getReference(args.input, scoreCol=2) | 
| 209 | 209 | 
| 210 # get subcellular locations from UniProt export | 210 # get subcellular locations from UniProt export | 
| 211 locations = dict() | 211 locations = dict() | 
| 212 if isfile(args.locations): | 212 if isfile(args.locations): | 
| 213 regions = list() | |
| 214 if args.regions: | |
| 215 regions = args.regions.split(",") | |
| 213 with open(args.locations) as locFile: | 216 with open(args.locations) as locFile: | 
| 214 for line in locFile: | 217 for line in locFile: | 
| 215 searchKey = "SUBCELLULAR LOCATION" | 218 searchKey = "SUBCELLULAR LOCATION" | 
| 216 searchPos = line.find(searchKey) | 219 searchPos = line.find(searchKey) | 
| 217 if searchPos != -1: | 220 if searchPos != -1: | 
| 218 uniId = line.split()[0] | 221 uniId = line.split()[0] | 
| 219 locStart = searchPos + len(searchKey) + 1 | 222 locStart = searchPos + len(searchKey) + 1 | 
| 220 locId = line[locStart:].split()[0] | 223 locId = line[locStart:].split()[0] | 
| 221 if locId in ["Nucleus", "Membrane", "Cytoplasm"]: | 224 if regions: | 
| 222 if uniId in filterA and uniId in filterB: | 225 if locId not in regions: | 
| 223 locations[uniId] = locId | 226 continue | 
| 227 if uniId in filterA or uniId in filterB: | |
| 228 locations[uniId] = locId | |
| 224 print("Found %d subcellular locations." % (len(list(locations.keys())))) | 229 print("Found %d subcellular locations." % (len(list(locations.keys())))) | 
| 225 | 230 | 
| 226 # estimate background noise | 231 # estimate background noise | 
| 227 print("Estimating background noise...") | 232 print("Estimating background noise...") | 
| 228 negative = set() | 233 negative = set() | 
| 267 if __name__ == "__main__": | 272 if __name__ == "__main__": | 
| 268 parser = argparse.ArgumentParser(description='Create ROC plot.') | 273 parser = argparse.ArgumentParser(description='Create ROC plot.') | 
| 269 parser.add_argument('-i', '--input', help='Input prediction file.', required=True) | 274 parser.add_argument('-i', '--input', help='Input prediction file.', required=True) | 
| 270 parser.add_argument('-b', '--biogrid', help='BioGRID interaction database file', required=True) | 275 parser.add_argument('-b', '--biogrid', help='BioGRID interaction database file', required=True) | 
| 271 parser.add_argument('-l', '--locations', help='UniProt export table with subcellular locations', required=False) | 276 parser.add_argument('-l', '--locations', help='UniProt export table with subcellular locations', required=False) | 
| 277 parser.add_argument('-r', '--regions', help='Comma-separated regions', required=False) | |
| 272 parser.add_argument('-e', '--experiment', help='Type (physical/genetic)', default="", required=False) | 278 parser.add_argument('-e', '--experiment', help='Type (physical/genetic)', default="", required=False) | 
| 273 parser.add_argument('-t', '--throughput', help='Throughput (low/high)', default="", required=False) | 279 parser.add_argument('-t', '--throughput', help='Throughput (low/high)', default="", required=False) | 
| 274 parser.add_argument('-m', '--method', help='Method e.g. Two-hybrid', default="", required=False) | 280 parser.add_argument('-m', '--method', help='Method e.g. Two-hybrid', default="", required=False) | 
| 275 parser.add_argument('-o', '--output', help='Output (png)', required=True) | 281 parser.add_argument('-o', '--output', help='Output (png)', required=True) | 
| 276 args = parser.parse_args() | 282 args = parser.parse_args() | 
