Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
migale
affiliationExplorer
Commits
099fcd4b
Commit
099fcd4b
authored
Jan 17, 2020
by
mahendra-mariadassou
Browse files
Update create_test_data to use only package functions
parent
d66c9e1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
data-raw/create_test_data.R
View file @
099fcd4b
## code to prepare `test_data` dataset goes here
library
(
dplyr
)
library
(
phyloseq
)
physeq
<-
phyloseq.extended
::
import_frogs
(
"data-raw/biom_16S_1M.biom"
)
affi
<-
readr
::
read_tsv
(
"data-raw/multihits_16S_1M.tsv"
)
source
(
"R/utils.R"
)
physeq
<-
read_frogs_biom
(
"data-raw/biom_16S_1M.biom"
)
affi
<-
read_multihits
(
"data-raw/multihits_16S_1M.tsv"
)
## Sanitize taxa names (change long sequences to short ones)
asv_dictionary
<-
tibble
(
sequence
=
taxa_names
(
physeq
),
abundance
=
taxa_sums
(
physeq
))
%>%
arrange
(
desc
(
abundance
))
%>%
mutate
(
ASV
=
paste0
(
"ASV"
,
1
:
n
()))
affi
<-
inner_join
(
asv_dictionary
,
affi
,
by
=
c
(
"sequence"
=
"#observation_name"
))
%>%
tidyr
::
separate
(
blast_taxonomy
,
into
=
rank_names
(
physeq
),
sep
=
";"
)
sequence_to_asv
<-
asv_dictionary
%>%
select
(
-
abundance
)
%>%
tibble
::
deframe
()
taxa_names
(
physeq
)
<-
sequence_to_asv
[
taxa_names
(
physeq
)]
%>%
unname
()
cleaned_data
<-
sanitize_physeq_and_affi
(
physeq
,
affi
)
physeq
<-
cleaned_data
$
physeq
affi
<-
cleaned_data
$
affi
otu_dictionary
<-
cleaned_data
$
otu_dictionary
## Save example biom and example multihit table
usethis
::
use_data
(
physeq
)
usethis
::
use_data
(
affi
)
## Prioritize orphan taxa
usethis
::
use_data
(
"test_data"
)
usethis
::
use_data
(
physeq
,
overwrite
=
TRUE
)
usethis
::
use_data
(
affi
,
overwrite
=
TRUE
)
usethis
::
use_data
(
otu_dictionary
,
overwrite
=
TRUE
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment