-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added data-driven test for rna_distribution_data
- Loading branch information
1 parent
9ef8c86
commit e26e735
Showing
7 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...test_assets/rna_distribution_data/input/test_rna_distribution_data_bad_input_keyerror.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
model,tissue,comparison,ensembl_gene_id,logfc,ci_l,ci_r,aveexpr,t,p_value,adj_p_val,gene_biotype,chromosome_name,direction,hgnc_symbol,percentage_gc_content,gene_length,sex,study | ||
,CBE,AD-CONTROL,ENSG00000228521,1.646715414,1.219378549,2.074052279,-2.452298708,7.544599094,2.21E-13,2.26E-10,lncRNA,7,UP,AC099552.3,60.6903164,1043,ALL,MAYO | ||
,CBE,AD-CONTROL,ENSG00000286872,-0.181247795,-0.341187573,-0.021308017,0.032732484,-2.226401902,0.026439738,0.06693269,lncRNA,15,NONE,AC024270.5,46.5131873,13422,ALL,MAYO | ||
,CBE,AD-CONTROL,ENSG00000144228,0.080531879,-0.016465937,0.177529695,4.913442808,1.63093857,0.10355023,0.193939662,protein_coding,2,NONE,SPOPL,36.67609796,71747,ALL,MAYO | ||
Diagnosis.AOD,,AD-CONTROL,ENSG00000005339,0.074072272,0.042805132,0.105339413,7.626719604,4.656313999,4.15E-06,8.32E-05,protein_coding,16,NONE,CREBBP,45.00523533,155673,ALL,MAYO | ||
Diagnosis.AOD,,AD-CONTROL,ENSG00000188994,0.03375383,-0.010318552,0.077826212,6.703806497,1.501322866,0.133920382,0.239511453,protein_coding,6,NONE,ZNF292,37.67626491,113111,ALL,MAYO | ||
Diagnosis.AOD,,AD-CONTROL,ENSG00000261823,-0.008434191,-0.077650231,0.060781849,-0.970547902,-0.239149259,0.811089637,0.873760793,lncRNA,15,NONE,AC084782.2,42.13615023,1704,ALL,MAYO |
2 changes: 2 additions & 0 deletions
2
...est_assets/rna_distribution_data/input/test_rna_distribution_data_bad_input_typeerror.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
model,tissue,comparison,ensembl_gene_id,logfc,ci_l,ci_r,aveexpr,t,p_value,adj_p_val,gene_biotype,chromosome_name,direction,hgnc_symbol,percentage_gc_content,gene_length,sex,study | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000228521,No change,1.219378549,2.074052279,-2.452298708,7.544599094,2.21E-13,2.26E-10,lncRNA,7,UP,AC099552.3,60.6903164,1043,ALL,MAYO |
26 changes: 26 additions & 0 deletions
26
tests/test_assets/rna_distribution_data/input/test_rna_distribution_data_good_input.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
model,tissue,comparison,ensembl_gene_id,logfc,ci_l,ci_r,aveexpr,t,p_value,adj_p_val,gene_biotype,chromosome_name,direction,hgnc_symbol,percentage_gc_content,gene_length,sex,study | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000228521,1.646715414,1.219378549,2.074052279,-2.452298708,7.544599094,2.21E-13,2.26E-10,lncRNA,7,UP,AC099552.3,60.6903164,1043,ALL,MAYO | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000286872,-0.181247795,-0.341187573,-0.021308017,0.032732484,-2.226401902,0.026439738,0.06693269,lncRNA,15,NONE,AC024270.5,46.5131873,13422,ALL,MAYO | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000144228,0.080531879,-0.016465937,0.177529695,4.913442808,1.63093857,0.10355023,0.193939662,protein_coding,2,NONE,SPOPL,36.67609796,71747,ALL,MAYO | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000285778,0.011774265,-0.225427841,0.248976371,-1.286000104,0.097352193,0.922486354,0.950960873,lncRNA,1,NONE,AL591463.1,36.23399051,127971,ALL,MAYO | ||
Diagnosis.AOD,CBE,AD-CONTROL,ENSG00000005339,0.074072272,0.042805132,0.105339413,7.626719604,4.656313999,4.15E-06,8.32E-05,protein_coding,16,NONE,CREBBP,45.00523533,155673,ALL,MAYO | ||
Diagnosis.AOD,CBE,AD-CONTROL,ENSG00000188994,0.03375383,-0.010318552,0.077826212,6.703806497,1.501322866,0.133920382,0.239511453,protein_coding,6,NONE,ZNF292,37.67626491,113111,ALL,MAYO | ||
Diagnosis.AOD,CBE,AD-CONTROL,ENSG00000261823,-0.008434191,-0.077650231,0.060781849,-0.970547902,-0.239149259,0.811089637,0.873760793,lncRNA,15,NONE,AC084782.2,42.13615023,1704,ALL,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000146733,0.245221101,0.088916757,0.401525444,3.6245628,3.081227128,0.002180227,0.025429476,protein_coding,7,NONE,PSPH,46.3530108,40554,FEMALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000164574,0.111683536,-0.075953728,0.299320799,4.556619644,1.16706539,0.24377083,0.459714102,protein_coding,5,NONE,GALNT10,44.28655187,230255,FEMALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000105127,0.036793733,-0.059745776,0.133333242,4.795637019,0.751265208,0.452857433,0.660329327,protein_coding,19,NONE,AKAP8,53.23691982,26414,FEMALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000205790,0.347641938,0.137145533,0.558138342,-0.677376322,3.255063005,0.001212908,0.010745247,lncRNA,19,UP,DPP9-AS1,59.2620369,6667,MALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000171469,-0.147816242,-0.269059529,-0.026572954,3.644836924,-2.399058545,0.016813764,0.066411124,protein_coding,19,NONE,ZNF561,44.45249743,16557,MALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000064703,-0.055752044,-0.165988677,0.054484588,3.592526425,-0.996676453,0.319418656,0.497558937,protein_coding,1,NONE,DDX20,40.26340546,12756,MALE,MAYO | ||
Diagnosis,FP,AD-CONTROL,ENSG00000260751,-0.247109844,-0.416792039,-0.077427649,0.47017593,-2.856419551,0.004377501,0.037095362,lncRNA,16,NONE,AC008870.2,43.65234375,1024,ALL,MSSM | ||
Diagnosis,FP,AD-CONTROL,ENSG00000170017,0.116124024,0.013752868,0.218495179,7.605164653,2.220609241,0.026685651,0.111182878,protein_coding,3,NONE,ALCAM,35.28991581,209992,ALL,MSSM | ||
Diagnosis,FP,AD-CONTROL,ENSG00000235290,-0.057859204,-0.252212735,0.136494327,-0.16909436,-0.584873994,0.558811376,0.712709557,unprocessed_pseudogene,6,NONE,HLA-W,53.26582278,1975,ALL,MSSM | ||
Diagnosis,FP,AD-CONTROL,ENSG00000177728,0.017353424,-0.086789821,0.12149667,6.788782124,0.32609337,0.744427926,0.845969576,protein_coding,17,NONE,TMEM94,52.00188889,59294,ALL,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000172780,-0.434385421,-0.717838177,-0.150932665,0.396064873,-3.00527216,0.00271497,0.065139157,protein_coding,3,NONE,RAB43,50.78477564,35233,MALE,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000269054,-0.155588882,-0.396743565,0.0855658,0.942597545,-1.265404041,0.206045462,0.491878373,lncRNA,19,NONE,AC012313.6,56.27619238,5011,MALE,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000197497,0.079706407,-0.081429533,0.240842348,2.881636183,0.973898187,0.33048948,0.611179707,protein_coding,19,NONE,ZNF665,45.25955405,34174,MALE,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000155827,0.02916353,-0.045914974,0.104242034,5.680912284,0.768042101,0.442712225,0.699692125,protein_coding,9,NONE,RNF20,38.16967313,29492,MALE,MSSM | ||
Diagnosis,ACC,AD-CONTROL,ENSG00000125841,-0.181579939,-0.256616609,-0.10654327,6.725621038,-4.743548393,2.22E-06,6.90E-05,protein_coding,20,NONE,NRSN2,51.93726221,12879,ALL,ROSMAP | ||
Diagnosis,ACC,AD-CONTROL,ENSG00000135898,-0.074241909,-0.471057434,0.322573617,0.222262803,-0.366638152,0.713920945,0.827016898,protein_coding,2,NONE,GPR55,48.82695492,53749,ALL,ROSMAP | ||
Diagnosis,ACC,AD-CONTROL,ENSG00000151834,-0.027222811,-0.121567916,0.067122295,6.530023004,-0.56550242,0.571784411,0.72424515,protein_coding,4,NONE,GABRA2,35.62900125,226804,ALL,ROSMAP | ||
Diagnosis.AOD,ACC,AD-CONTROL,ENSG00000099365,-0.093331151,-0.124320202,-0.0623421,8.150447477,-5.901609746,4.10E-09,4.84E-08,protein_coding,16,NONE,STX1B,55.21208437,21383,ALL,ROSMAP |
26 changes: 26 additions & 0 deletions
26
tests/test_assets/rna_distribution_data/input/test_rna_distribution_data_missing_values.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
model,tissue,comparison,ensembl_gene_id,logfc,ci_l,ci_r,aveexpr,t,p_value,adj_p_val,gene_biotype,chromosome_name,direction,hgnc_symbol,percentage_gc_content,gene_length,sex,study | ||
,CBE,AD-CONTROL,ENSG00000228521,1.646715414,1.219378549,2.074052279,-2.452298708,7.544599094,2.21E-13,2.26E-10,lncRNA,7,UP,AC099552.3,60.6903164,1043,ALL,MAYO | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000286872,-0.181247795,-0.341187573,-0.021308017,0.032732484,-2.226401902,0.026439738,0.06693269,lncRNA,15,NONE,AC024270.5,46.5131873,13422,ALL,MAYO | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000144228,0.080531879,-0.016465937,0.177529695,4.913442808,1.63093857,0.10355023,0.193939662,protein_coding,2,NONE,SPOPL,36.67609796,71747,ALL,MAYO | ||
Diagnosis,CBE,AD-CONTROL,ENSG00000285778,0.011774265,-0.225427841,0.248976371,-1.286000104,0.097352193,0.922486354,0.950960873,lncRNA,1,NONE,AL591463.1,36.23399051,127971,ALL,MAYO | ||
Diagnosis.AOD,CBE,AD-CONTROL,ENSG00000005339,0.074072272,0.042805132,0.105339413,7.626719604,4.656313999,4.15E-06,8.32E-05,protein_coding,16,NONE,CREBBP,45.00523533,155673,ALL,MAYO | ||
Diagnosis.AOD,,AD-CONTROL,ENSG00000188994,0.03375383,-0.010318552,0.077826212,6.703806497,1.501322866,0.133920382,0.239511453,protein_coding,6,NONE,ZNF292,37.67626491,113111,ALL,MAYO | ||
Diagnosis.AOD,CBE,AD-CONTROL,ENSG00000261823,-0.008434191,-0.077650231,0.060781849,-0.970547902,-0.239149259,0.811089637,0.873760793,lncRNA,15,NONE,AC084782.2,42.13615023,1704,ALL,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000146733,0.245221101,0.088916757,0.401525444,3.6245628,3.081227128,0.002180227,0.025429476,protein_coding,7,NONE,PSPH,46.3530108,40554,FEMALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000164574,0.111683536,-0.075953728,0.299320799,4.556619644,1.16706539,0.24377083,0.459714102,protein_coding,5,NONE,GALNT10,44.28655187,230255,FEMALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000105127,0.036793733,-0.059745776,0.133333242,4.795637019,0.751265208,0.452857433,0.660329327,protein_coding,19,NONE,AKAP8,53.23691982,26414,FEMALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000205790,0.347641938,0.137145533,0.558138342,-0.677376322,3.255063005,0.001212908,0.010745247,lncRNA,19,UP,DPP9-AS1,59.2620369,6667,MALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000171469,-0.147816242,-0.269059529,-0.026572954,3.644836924,-2.399058545,0.016813764,0.066411124,protein_coding,19,NONE,ZNF561,44.45249743,16557,MALE,MAYO | ||
Diagnosis.Sex,CBE,AD-CONTROL,ENSG00000064703,-0.055752044,-0.165988677,0.054484588,3.592526425,-0.996676453,0.319418656,0.497558937,protein_coding,1,NONE,DDX20,40.26340546,12756,MALE,MAYO | ||
Diagnosis,FP,AD-CONTROL,ENSG00000260751,-0.247109844,-0.416792039,-0.077427649,0.47017593,-2.856419551,0.004377501,0.037095362,lncRNA,16,NONE,AC008870.2,43.65234375,1024,ALL,MSSM | ||
Diagnosis,FP,AD-CONTROL,ENSG00000170017,,0.013752868,0.218495179,7.605164653,2.220609241,0.026685651,0.111182878,protein_coding,3,NONE,ALCAM,35.28991581,209992,ALL,MSSM | ||
Diagnosis,FP,AD-CONTROL,ENSG00000235290,-0.057859204,-0.252212735,0.136494327,-0.16909436,-0.584873994,0.558811376,0.712709557,unprocessed_pseudogene,6,NONE,HLA-W,53.26582278,1975,ALL,MSSM | ||
Diagnosis,FP,AD-CONTROL,ENSG00000177728,0.017353424,-0.086789821,0.12149667,6.788782124,0.32609337,0.744427926,0.845969576,protein_coding,17,NONE,TMEM94,52.00188889,59294,ALL,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000172780,,-0.717838177,-0.150932665,0.396064873,-3.00527216,0.00271497,0.065139157,protein_coding,3,NONE,RAB43,50.78477564,35233,MALE,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000269054,,-0.396743565,0.0855658,0.942597545,-1.265404041,0.206045462,0.491878373,lncRNA,19,NONE,AC012313.6,56.27619238,5011,MALE,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000197497,,-0.081429533,0.240842348,2.881636183,0.973898187,0.33048948,0.611179707,protein_coding,19,NONE,ZNF665,45.25955405,34174,MALE,MSSM | ||
Diagnosis.Sex,FP,AD-CONTROL,ENSG00000155827,,-0.045914974,0.104242034,5.680912284,0.768042101,0.442712225,0.699692125,protein_coding,9,NONE,RNF20,38.16967313,29492,MALE,MSSM | ||
Diagnosis,ACC,AD-CONTROL,ENSG00000125841,-0.181579939,-0.256616609,-0.10654327,6.725621038,-4.743548393,2.22E-06,6.90E-05,protein_coding,20,NONE,NRSN2,51.93726221,12879,ALL,ROSMAP | ||
Diagnosis,ACC,AD-CONTROL,ENSG00000135898,-0.074241909,-0.471057434,0.322573617,0.222262803,-0.366638152,0.713920945,0.827016898,protein_coding,2,NONE,GPR55,48.82695492,53749,ALL,ROSMAP | ||
Diagnosis,ACC,AD-CONTROL,ENSG00000151834,-0.027222811,-0.121567916,0.067122295,6.530023004,-0.56550242,0.571784411,0.72424515,protein_coding,4,NONE,GABRA2,35.62900125,226804,ALL,ROSMAP | ||
Diagnosis.AOD,ACC,AD-CONTROL,ENSG00000099365,-0.093331151,-0.124320202,-0.0623421,8.150447477,-5.901609746,4.10E-09,4.84E-08,protein_coding,16,NONE,STX1B,55.21208437,21383,ALL,ROSMAP |
74 changes: 74 additions & 0 deletions
74
tests/test_assets/rna_distribution_data/output/rna_distribution_data_good_output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[ | ||
{ | ||
"model": "AD Diagnosis (males and females)", | ||
"tissue": "ACC", | ||
"min": -0.2437, | ||
"max": 0.065, | ||
"first_quartile": -0.1279, | ||
"median": -0.0742, | ||
"third_quartile": -0.0507 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x AOD (males and females)", | ||
"tissue": "ACC", | ||
"min": -0.0933, | ||
"max": -0.0933, | ||
"first_quartile": -0.0933, | ||
"median": -0.0933, | ||
"third_quartile": -0.0933 | ||
}, | ||
{ | ||
"model": "AD Diagnosis (males and females)", | ||
"tissue": "CBE", | ||
"min": -0.7993, | ||
"max": 1.2349, | ||
"first_quartile": -0.0365, | ||
"median": 0.0462, | ||
"third_quartile": 0.4721 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x AOD (males and females)", | ||
"tissue": "CBE", | ||
"min": -0.0492, | ||
"max": 0.1158, | ||
"first_quartile": 0.0127, | ||
"median": 0.0338, | ||
"third_quartile": 0.0539 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x Sex (females only)", | ||
"tissue": "CBE", | ||
"min": -0.0821, | ||
"max": 0.3348, | ||
"first_quartile": 0.0742, | ||
"median": 0.1117, | ||
"third_quartile": 0.1785 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x Sex (males only)", | ||
"tissue": "CBE", | ||
"min": -0.4734, | ||
"max": 0.5175, | ||
"first_quartile": -0.1018, | ||
"median": -0.0558, | ||
"third_quartile": 0.1459 | ||
}, | ||
{ | ||
"model": "AD Diagnosis (males and females)", | ||
"tissue": "FP", | ||
"min": -0.326, | ||
"max": 0.2629, | ||
"first_quartile": -0.1052, | ||
"median": -0.0203, | ||
"third_quartile": 0.042 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x Sex (males only)", | ||
"tissue": "FP", | ||
"min": -0.6259, | ||
"max": 0.4424, | ||
"first_quartile": -0.2253, | ||
"median": -0.0632, | ||
"third_quartile": 0.0418 | ||
} | ||
] |
74 changes: 74 additions & 0 deletions
74
...s/test_assets/rna_distribution_data/output/rna_distribution_data_missing_data_output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
[ | ||
{ | ||
"model": "AD Diagnosis (males and females)", | ||
"tissue": "ACC", | ||
"min": -0.2437, | ||
"max": 0.065, | ||
"first_quartile": -0.1279, | ||
"median": -0.0742, | ||
"third_quartile": -0.0507 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x AOD (males and females)", | ||
"tissue": "ACC", | ||
"min": -0.0933, | ||
"max": -0.0933, | ||
"first_quartile": -0.0933, | ||
"median": -0.0933, | ||
"third_quartile": -0.0933 | ||
}, | ||
{ | ||
"model": "AD Diagnosis (males and females)", | ||
"tissue": "CBE", | ||
"min": -0.2811, | ||
"max": 0.2425, | ||
"first_quartile": -0.0847, | ||
"median": 0.0118, | ||
"third_quartile": 0.0462 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x AOD (males and females)", | ||
"tissue": "CBE", | ||
"min": -0.0497, | ||
"max": 0.1153, | ||
"first_quartile": 0.0122, | ||
"median": 0.0328, | ||
"third_quartile": 0.0534 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x Sex (females only)", | ||
"tissue": "CBE", | ||
"min": -0.0821, | ||
"max": 0.3348, | ||
"first_quartile": 0.0742, | ||
"median": 0.1117, | ||
"third_quartile": 0.1785 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x Sex (males only)", | ||
"tissue": "CBE", | ||
"min": -0.4734, | ||
"max": 0.5175, | ||
"first_quartile": -0.1018, | ||
"median": -0.0558, | ||
"third_quartile": 0.1459 | ||
}, | ||
{ | ||
"model": "AD Diagnosis (males and females)", | ||
"tissue": "FP", | ||
"min": -0.3508, | ||
"max": 0.1781, | ||
"first_quartile": -0.1525, | ||
"median": -0.0579, | ||
"third_quartile": -0.0203 | ||
}, | ||
{ | ||
"model": "AD Diagnosis x Sex (males only)", | ||
"tissue": "FP", | ||
"min": null, | ||
"max": null, | ||
"first_quartile": null, | ||
"median": null, | ||
"third_quartile": null | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import os | ||
|
||
import pandas as pd | ||
import pytest | ||
|
||
from agoradatatools.etl.transform import rna_distribution | ||
|
||
|
||
class TestTransformRnaDistributionData: | ||
data_files_path = "tests/test_assets/rna_distribution_data" | ||
pass_test_data = [ | ||
( # pass with good data | ||
"test_rna_distribution_data_good_input.csv", | ||
"rna_distribution_data_good_output.json", | ||
), | ||
( # pass with missing data | ||
"test_rna_distribution_data_missing_values.csv", | ||
"rna_distribution_data_missing_data_output.json", | ||
), | ||
] | ||
pass_test_ids = [ | ||
"Pass with good data", | ||
"Pass with missing data", | ||
] | ||
fail_test_data = [ | ||
( # Fail with a TypeError due to string value in logfc | ||
"test_rna_distribution_data_bad_input_typeerror.csv", | ||
TypeError, | ||
), | ||
( # Fail with a KeyError due to too many missing values | ||
"test_rna_distribution_data_bad_input_keyerror.csv", | ||
KeyError, | ||
), | ||
] | ||
fail_test_ids = [ | ||
"Fail with bad data type", | ||
"Fail with too many missing values", | ||
] | ||
|
||
@pytest.mark.parametrize( | ||
"input_file, expected_output_file", pass_test_data, ids=pass_test_ids | ||
) | ||
def test_transform_rna_distribution_data_should_pass( | ||
self, input_file, expected_output_file | ||
): | ||
input_df = pd.read_csv(os.path.join(self.data_files_path, "input", input_file)) | ||
output_df = rna_distribution.transform_rna_distribution_data( | ||
datasets={"diff_exp_data": input_df} | ||
) | ||
expected_df = pd.read_json( | ||
os.path.join(self.data_files_path, "output", expected_output_file), | ||
) | ||
pd.testing.assert_frame_equal(output_df, expected_df) | ||
|
||
@pytest.mark.parametrize("input_file, error_type", fail_test_data, ids=fail_test_ids) | ||
def test_transform_rna_distribution_data_should_fail(self, input_file, error_type): | ||
with pytest.raises(error_type): | ||
input_df = pd.read_csv( | ||
os.path.join(self.data_files_path, "input", input_file) | ||
) | ||
rna_distribution.transform_rna_distribution_data( | ||
datasets={"diff_exp_data": input_df} | ||
) |