Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
migale
affiliationExplorer
Commits
3467d94d
Commit
3467d94d
authored
Mar 09, 2021
by
mahendra-mariadassou
Browse files
Correct handling of long names in fasta files
parent
8cb0e985
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/utils.R
View file @
3467d94d
...
...
@@ -15,7 +15,9 @@ read_fasta <- function(fasta_file) {
Biostrings
::
readDNAStringSet
(
fasta_file
)
%>%
as.character
()
%>%
tibble
::
tibble
(
OTU
=
names
(
.
),
sequence
=
unname
(
.
))
sequence
=
unname
(
.
))
%>%
dplyr
::
select
(
OTU
,
sequence
)
%>%
dplyr
::
mutate
(
OTU
=
OTU
%>%
strsplit
(
split
=
" "
,
fixed
=
TRUE
)
%>%
sapply
(
`[`
,
1
))
}
## Functions to create short taxa names -------------------------------------
...
...
@@ -67,6 +69,7 @@ sanitize_physeq_and_affi <- function(physeq, affi, fasta) {
if
(
long_taxa_names
(
otu_dictionary
$
sequence
))
{
warning
(
"Sequences already present in the multihits files.\nFasta file not used."
)
}
else
{
## FROGS rather than DADA2, keep sequences from fasta file
affi
<-
affi
%>%
dplyr
::
select
(
-
sequence
)
%>%
dplyr
::
left_join
(
fasta
,
by
=
"OTU"
)
}
}
...
...
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