Mercurial > repos > iuc > variant_analyzer
comparison mut2read.py @ 1:3556001ff2db draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/variant_analyzer commit 60dc8db809909edf44d662683b1f392b9d5964bf"
author | iuc |
---|---|
date | Wed, 04 Dec 2019 16:21:17 -0500 |
parents | 8d29173d49a9 |
children | 3f1dbd2c59bf |
comparison
equal
deleted
inserted
replaced
0:8d29173d49a9 | 1:3556001ff2db |
---|---|
61 if os.path.isfile(file3) is False: | 61 if os.path.isfile(file3) is False: |
62 sys.exit("Error: Could not find '{}'".format(file3)) | 62 sys.exit("Error: Could not find '{}'".format(file3)) |
63 | 63 |
64 # read mut file | 64 # read mut file |
65 with open(file1, 'r') as mut: | 65 with open(file1, 'r') as mut: |
66 mut_array = np.genfromtxt(mut, skip_header=1, delimiter='\t', comments='#', dtype='string') | 66 mut_array = np.genfromtxt(mut, skip_header=1, delimiter='\t', comments='#', dtype=str) |
67 | 67 |
68 # read dcs bam file | 68 # read dcs bam file |
69 # pysam.index(file2) | 69 # pysam.index(file2) |
70 bam = pysam.AlignmentFile(file2, "rb") | 70 bam = pysam.AlignmentFile(file2, "rb") |
71 | 71 |
84 ref = mut_array[m, 9] | 84 ref = mut_array[m, 9] |
85 alt = mut_array[m, 10] | 85 alt = mut_array[m, 10] |
86 | 86 |
87 dcs_len = [] | 87 dcs_len = [] |
88 | 88 |
89 for pileupcolumn in bam.pileup(chrom.tobytes(), stop_pos - 2, stop_pos, max_depth=100000000): | 89 for pileupcolumn in bam.pileup(chrom, stop_pos - 2, stop_pos, max_depth=100000000): |
90 | 90 |
91 if pileupcolumn.reference_pos == stop_pos - 1: | 91 if pileupcolumn.reference_pos == stop_pos - 1: |
92 count_alt = 0 | 92 count_alt = 0 |
93 count_ref = 0 | 93 count_ref = 0 |
94 count_indel = 0 | 94 count_indel = 0 |