Module: ParseFasta::CoreExt::String

Defined in:
lib/parse_fasta/core_ext/string.rb

Instance Method Summary collapse

Instance Method Details

#remove_gaps(gap_char = "-") ⇒ String

Removes all gap chars from the string.

Examples:

Remove all ‘-’ from string

# First inclued the methods
String.include ParseFasta::CoreExt::String

"--A-C-t-g".remove_gaps #=> "ACtg"

Change the gap character to ‘n’

# First inclued the methods
String.include ParseFasta::CoreExt::String

"-N-nACTG".remove_gaps "N" #=> "--nACTG"

Parameters:

  • gap_char (String) (defaults to: "-")

    the character to treat as a gap

Returns:

  • (String)

    a string with all instances of gap_char_removed



23
24
25
# File 'lib/parse_fasta/core_ext/string.rb', line 23

def remove_gaps gap_char="-"
  self.tr gap_char, ""
end