Skip to content

Commit

Permalink
Site skip fix
Browse files Browse the repository at this point in the history
  • Loading branch information
campanam committed May 17, 2023
1 parent 7d8bfa0 commit 47b1e0b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Michael G. Campana & Jacob A. West-Roberts, 2017-2023
Smithsonian's National Zoo and Conservation Biology Institute
Contact: [email protected]

### Version 0.13.1
Fixed bug in reference-inclusion if missing sites are not skipped

### Version 0.13.0
Added option to output reference sequence as part of the alignment

Expand Down
14 changes: 11 additions & 3 deletions vcf2aln.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#-----------------------------------------------------------------------------------------------
# vcf2aln
VCF2ALNVER = "0.13.0"
VCF2ALNVER = "0.13.1"
# Michael G. Campana, Jacob A. West-Roberts, 2017-2023
# Smithsonian's National Zoo and Conservation Biology Institute
#-----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -619,11 +619,15 @@ def vcf_to_alignment(line, index, previous_index, previous_endex, previous_name,
end
current_base = line_arr[1].to_i # Set starting base position
if current_base > previous_endex
for i in 0...$samples.size
unless $options.skip # Adjust for missing bases
unless $options.skip # Adjust for missing bases
for i in 0...$samples.size
current_locus.seqs[i] << "?" * (current_base - 1 - previous_endex)
current_locus.alts[i] << "?" * (current_base - 1 - previous_endex)
end
if $options.includeref
current_locus.seqs[-1] << "?" * (current_base - 1 - previous_endex)
current_locus.alts[-1] << "?" * (current_base - 1 - previous_endex)
end
end
if write_cycle >= $options.write_cycle
current_locus.write_seqs
Expand All @@ -637,6 +641,10 @@ def vcf_to_alignment(line, index, previous_index, previous_endex, previous_name,
current_locus.seqs[i] << "?" * lengths.max * (current_base - previous_endex) if current_base > previous_endex
current_locus.alts[i] << "?" * lengths.max * (current_base - previous_endex) if current_base > previous_endex
end
if $options.includeref
current_locus.seqs[-1] << "?" * lengths.max * (current_base - previous_endex) if current_base > previous_endex
current_locus.alts[-1] << "?" * lengths.max * (current_base - previous_endex) if current_base > previous_endex
end
index += current_base - previous_index
endex = index + lengths.max - 1 # Sequence end index
unless $options.hap_flag #Accounting for ploidy
Expand Down

0 comments on commit 47b1e0b

Please sign in to comment.