@@ -46,6 +46,7 @@ def cli():
4646
4747cli .add_command (data )
4848
49+
4950@cli .command ()
5051def config ():
5152 """Display the current configuration settings."""
@@ -86,11 +87,18 @@ def find(arg1, arg2, arg3, arg4, arg5, processed_dir, sql):
8687 if arg1 and arg2 and arg3 and arg4 :
8788 # assuming chrom/pos/start/end
8889 exists , unique_ids = find_variant (
89- chrom = arg1 , start = arg2 , end = arg3 , ref = arg4 , alt = arg5 , directory = processed_dir
90+ chrom = arg1 ,
91+ start = arg2 ,
92+ end = arg3 ,
93+ ref = arg4 ,
94+ alt = arg5 ,
95+ directory = processed_dir ,
9096 )
9197 elif arg1 and arg2 :
9298 # assuming gene/protein_change
93- exists , unique_ids = find_variant (hugo_symbol = arg1 , protein_change = arg2 , directory = processed_dir )
99+ exists , unique_ids = find_variant (
100+ hugo_symbol = arg1 , protein_change = arg2 , directory = processed_dir
101+ )
94102 else :
95103 click .echo (click .style ("❌ Invalid arguments." , fg = "red" ))
96104 return
@@ -108,6 +116,7 @@ def find(arg1, arg2, arg3, arg4, arg5, processed_dir, sql):
108116 else :
109117 click .echo (click .style ("❌ Variant not found." , fg = "red" ))
110118
119+
111120def detect_variant_type (args ):
112121 """
113122 Detects the variant type based on the number and structure of arguments.
@@ -121,10 +130,13 @@ def detect_variant_type(args):
121130 elif len (args ) == 2 :
122131 return ProteinVariant (* args )
123132 else :
124- raise click .UsageError ("Could not detect variant type. Ensure arguments match either chrom/start/end/ref/alt or gene/protein_change format." )
133+ raise click .UsageError (
134+ "Could not detect variant type. Ensure arguments match either chrom/start/end/ref/alt or gene/protein_change format."
135+ )
136+
125137
126138@cli .command (help = "Check how frequently a particular variant occurs per cancer type." )
127- @click .argument (' args' , nargs = - 1 , required = True )
139+ @click .argument (" args" , nargs = - 1 , required = True )
128140@click .option (
129141 "--clinical-attribute" ,
130142 default = "CANCER_TYPE" ,
@@ -143,14 +155,20 @@ def detect_variant_type(args):
143155 help = "Count samples instead of patients" ,
144156)
145157@common_options
146- def variant_frequency (args , clinical_attribute , processed_dir , sql , group_by_study_id , count_samples ):
158+ def variant_frequency (
159+ args , clinical_attribute , processed_dir , sql , group_by_study_id , count_samples
160+ ):
147161 """Check how frequently a particular variant occurs per cancer type (or
148162 other clinical sample attributes)."""
149163 variant = detect_variant_type (args )
150164
151165 result = variant_frequency_per_clinical_attribute (
152- variant , clinical_attribute , directory = processed_dir , sql = sql , group_by_study_id = group_by_study_id ,
153- count_samples = count_samples
166+ variant ,
167+ clinical_attribute ,
168+ directory = processed_dir ,
169+ sql = sql ,
170+ group_by_study_id = group_by_study_id ,
171+ count_samples = count_samples ,
154172 )
155173 if sql :
156174 return print (result )
0 commit comments