@@ -51,7 +51,6 @@ function sort_genotype_array(genotype_array)
51
51
data= genotype_array[:,3 : size (genotype_array,2 )]
52
52
chrom_positions = [parse (Int, i) for i in genotype_array[:,1 : 2 ]]
53
53
genotype_array = hcat (chrom_positions,data)
54
-
55
54
genotype_array = sortrows (genotype_array, by= x-> (x[1 ],x[2 ]))
56
55
57
56
return genotype_array
@@ -111,38 +110,37 @@ end
111
110
io_sig_list_vcf_filter(sig_list,vcf_filename)
112
111
returns subarray of variant records matching a list of variant positions returned from load_siglist()
113
112
"""
114
- function io_sig_list_vcf_filter (sig_list,vcf_filename)
115
-
116
- vcf_subarray = Array {Any} (0 )
113
+ function io_sig_list_vcf_filter (sig_list,vcf_filename)
117
114
118
- for row= 1 : size (sig_list,1 )
119
- dimension = size (sig_list,1 )
115
+ reader = VCF. Reader (open (vcf_filename, " r" ))
120
116
121
- chr= (sig_list[row,1 ])
122
- pos= (sig_list[row,2 ])
117
+ vcf_subarray = Array {Any} (0 )
123
118
124
- reader = VCF . Reader ( open (vcf_filename, " r " ))
119
+ for record in reader
125
120
126
- for record in reader
121
+ for row= 1 : size (sig_list,1 )
122
+ dimension = size (sig_list,1 )
127
123
128
- if typeof (VCF . chrom (record)) == String
129
- chr = string (chr )
124
+ chr = (sig_list[row, 1 ])
125
+ pos = (sig_list[row, 2 ] )
130
126
131
- if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos)
132
- push! (vcf_subarray,record)
133
- end
127
+ if typeof (VCF. chrom (record)) == String
128
+ chr = string (chr)
129
+ if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos)
130
+ push! (vcf_subarray,record)
131
+ end
134
132
135
- else
133
+ else
136
134
137
- if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos)
138
- push! (vcf_subarray,record)
135
+ if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos)
136
+ push! (vcf_subarray,record)
139
137
140
- end
141
- end
138
+ end
142
139
end
143
- end
140
+ end
141
+ end
144
142
145
- return vcf_subarray
143
+ return vcf_subarray
146
144
end
147
145
148
146
"""
@@ -183,16 +181,16 @@ function pass_chrrange_siglist_filter(vcf_filename,sig_list,chr_range::AbstractS
183
181
184
182
vcf_subarray = Array {Any} (0 )
185
183
186
- for row= 1 : size (sig_list,1 )
184
+ reader = VCF. Reader (open (vcf_filename, " r" ))
185
+
186
+ for record in reader
187
+
188
+ for row = 1 : size (sig_list,1 )
187
189
dimension = size (sig_list,1 )
188
190
189
191
chr= (sig_list[row,1 ])
190
192
pos= (sig_list[row,2 ])
191
193
192
- reader = VCF. Reader (open (vcf_filename, " r" ))
193
-
194
- for record in reader
195
-
196
194
if typeof (VCF. chrom (record)) == String
197
195
chr = string (chr)
198
196
@@ -255,23 +253,23 @@ returns subarray of vcf records with io_pass_filter and io_chromosome_range_vcf_
255
253
end
256
254
257
255
"""
258
- pass_siglist_filter(vcf_filename,sig_list,chr_range::AbstractString)
259
- returns subarray of vcf records with io_pass_filter, io_sig_list_vcf_filter, and io_chromosome_range_vcf_filter applied.
256
+ pass_siglist_filter(vcf_filename,sig_list,chr_range::AbstractString)
257
+ returns subarray of vcf records with io_pass_filter, io_sig_list_vcf_filter, and io_chromosome_range_vcf_filter applied.
260
258
"""
261
- function pass_siglist_filter (vcf_filename,sig_list)
259
+ function pass_siglist_filter (vcf_filename,sig_list)
262
260
263
- vcf_subarray = Array {Any} (0 )
261
+ vcf_subarray = Array {Any} (0 )
262
+
263
+ reader = VCF. Reader (open (vcf_filename, " r" ))
264
+
265
+ for record in reader
264
266
265
267
for row= 1 : size (sig_list,1 )
266
268
dimension = size (sig_list,1 )
267
269
268
270
chr= (sig_list[row,1 ])
269
271
pos= (sig_list[row,2 ])
270
272
271
- reader = VCF. Reader (open (vcf_filename, " r" ))
272
-
273
- for record in reader
274
-
275
273
if typeof (VCF. chrom (record)) == String
276
274
chr = string (chr)
277
275
@@ -283,64 +281,63 @@ returns subarray of vcf records with io_pass_filter and io_chromosome_range_vcf_
283
281
284
282
if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos) && (VCF. hasfilter (record)) && (VCF. filter (record) == String[" PASS" ])
285
283
push! (vcf_subarray,record)
286
-
287
284
end
288
285
end
289
- end
290
286
end
287
+ end
291
288
292
- return vcf_subarray
293
- end
289
+ return vcf_subarray
290
+ end
294
291
295
292
"""
296
293
chrrange_siglist_filter(vcf_filename,sig_list,chr_range::AbstractString)
297
294
returns subarray of vcf records with io_pass_filter, io_sig_list_vcf_filter, and io_chromosome_range_vcf_filter applied.
298
295
"""
299
- function chrrange_siglist_filter (vcf_filename,sig_list,chr_range:: AbstractString )
296
+ function chrrange_siglist_filter (vcf_filename,sig_list,chr_range:: AbstractString )
300
297
301
- a= split (chr_range," :" )
302
- chrwhole= a[1 ]
303
- chrnumber= split (chrwhole," r" )
304
- string_chr= chrnumber[2 ]
305
- chr= String (string_chr)
306
- range= a[2 ]
307
- splitrange= split (range, " -" )
308
- lower_limit= splitrange[1 ]
309
- chr_range_low= parse (lower_limit)
310
- upper_limit= splitrange[2 ]
311
- chr_range_high= parse (upper_limit)
298
+ a= split (chr_range," :" )
299
+ chrwhole= a[1 ]
300
+ chrnumber= split (chrwhole," r" )
301
+ string_chr= chrnumber[2 ]
302
+ chr= String (string_chr)
303
+ range= a[2 ]
304
+ splitrange= split (range, " -" )
305
+ lower_limit= splitrange[1 ]
306
+ chr_range_low= parse (lower_limit)
307
+ upper_limit= splitrange[2 ]
308
+ chr_range_high= parse (upper_limit)
312
309
313
- vcf_subarray = Array {Any} (0 )
310
+ vcf_subarray = Array {Any} (0 )
314
311
315
- for row= 1 : size (sig_list,1 )
316
- dimension = size (sig_list,1 )
312
+ reader = VCF. Reader (open (vcf_filename, " r" ))
317
313
318
- chr= (sig_list[row,1 ])
319
- pos= (sig_list[row,2 ])
314
+ for record in reader
320
315
321
- reader = VCF. Reader (open (vcf_filename, " r" ))
316
+ for row= 1 : size (sig_list,1 )
317
+ dimension = size (sig_list,1 )
322
318
323
- for record in reader
319
+ chr= (sig_list[row,1 ])
320
+ pos= (sig_list[row,2 ])
324
321
325
- if typeof (VCF. chrom (record)) == String
326
- chr = string (chr)
322
+ if typeof (VCF. chrom (record)) == String
323
+ chr = string (chr)
327
324
328
- if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos) && ((VCF. chrom (record) == chr)) && ((chr_range_high > VCF. pos (record) > chr_range_low))
329
- push! (vcf_subarray,record)
330
- end
325
+ if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos) && ((VCF. chrom (record) == chr)) && ((chr_range_high > VCF. pos (record) > chr_range_low))
326
+ push! (vcf_subarray,record)
327
+ end
331
328
332
- else
329
+ else
333
330
334
- if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos) && ((VCF. chrom (record) == chr)) && ((chr_range_high > VCF. pos (record) > chr_range_low))
335
- push! (vcf_subarray,record)
331
+ if (VCF. chrom (record) == chr) && (VCF. pos (record) == pos) && ((VCF. chrom (record) == chr)) && ((chr_range_high > VCF. pos (record) > chr_range_low))
332
+ push! (vcf_subarray,record)
336
333
337
- end
338
- end
339
- end
334
+ end
335
+ end
340
336
end
337
+ end
341
338
342
- return vcf_subarray
343
- end
339
+ return vcf_subarray
340
+ end
344
341
345
342
# functions for converting vcf record array to numerical array
346
343
@@ -367,9 +364,7 @@ convert sub from variant filters to gt_num_array and gt_chromosome_labels for pl
367
364
"""
368
365
function combined_all_genotype_array_functions (sub)
369
366
genotype_array = generate_genotype_array (sub," GT" )
370
-
371
367
map! (s-> replace (s, " chr" , " " ), genotype_array, genotype_array)
372
-
373
368
clean_column1! (genotype_array)
374
369
genotype_array= ViVa. sort_genotype_array (genotype_array)
375
370
geno_dict = define_geno_dict ()
@@ -508,7 +503,7 @@ function get_sample_names(reader)
508
503
end
509
504
510
505
"""
511
- find_group_label_indices(pheno)
506
+ find_group_label_indices(pheno,trait_to_group_by,row_to_sort_by )
512
507
find indices and determines names for group 1 and group 2 labels on plots. finds index of center of each sample group to place tick mark and label.
513
508
"""
514
509
function find_group_label_indices (pheno,trait_to_group_by,row_to_sort_by)
0 commit comments