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
edna
snakemake_rapidrun_swarm
Commits
b6b36131
Commit
b6b36131
authored
Apr 21, 2021
by
peguerin
Browse files
argparse system and many markers
parent
3597a58f
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/prepare_spygen_data.py
View file @
b6b36131
import
pandas
import
sys
import
argparse
import
os
datFile
=
'Teleo.dat'
aliceFile
=
'cor_tag_teleo.csv'
#datFile='Teleo.dat'
#aliceFile='cor_tag_teleo.csv'
#projetName='notreProjet'
parser
=
argparse
.
ArgumentParser
(
description
=
'prepare rapidrun allsamples CSV file'
)
parser
.
add_argument
(
"-d"
,
"--datFolder"
,
type
=
str
,
help
=
"Folder of the dat files"
)
parser
.
add_argument
(
"-a"
,
"--aliceFile"
,
type
=
str
,
help
=
"CSV Alice file"
)
parser
.
add_argument
(
"-p"
,
"--projetName"
,
type
=
str
,
help
=
"name of the project"
)
args
=
parser
.
parse_args
()
datFolder
=
args
.
datFolder
aliceFile
=
args
.
aliceFile
projetName
=
args
.
projetName
datFolder
=
'resources/test/test_rapidrun_data/ngs/rapidrun_metadata/'
datFolderList
=
os
.
listdir
(
datFolder
)
datFiles
=
{}
for
fichier
in
datFolderList
:
if
".dat"
in
fichier
:
datMarker
=
fichier
.
split
(
"."
)[
0
].
lower
()
datFiles
[
datMarker
]
=
datFolder
+
"/"
+
fichier
datDic
=
{}
for
key
in
datFiles
:
datDic
[
key
]
=
pandas
.
read_csv
(
datFiles
[
key
],
sep
=
'
\t
'
,
names
=
[
"plaque"
,
"plaque1"
,
"tag"
,
"primerF"
,
"primerR"
,
"description"
])
###############################################################################
...
...
@@ -10,7 +36,6 @@ aliceFile='cor_tag_teleo.csv'
alice
=
pandas
.
read_csv
(
aliceFile
,
sep
=
';'
)
dat
=
pandas
.
read_csv
(
datFile
,
sep
=
'
\t
'
,
names
=
[
"plaque"
,
"plaque1"
,
"tag"
,
"primerF"
,
"primerR"
,
"description"
])
uniqMarkers
=
alice
.
marker
.
unique
()
for
marker
in
uniqMarkers
:
...
...
@@ -32,11 +57,11 @@ for marker in uniqMarkers:
plaque
=
dat
[
'plaque'
][
i
]
sample
=
aliceRun
[
'Sample'
][
j
]
if
"SPY"
in
sample
:
projet
=
"notreP
rojet
"
elif
"Other"
in
sample
:
projet
=
p
rojet
Name
elif
"Other"
in
sample
or
"OTHER"
in
sample
or
"Other"
in
sample
:
projet
=
"Other"
else
:
projet
=
"notreP
rojet
"
projet
=
p
rojet
Name
print
(
plaque
,
run
,
sample
,
projet
,
marker
,
sep
=
";"
)
break
if
not
in_alice
:
...
...
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