Mercurial > repos > mheinzl > variant_analyzer2
comparison read2mut.py @ 90:24f166c1dba7 draft default tip
planemo upload for repository https://github.com/Single-Molecule-Genetics/VariantAnalyzerGalaxy/tree/master/tools/variant_analyzer commit ee4a8e6cf290e6c8a4d55f9cd2839d60ab3b11c8-dirty
| author | mheinzl | 
|---|---|
| date | Wed, 26 Apr 2023 18:55:52 +0000 | 
| parents | 1a5974404d4f | 
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 89:1a5974404d4f | 90:24f166c1dba7 | 
|---|---|
| 22 | 22 | 
| 23 from __future__ import division | 23 from __future__ import division | 
| 24 | 24 | 
| 25 import argparse | 25 import argparse | 
| 26 import csv | 26 import csv | 
| 27 import itertools | |
| 28 import json | 27 import json | 
| 29 import operator | 28 import operator | 
| 30 import os | 29 import os | 
| 31 import re | 30 import re | 
| 32 import sys | 31 import sys | 
| 1293 half1_mate1 = array1_half2 | 1292 half1_mate1 = array1_half2 | 
| 1294 half2_mate1 = array1_half | 1293 half2_mate1 = array1_half | 
| 1295 half1_mate2 = array2_half2 | 1294 half1_mate2 = array2_half2 | 
| 1296 half2_mate2 = array2_half | 1295 half2_mate2 = array2_half | 
| 1297 # calculate HD of "a" in the tag to all "a's" or "b" in the tag to all "b's" | 1296 # calculate HD of "a" in the tag to all "a's" or "b" in the tag to all "b's" | 
| 1298 dist = np.array([sum(itertools.map(operator.ne, half1_mate1, c)) for c in half1_mate2]) | 1297 dist = np.array([sum(map(operator.ne, half1_mate1, c)) for c in half1_mate2]) | 
| 1299 min_index = np.where(dist == dist.min()) # get index of min HD | 1298 min_index = np.where(dist == dist.min()) # get index of min HD | 
| 1300 # get all "b's" of the tag or all "a's" of the tag with minimum HD | 1299 # get all "b's" of the tag or all "a's" of the tag with minimum HD | 
| 1301 min_tag_half2 = half2_mate2[min_index] | 1300 min_tag_half2 = half2_mate2[min_index] | 
| 1302 min_tag_array2 = array2[min_index] # get whole tag with min HD | 1301 min_tag_array2 = array2[min_index] # get whole tag with min HD | 
| 1303 min_value = dist.min() | 1302 min_value = dist.min() | 
| 1304 # calculate HD of "b" to all "b's" or "a" to all "a's" | 1303 # calculate HD of "b" to all "b's" or "a" to all "a's" | 
| 1305 dist_second_half = np.array([sum(itertools.map(operator.ne, half2_mate1, e)) | 1304 dist_second_half = np.array([sum(map(operator.ne, half2_mate1, e)) | 
| 1306 for e in min_tag_half2]) | 1305 for e in min_tag_half2]) | 
| 1307 dist2 = dist_second_half.max() | 1306 dist2 = dist_second_half.max() | 
| 1308 max_index = np.where(dist_second_half == dist_second_half.max())[0] # get index of max HD | 1307 max_index = np.where(dist_second_half == dist_second_half.max())[0] # get index of max HD | 
| 1309 max_tag = min_tag_array2[max_index] | 1308 max_tag = min_tag_array2[max_index] | 
| 1310 # tags which have identical parts: | 1309 # tags which have identical parts: | 
