Skip to content

Commit 47bfd2e

Browse files
committed
updated comments
1 parent d317926 commit 47bfd2e

File tree

2 files changed

+8
-33
lines changed

2 files changed

+8
-33
lines changed

createObject.py

Whitespace-only changes.

main.py

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
group = parser.add_mutually_exclusive_group()
3636
# group.add_argument("-v", "--verbose", action="store_true", help="increase output verbosity")
3737
group.add_argument("-q", "--quiet", action="store_true", help="prevent output in command line")
38-
# parser.add_argument("-l", "--log", action="store_true", help="store the output in a log file")
39-
# parser.add_argument("-n", "--number", type=int, help="just a Test number")
4038
parser.add_argument("-m", "--manual", action="store_true", help="display the manual for this program")
4139
parser.add_argument("-i", "--input_file", help="comma separated table with SNP's")
4240
parser.add_argument("-d", "--detail", action="store_true", help="write detailed output file")
@@ -152,11 +150,6 @@
152150
l_count = 0
153151
snps = []
154152
for variant_line in variant_lines:
155-
# remove /n form end of line
156-
# variant_line = variant_line.strip()
157-
# remove " from lines
158-
# variant_line[0] = variant_line[0].translate(None, '"')
159-
# variant_line[-1] = variant_line[-1].translate(None, '"')
160153
if len(variant_line) >= 16:
161154
success_count += 1
162155
context = variant_line[5].split(",")
@@ -180,6 +173,7 @@
180173
print "created patient SNP objects with " + str(len(snps)) + " unique SNPs\n"
181174
csvfile.close()
182175

176+
# sanity check ###
183177
if fail_count > success_count:
184178
print "INPUT ERROR! wrong separator selected"
185179
sys.exit(0)
@@ -192,20 +186,17 @@
192186
# only clinically relevant quality
193187
if snp.get_qual() <= 95:
194188
del snps[i]
195-
196189
# if mutation does not change the amino acid, it does not affect the cell (in most cases)
197190
if "synonymous_variant" in snp.get_consequences():
198191
del snps[i]
199192
i += 1
200193
print "past filter SNP count: " + str(len(snps))
201194

202-
# write tab delimited file for annovar #
195+
# write tab delimited file for annovar ###
203196
tab_mutations = open('amplicon_variants_tab.csv', 'w')
204197
for snp in snps:
205198
# check if type is deletion, correction of the data for annovar
206199
if "Deletion" in snp.get_type():
207-
# print snp.get_ref()
208-
# print mutation.get_alt()
209200
newEnd = snp.get_pos() + (len(snp.get_ref()) - 2)
210201
snp.set_alt("-")
211202
if len(snp.get_ref()) > 2:
@@ -216,18 +207,13 @@
216207
except IndexError:
217208
snp.set_ref(snp.get_ref()[0])
218209
snp.set_new_end(newEnd)
219-
# print mutation.get_pos()
220-
# print newEnd
221-
# print mutation.get_ref()
222-
# print snp.get_alt()
223210
tab_mutations.write(snp.export())
224211
tab_mutations.close()
225212
if not args.quiet:
226213
print "created tab delimited file for annovar"
227214

228215
# WORKS JUST UNDER UBUNTU OR THE UBUNTU BASH FOR WINDOWS #
229-
# get annovar databases if needed ###
230-
216+
# download databases if needed ###
231217
annotate_variation = "./perl/annotate_variation.pl "
232218
databases = ["-buildver " + buildversion + " -downdb -webfrom annovar refGene " + buildversion,
233219
"-buildver " + buildversion + " -downdb cytoBand " + buildversion,
@@ -286,7 +272,6 @@
286272
print "annotating the SNPs"
287273
annovar_pl = "./perl/table_annovar.pl "
288274
dir_path = os.path.dirname(os.path.realpath(__file__))
289-
# print dir_path
290275

291276
if args.fast:
292277
params = "amplicon_variants_tab.csv " + buildversion + " -buildver " + buildversion + " -out myanno -remove -protocol " \
@@ -364,7 +349,7 @@
364349
# if score != ".":
365350
# rel_score = float(data._AnnovarParser__SIFT_score) / data._AnnovarParser__SIFT_max
366351
# print rel_score
367-
###### some work to do here ####
352+
###### some work to do here some day####
368353
# sys.exit(0)
369354

370355
# create Objects containing all human proteins ###
@@ -390,7 +375,6 @@
390375
end = position[1]
391376
geneDesc = variant_line[3].split(",")
392377
chromosome = "chr" + str(variant_line[4])
393-
# print chromosome
394378
allHumanProteins.append(AllProt(prot, geneSyn, ensembl, geneDesc, chromosome, int(start),
395379
int(end), variant_line[6], variant_line[7:-1]))
396380
allProtFile.close()
@@ -432,7 +416,7 @@
432416
snp.get_refDepth(), snp.get_altDepth(),
433417
snp.get_strandBias(), ".", ".", ".", ".", ".", ".", "."
434418
))
435-
419+
# this part is for getting the corresponding AA Seq.
436420
# find DNA sequence for gene in each region and translate it ###
437421
# mutation_with_sequence = {}
438422
# for c_muta in coding_mutations:
@@ -467,6 +451,7 @@
467451

468452
# ensemble API for GRCh37 hg19 ###
469453
# ensembl_rest.run(species="human", symbol="DOPEY2")
454+
# yes not jet finished
470455

471456

472457
# write in export table ###
@@ -559,10 +544,6 @@
559544
annotation._AnnovarParser__phastCons20way_mammalian[0],
560545
annotation._AnnovarParser__SiPhy_29way_logOdds[0]
561546
))
562-
# snp.get_geneChromosome(),
563-
# snp.get_gene(), snp.get_geneSyn(), snp.get_geneDesc(),
564-
# snp.get_proteinClass(), snp.get_geneStart(), snp.get_geneEnd()
565-
# ))
566547
else:
567548
export_string = str("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t"
568549
"".format(snp.get_id(), snp.get_chr(), snp.get_pos(),
@@ -643,7 +624,6 @@
643624
button("Invert colors".title(), id="invert_button")
644625

645626
with table(id="resultTable", border='1'):
646-
# line = tr()
647627
thead = thead()
648628
tbody = tbody()
649629
# write header first
@@ -722,6 +702,7 @@
722702
annotation._AnnovarParser__phastCons20way_mammalian,
723703
annotation._AnnovarParser__SiPhy_29way_logOdds
724704
]:
705+
# generate HTML table color gradient ###
725706
if type(value) is tuple and not value[0] == ".": # (value, min, max, threshold)
726707
if len(value) == 3: # has no threshold
727708
range = float(value[2]) - float(value[1]) # max - min
@@ -778,11 +759,6 @@
778759
blue = 20
779760
colorstring = str(int(red)) + ", " + str(int(green)) + ", " + str(blue)
780761
row += td(value[0], style='background-color: rgb(' + colorstring + ")")
781-
# if value == annotation._AnnovarParser__DANN_score:
782-
# print str(value[2]) +", "+ str(value[3])
783-
# print value[0]
784-
# print range
785-
# print percentage
786762

787763
elif type(value) is tuple and value[0] == ".":
788764
row += td(value[0])
@@ -817,8 +793,8 @@
817793
else:
818794
row += td(value)
819795

820-
export_string = ""
821796
# check for final prediction ###
797+
export_string = ""
822798
if annotation._AnnovarParser__MetaLR_pred == "T":
823799
export_string += "Tolerated"
824800
elif annotation._AnnovarParser__MetaLR_pred == "D":
@@ -864,7 +840,6 @@
864840
export_cnt += 1
865841

866842
target_html.write(doc.render())
867-
# print(doc.render())
868843
target_html.close()
869844

870845
print "FINISHED"

0 commit comments

Comments
 (0)