Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
GUDMAP_RBK
data_hub_scripts
Commits
c690f790
Commit
c690f790
authored
Jan 15, 2021
by
Gervaise Henry
🤠
Browse files
Filter replicates for only mRNA
parent
7e8242c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
scripts/
split_study
.py
→
scripts/
extract_RIDs
.py
View file @
c690f790
...
...
@@ -8,7 +8,7 @@ warnings.simplefilter(action='ignore', category=FutureWarning)
def
get_args
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-
s
'
,
'--
studyRID
'
,
parser
.
add_argument
(
'-
f
'
,
'--
file
'
,
help
=
"The study RID."
,
required
=
True
)
args
=
parser
.
parse_args
()
return
args
...
...
@@ -16,13 +16,13 @@ def get_args():
def
main
():
args
=
get_args
()
study
RID
=
pd
.
read_json
(
args
.
studyRID
+
"_studyRID
.json"
)
if
study
RID
[
"RID"
].
count
()
>
0
:
study
RID
[
"RID"
].
to_csv
(
args
.
studyRID
+
"_studyRID
.csv"
,
header
=
False
,
index
=
False
)
RID
=
pd
.
read_json
(
args
.
file
+
"
.json"
)
if
RID
[
"RID"
].
count
()
>
0
:
RID
[
"RID"
].
to_csv
(
args
.
file
+
"
.csv"
,
header
=
False
,
index
=
False
,
mode
=
'a'
)
else
:
raise
Exception
(
"No associated replicates found: %s"
%
study
RID
)
RID
)
if
__name__
==
'__main__'
:
...
...
scripts/split_study.sh
View file @
c690f790
...
...
@@ -37,19 +37,33 @@ main(){
shift
$((
$OPTIND
-
1
))
# Check for mandatory options
if
[[
-z
$rid
]]
||
[[
-z
$tag
]]
||
[[
-z
$email
]]
||
[[
-z
$out
]]
;
then
if
[[
-z
$
{
rid
}
]]
||
[[
-z
$
{
tag
}
]]
||
[[
-z
$
{
email
}
]]
||
[[
-z
$
{
out
}
]]
;
then
usage
fi
# query GUDMAP/RBK for study RID
echo
"curl --location --request GET 'https://www.gudmap.org/ermrest/catalog/2/entity/RNASeq:Replicate/Study_RID="
${
rid
}
"'"
| bash
>
$rid
\_
studyRID.json
# extract replicate RIDs
python3 ./scripts/split_study.py
-s
$rid
# query GUDMAP/RBK study RID for experiment RIDs
echo
"curl --location --request GET 'https://www.gudmap.org/ermrest/catalog/2/entity/RNASeq:Experiment/Sequencing_Type=mRNA-Seq/Study_RID="
${
rid
}
"'"
| bash
>
${
rid
}
\_
experimentRIDs.json
# extract experiment RIDs
>
${
rid
}
\_
experimentRIDs.csv
python3 ./scripts/extract_RIDs.py
-f
${
rid
}
\_
experimentRIDs
expRIDs
=
$(
cat
${
rid
}
\_
experimentRIDs.csv
)
>
${
rid
}
\_
studyRID.csv
for
expRID
in
${
expRIDs
}
do
# query GUDMAP/RBK experiment RIDs for replicate RIDs
>
temp
\_
${
expRID
}
\_
repRIDs.json
echo
"curl --location --request GET 'https://www.gudmap.org/ermrest/catalog/2/entity/RNASeq:Replicate/Experiment_RID="
${
expRID
}
"'"
| bash
>>
temp
\_
${
expRID
}
\_
repRIDs.json
# extract replicate RIDs
>
temp
\_
${
expRID
}
\_
repRIDs.csv
python3 ./scripts/extract_RIDs.py
-f
temp
\_
${
expRID
}
\_
repRIDs
cat
temp
\_
${
expRID
}
\_
repRIDs.csv
>>
${
rid
}
\_
studyRID.csv
done
# cleanup study RID files
rm
$rid
\_
studyRID.json
rm
-f
temp
*
rm
${
rid
}
\_
experimentRIDs.json
rm
${
rid
}
\_
experimentRIDs.csv
# make dir for study
mkdir
$out
/
$rid
...
...
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