Write genbank map that highlights overlaps.

        :param path: full path to .gb file to write.
        :type path: str
975020
def write_map(self, path):
        '''

        '''
        starts = [index[0] for index in self.overlap_indices]
        features = []
        for i, start in enumerate(starts):
            stop = start + len(self.overlaps[i])
            name = 'overlap {}'.format(i + 1)
            feature_type = 'misc'
            strand = 0
            features.append(coral.Feature(name, start, stop, feature_type,
                                          strand=strand))
        seq_map = coral.DNA(self.template, features=features)
        coral.seqio.write_dna(seq_map, path)
968844
public void writeToFile(Path path) {
        try {
            try (OutputStream os = Files.newOutputStream(path)) {
                InputStreams.transferTo(body(), os);
            }
        } catch (IOException e) {
            throw new RequestsException(e);
        } finally {
            close();
        }
    }
419072
private static String formatPathToFile(Path path) {
    return StringUtils.removeEnd(path.toString(), Path.SEPARATOR);
  }
49529
def write_dna(dna, path):
    '''

    '''
    # Check if path filetype is valid, remember for later
    ext = os.path.splitext(path)[1]
    if ext == '.gb' or ext == '.ape':
        filetype = 'genbank'
    elif ext == '.fa' or ext == '.fasta':
        filetype = 'fasta'
    else:
        raise ValueError('Only genbank or fasta files are supported.')

    # Convert features to Biopython form
    # Information lost on conversion:
    #     specificity of feature type
    #     strandedness
    #     topology
    features = []
    for feature in dna.features:
        features.append(_coral_to_seqfeature(feature))
    # Biopython doesn't like 'None' here
    # FIXME: this is a legacy feature - remove?
    bio_id = dna.id if hasattr(dna, 'id') else ''
    # Maximum length of name is 16
    seq = SeqRecord(Seq(str(dna), alphabet=ambiguous_dna), id=bio_id,
                    name=dna.name[0:16].replace(' ', '_'), features=features,
                    description=dna.name)
    if dna.circular:
        seq.annotations['data_file_division'] = 'circular'
    else:
        seq.annotations['data_file_division'] = 'linear'

    if filetype == 'genbank':
        SeqIO.write(seq, path, 'genbank')
    elif filetype == 'fasta':
        SeqIO.write(seq, path, 'fasta')
1357519
def dump(self, path):
        
        try:
            with open(path, "wb") as f:
                f.write(self.__str__().encode("utf-8"))
        except:
            pass

        with open(path, "wb") as f:
            pickle.dump(self.__data__, f)
1172292
def writeCsv(self, path):
    
    self._createConfluence()
    with open(path, "w") as outputFile:
      writer = csv.writer(outputFile)
      headers = self.getStreamIds()
      fieldNames = ["timestamp"] + headers
      flags = ["T"] + ["" for h in headers]
      types = ["datetime"] + self._confluence.getDataTypes()
      writer.writerow(fieldNames)
      writer.writerow(types)
      writer.writerow(flags)
      for row in self._confluence:
        writer.writerow(row)
    print "Wrote CSV data to %s." % path
353261
def write(u, path):
    
    print("writing to: %s" % path)
    # This function implementation was chosen to be compatible across Python 2/3.
    f = open(path, "wb")
    try:
        b = u.encode(FILE_ENCODING)
        f.write(b)
    finally:
        f.close()
63943
def _output_path(self, input_path, to_format, archive=False):
        
        indirpath, fname = os.path.split(os.path.abspath(os.path.normpath(input_path)))

        commonprefix = os.path.commonprefix([os.path.abspath(self.file_generator.from_path),
                                             os.path.abspath(indirpath)])

        commonparts = commonprefix.split(os.sep)
        inparts = indirpath.split(os.sep)
        outparts = inparts[len(commonparts):]

        if archive:
            outdirpath = os.path.join(*outparts) if outparts else ""
        else:
            outdirpath = os.path.join(self.file_generator.to_path, *outparts)

        return os.path.join(outdirpath, fname + self.file_generator.file_extension[to_format])
947005
def make_file(path, contents='', overwrite=False):
    
    if overwrite or not os.path.exists(path):
        with open(path, 'w') as fh:
            fh.write(contents)
        return True

    return False
583854
def write_to_file(self, file_path: str) -> None:
        
        data = self.encode()
        with open(file_path, "w") as f:
            json.dump(data, f, indent=1)
1071330
def generate_output_file(path):
        

        def write_file(content):
            """
            Function to do write_file operation
            :param content:
            :return:
            """
            with open(path, 'w+') as output:
                output.write(content)

        return write_file
919018
def write(path, data, binary=False):
    
    mode = "w"
    if binary:
        mode = "wb"
    with open(path, mode) as f:
        f.write(data)
    f.close()
1064462
def write_tsv(self, path):
        
        with open(path, 'wb') as ofh:
            writer = csv.writer(
                ofh, dialect='excel-tab',
                quoting=csv.QUOTE_NONE, lineterminator=os.linesep
            )
            for gs in self._gene_sets.values():
                writer.writerow(gs.to_list())
262990
def save(self, path):
        
        with open(path, 'w') as f:
            f.write(self.contents())
396963
def writer(path):
    
    filename, extension = extract_extension(path)
    if extension in FILE_WRITERS:
        writer_func = FILE_WRITERS[extension]
        return writer_func(path)
    else:
        raise RuntimeError("Output compression {0} not supported.  Type {1}"
                           .format(extension, tuple(FILE_WRITERS.keys())))
962417
def _remove_overlaps(in_file, out_dir, data):
    
    out_file = os.path.join(out_dir, "%s-nooverlaps%s" % utils.splitext_plus(os.path.basename(in_file)))
    if not utils.file_uptodate(out_file, in_file):
        with file_transaction(data, out_file) as tx_out_file:
            with open(in_file) as in_handle:
                with open(tx_out_file, "w") as out_handle:
                    prev_line = None
                    for line in in_handle:
                        if prev_line:
                            pchrom, pstart, pend = prev_line.split("\t", 4)[:3]
                            cchrom, cstart, cend = line.split("\t", 4)[:3]
                            # Skip if chromosomes match and end overlaps start
                            if pchrom == cchrom and int(pend) > int(cstart):
                                pass
                            else:
                                out_handle.write(prev_line)
                        prev_line = line
                    out_handle.write(prev_line)
    return out_file
1362993
def write(self, path):
        """"""
        with open(path, 'wb') as f:
            f.write(self.getXML())