from __future__ import print_function, absolute_import, division
import screed
import docopt

CLI = """
USAGE:
    fasplit <fasta> <prefix>
"""

opts = docopt.docopt(CLI)
prefix = opts['<prefix>']

with screed.open(opts['<fasta>']) as fh:
    for record in fh:
        fname = "{}{}.fasta".format(prefix, record.name)
        with open(fname, 'w') as ofh:
            print(">", record.name, sep='', file=ofh)
            print(record.sequence, file=ofh)


from __future__ import print_function, absolute_import, division
import screed
import docopt

CLI = """
USAGE:
    fasplit <fasta> <prefix>
"""

opts = docopt.docopt(CLI)
prefix = opts['<prefix>']

with screed.open(opts['<fasta>']) as fh:
    for record in fh:
        fname = "{}{}.fasta".format(prefix, record.name)
        with open(fname, 'w') as ofh:
            print(">", record.name, sep='', file=ofh)
            print(str(record.sequence).translate(None, '-'), file=ofh)


Remove gaps from individual genomes
Remove gaps from individual genomes

  from __future__ import print_function, absolute_import, division
  import screed
  import docopt
  
  CLI = """
  USAGE:
      fasplit <fasta> <prefix>
  """
  
  opts = docopt.docopt(CLI)
  prefix = opts['<prefix>']
  
  with screed.open(opts['<fasta>']) as fh:
      for record in fh:
          fname = "{}{}.fasta".format(prefix, record.name)
          with open(fname, 'w') as ofh:
              print(">", record.name, sep='', file=ofh)
-             print(record.sequence, file=ofh)
+             print(str(record.sequence).translate(None, '-'), file=ofh)
  
  
Remove gaps from individual genomes
## Code Before:
from __future__ import print_function, absolute_import, division
import screed
import docopt

CLI = """
USAGE:
    fasplit <fasta> <prefix>
"""

opts = docopt.docopt(CLI)
prefix = opts['<prefix>']

with screed.open(opts['<fasta>']) as fh:
    for record in fh:
        fname = "{}{}.fasta".format(prefix, record.name)
        with open(fname, 'w') as ofh:
            print(">", record.name, sep='', file=ofh)
            print(record.sequence, file=ofh)


## Instruction:
Remove gaps from individual genomes
## Code After:
from __future__ import print_function, absolute_import, division
import screed
import docopt

CLI = """
USAGE:
    fasplit <fasta> <prefix>
"""

opts = docopt.docopt(CLI)
prefix = opts['<prefix>']

with screed.open(opts['<fasta>']) as fh:
    for record in fh:
        fname = "{}{}.fasta".format(prefix, record.name)
        with open(fname, 'w') as ofh:
            print(">", record.name, sep='', file=ofh)
            print(str(record.sequence).translate(None, '-'), file=ofh)

