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
Amine GHOZLANE
shaman
Commits
f2b8aef9
Commit
f2b8aef9
authored
Apr 27, 2017
by
svolant
Browse files
contaminant in fasta file
parent
9315b536
Changes
2
Hide whitespace changes
Inline
Side-by-side
Rfunctions/Data_Management.R
View file @
f2b8aef9
...
...
@@ -337,16 +337,19 @@ SamplesMasque <- function(input,values)
CreateJSON
<-
function
(
input
,
values
){
tmp
=
tempdir
()
path_fasta
=
paste
(
tmp
,
paste
(
basename
(
file_path_sans_ext
(
values
$
json_name
)),
"_contaminant.fasta"
,
sep
=
""
),
sep
=
.Platform
$
file.sep
)
if
(
input
$
PairedOrNot
==
'n'
)
{
path_fastq
=
paste
(
tempdir
(),
"Masque_files"
,
sep
=
.Platform
$
file.sep
)
path_fastq
=
paste
(
tmp
,
"Masque_files"
,
sep
=
.Platform
$
file.sep
)
df
=
data.frame
(
"paired"
=
FALSE
,
"path"
=
path_fastq
,
"host"
=
input
$
HostName
,
"type"
=
input
$
DataTypeMasque
,
"mail"
=
values
$
login_email
,
"contaminant"
=
"/home/aghozlan/workspace/shaman_bioblend/alienTrimmerPF8contaminants.
fasta
"
"contaminant"
=
path_
fasta
)
df
%>%
jsonlite
::
toJSON
()
%>%
write_lines
(
values
$
json_name
)
...
...
@@ -362,7 +365,7 @@ CreateJSON <- function(input,values){
"host"
=
input
$
HostName
,
"type"
=
input
$
DataTypeMasque
,
"mail"
=
values
$
login_email
,
"contaminant"
=
"/home/aghozlan/workspace/shaman_bioblend/alienTrimmerPF8contaminants.
fasta
"
"contaminant"
=
path_
fasta
)
df
%>%
jsonlite
::
toJSON
()
%>%
write_lines
(
values
$
json_name
)
}
...
...
server.R
View file @
f2b8aef9
...
...
@@ -680,27 +680,24 @@ shinyServer(function(input, output,session) {
# observeEvent(input$submit,{
# values$fastq_names_only = NULL
# tmp = tempdir()
# pathTo = paste(tmp,"Masque_files",sep=.Platform$file.sep)
#
# if (dir.exists(pathTo))
# {
# file.remove(list.files(pathTo,full.names =TRUE))
# } else dir.create(pathTo)
#
# file.copy(from=Sys.glob(path()), to=paste(tmp,"Masque_files",sep= .Platform$file.sep))
# })
#
CreateFasta
<-
reactive
({
seq
=
NULL
tmp
=
tempdir
()
fastaName
=
paste
(
tmp
,
paste
(
basename
(
file_path_sans_ext
(
json_name
)),
"_contaminant.fasta"
,
sep
=
""
),
sep
=
.Platform
$
file.sep
)
if
(
!
file.exists
(
fastaName
))
file.create
(
fastaName
,
showWarnings
=
FALSE
)
if
(
input
$
PairedOrNot
==
"y"
){
seq
=
paste
(
"#Seq1\n"
,
input
$
R1primer
,
"\n \n"
,
"#Seq2\n"
,
input
$
R2primer
,
sep
=
""
)}
if
(
input
$
PairedOrNot
==
"n"
){
seq
=
input
$
primerSingle
}
if
(
!
is.null
(
seq
))
write
(
seq
,
file
=
fastaName
)
})
observeEvent
(
input
$
submit
,{
CMP
=
CheckMasque
(
input
,
values
)
Error
=
CMP
$
Error
values
$
num
=
1
isJSONalreadyExist
=
file.exists
(
paste
(
curdir
,
"www"
,
"masque"
,
"doing"
,
basename
(
json_name
),
sep
=
.Platform
$
file.sep
))
CreateFasta
()
if
(
is.null
(
Error
)
&&
!
isJSONalreadyExist
)
{
tmp
=
tempdir
()
...
...
@@ -938,10 +935,13 @@ shinyServer(function(input, output,session) {
if
(
file.exists
(
progress_file
))
{
pf
=
read_lines
(
progress_file
)
pf
=
as.numeric
(
pf
)
if
(
!
is.na
(
pf
)){
pf
=
min
(
pf
,
100
);
pf
=
max
(
pf
,
0
)
if
(
isolate
(
values
$
num
)
<
pf
)
{
values
$
num
=
pf
}
print
(
pf
)
if
(
!
is.null
(
pf
)){
pf
=
as.numeric
(
pf
)
if
(
!
is.na
(
pf
)){
pf
=
min
(
pf
,
100
);
pf
=
max
(
pf
,
0
)
if
(
isolate
(
values
$
num
)
<
pf
)
{
values
$
num
=
pf
}
}
}
}
...
...
Write
Preview
Supports
Markdown
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