Skip to content

Commit

Permalink
fix_name
Browse files Browse the repository at this point in the history
  • Loading branch information
campanam authored Dec 13, 2019
1 parent 342e765 commit 4533b52
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions vcf2aln.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#-----------------------------------------------------------------------------------------------
# vcf2aln
VCF2ALNVER = "0.11.0"
VCF2ALNVER = "0.11.1"
# Michael G. Campana, Jacob A. West-Roberts, 2017-2019
# Smithsonian Conservation Biology Institute
#-----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -271,6 +271,13 @@ def self.parse(options)
end
end
#-----------------------------------------------------------------------------------------------
def fix_name(name) # Modified from BaitsTools 1.6.5 (Campana 2019) resolve_unix_path
for reschar in ["\\", ";", "&", "(", ")","*","?","[","]","~",">","<","!","\"","\'", "$", " ", "|"]
name.gsub!(reschar, "_") # Use odd syntax because escape character causes issues with backslash in sub
end
return name
end
#-----------------------------------------------------------------------------------------------
def quality_filter(line_arr, gt_index, pgt_index)
site_qual = line_arr[5]
filter = line_arr[6]
Expand Down Expand Up @@ -528,7 +535,7 @@ def vcf_to_alignment(line, index, previous_index, previous_endex, previous_name,
end
regionval += 1
write_cycle += 1
$options.concat ? name = "concat_aln" : name = line_arr[0]
$options.concat ? name = "concat_aln" : name = fix_name(line_arr[0])
name << "_region" + region.to_s if $options.split_regions > 0
if name != current_locus.name
current_locus.print_locus unless current_locus.name == ""
Expand Down

0 comments on commit 4533b52

Please sign in to comment.