|
a |
|
b/man/split_fasta.Rd |
|
|
1 |
% Generated by roxygen2: do not edit by hand |
|
|
2 |
% Please edit documentation in R/preprocess.R |
|
|
3 |
\name{split_fasta} |
|
|
4 |
\alias{split_fasta} |
|
|
5 |
\title{Split fasta file into smaller files.} |
|
|
6 |
\usage{ |
|
|
7 |
split_fasta( |
|
|
8 |
path_input, |
|
|
9 |
target_folder, |
|
|
10 |
split_n = 500, |
|
|
11 |
shuffle_entries = TRUE, |
|
|
12 |
delete_input = FALSE |
|
|
13 |
) |
|
|
14 |
} |
|
|
15 |
\arguments{ |
|
|
16 |
\item{path_input}{Fasta file to split into smaller files} |
|
|
17 |
|
|
|
18 |
\item{target_folder}{Directory for output.} |
|
|
19 |
|
|
|
20 |
\item{split_n}{Maximum number of entries to use in smaller file.} |
|
|
21 |
|
|
|
22 |
\item{shuffle_entries}{Whether to shuffle fasta entries before split.} |
|
|
23 |
|
|
|
24 |
\item{delete_input}{Whether to delete the original file.} |
|
|
25 |
} |
|
|
26 |
\value{ |
|
|
27 |
None. Writes files to output. |
|
|
28 |
} |
|
|
29 |
\description{ |
|
|
30 |
Returns smaller files with same file name and "_x" (where x is an integer). For example, |
|
|
31 |
assume we have input file called "abc.fasta" with 100 entries and \code{split_n = 50}. Function will |
|
|
32 |
create two files called "abc_1.fasta" and "abc_2.fasta" in \code{target_path}. |
|
|
33 |
} |
|
|
34 |
\examples{ |
|
|
35 |
path_input <- tempfile(fileext = '.fasta') |
|
|
36 |
create_dummy_data(file_path = path_input, |
|
|
37 |
num_files = 1, |
|
|
38 |
write_to_file_path = TRUE, |
|
|
39 |
seq_length = 7, |
|
|
40 |
num_seq = 25, |
|
|
41 |
vocabulary = c("a", "c", "g", "t")) |
|
|
42 |
target_folder <- tempfile() |
|
|
43 |
dir.create(target_folder) |
|
|
44 |
|
|
|
45 |
# split 25 entries into 5 files |
|
|
46 |
split_fasta(path_input = path_input, |
|
|
47 |
target_folder = target_folder, |
|
|
48 |
split_n = 5) |
|
|
49 |
length(list.files(target_folder)) |
|
|
50 |
|
|
|
51 |
} |