|
2 | 2 | Generic parse method to parse either a .gct or a .gctx. |
3 | 3 |
|
4 | 4 | Takes in a file path corresponding to either a .gct or .gctx, |
5 | | - and parses to a GCToo instance accordingly. |
| 5 | + and parses to a GCToo instance accordingly. |
6 | 6 |
|
7 | 7 | Note: Supports GCT1.2, GCT1.3, and GCTX1.0 files. |
8 | 8 | """ |
|
20 | 20 |
|
21 | 21 |
|
22 | 22 | def parse(file_path, convert_neg_666=True, rid=None, cid=None, ridx=None, cidx=None, |
23 | | - row_meta_only=False, col_meta_only=False, make_multiindex=False): |
| 23 | + row_meta_only=False, col_meta_only=False, make_multiindex=False): |
24 | 24 | """ |
25 | | - Identifies whether file_path corresponds to a .gct or .gctx file and calls the |
26 | | - correct corresponding parse method. |
| 25 | + Identifies whether file_path corresponds to a .gct or .gctx file and calls the |
| 26 | + correct corresponding parse method. |
27 | 27 |
|
28 | | - Input: |
29 | | - Mandatory: |
30 | | - - gct(x)_file_path (str): full path to gct(x) file you want to parse. |
31 | | - |
32 | | - Optional: |
33 | | - - row_meta_only (bool): Whether to load data + metadata (if False), or just row metadata (if True) |
34 | | - as pandas DataFrame |
35 | | - - col_meta_only (bool): Whether to load data + metadata (if False), or just col metadata (if True) |
36 | | - as pandas DataFrame |
37 | | - - convert_neg_666 (bool): whether to convert -666 values to numpy.nan or not |
38 | | - (see Note below for more details on this). Default = False. |
39 | | - - rid (list of strings): list of row ids to specifically keep from gctx. Default=None. |
40 | | - - cid (list of strings): list of col ids to specifically keep from gctx. Default=None. |
41 | | - - make_multiindex (bool): whether to create a multi-index df combining |
| 28 | + Input: |
| 29 | + Mandatory: |
| 30 | + - gct(x)_file_path (str): full path to gct(x) file you want to parse. |
| 31 | +
|
| 32 | + Optional: |
| 33 | + - row_meta_only (bool): Whether to load data + metadata (if False), or just row metadata (if True) |
| 34 | + as pandas DataFrame |
| 35 | + - col_meta_only (bool): Whether to load data + metadata (if False), or just col metadata (if True) |
| 36 | + as pandas DataFrame |
| 37 | + - convert_neg_666 (bool): whether to convert -666 values to numpy.nan or not |
| 38 | + (see Note below for more details on this). Default = False. |
| 39 | + - rid (list of strings): list of row ids to specifically keep from gctx. Default=None. |
| 40 | + - cid (list of strings): list of col ids to specifically keep from gctx. Default=None. |
| 41 | + - make_multiindex (bool): whether to create a multi-index df combining |
42 | 42 | the 3 component dfs |
43 | 43 |
|
44 | | - Output: |
45 | | - - myGCToo (GCToo) |
| 44 | + Output: |
| 45 | + - myGCToo (GCToo) |
46 | 46 |
|
47 | | - Note: why does convert_neg_666 exist? |
48 | | - - In CMap--for somewhat obscure historical reasons--we use "-666" as our null value |
49 | | - for metadata. However (so that users can take full advantage of pandas' methods, |
50 | | - including those for filtering nan's etc) we provide the option of converting these |
51 | | - into numpy.NaN values, the pandas default. |
52 | | - """ |
| 47 | + Note: why does convert_neg_666 exist? |
| 48 | + - In CMap--for somewhat obscure historical reasons--we use "-666" as our null value |
| 49 | + for metadata. However (so that users can take full advantage of pandas' methods, |
| 50 | + including those for filtering nan's etc) we provide the option of converting these |
| 51 | + into numpy.NaN values, the pandas default. |
| 52 | + """ |
53 | 53 | if file_path.endswith(".gct"): |
54 | 54 | # Ignoring arguments that won't be passed to parse_gct |
55 | | - for unused_arg in ["rid", "cid", "cidx", "row_meta_only", "col_meta_only"]: |
| 55 | + for unused_arg in ["rid", "cid", "cidx"]: |
56 | 56 | if eval(unused_arg): |
57 | 57 | msg = "parse_gct does not use the argument {}. Ignoring it...".format(unused_arg) |
58 | | - logger.info(msg) |
59 | | - curr = parse_gct.parse(file_path, convert_neg_666, make_multiindex) |
| 58 | + logger.warning(msg) |
| 59 | + curr = parse_gct.parse(file_path, convert_neg_666, row_meta_only, col_meta_only, make_multiindex) |
60 | 60 | elif file_path.endswith(".gctx"): |
61 | 61 | curr = parse_gctx.parse(file_path, convert_neg_666, rid, cid, ridx, cidx, row_meta_only, col_meta_only, |
62 | 62 | make_multiindex) |
|
0 commit comments