Commit c690f790 authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Filter replicates for only mRNA

parent 7e8242c8
......@@ -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()
studyRID = pd.read_json(args.studyRID+"_studyRID.json")
if studyRID["RID"].count() > 0:
studyRID["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" %
studyRID)
RID)
if __name__ == '__main__':
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment