split_study.py 730 Bytes
Newer Older
Venkat Malladi's avatar
Venkat Malladi committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3

import argparse
import pandas as pd
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)


def get_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('-s', '--studyRID',
                        help="The study RID.", required=True)
    args = parser.parse_args()
    return 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)
    else:
        raise Exception("No associated replicates found: %s" %
                        studyRID)


if __name__ == '__main__':
    main()