Skip to content

Commit

Permalink
Updated generate_file_for_export to produce results files for both sa…
Browse files Browse the repository at this point in the history
…mples and controls
  • Loading branch information
ngaddis committed Oct 30, 2024
1 parent 22c691b commit 4ce246b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
1 change: 1 addition & 0 deletions t1dgrs2_pipeline/v2.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ WORKDIR /data
RUN chown -R docker:staff /data

ENTRYPOINT [ "/opt/entrypoint.sh" ]

4 changes: 2 additions & 2 deletions t1dgrs2_pipeline/v2.0/pipeline_config/t1dgrs2_tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@
"<inputs.missingness_summary_file>",
"--remove_file",
"<inputs.remove_file>",
"--output_file",
"<inputs.output_dir><inputs.run_id>_export.csv",
"--out_prefix",
"<inputs.output_dir><inputs.run_id>",
"--missing_hla_threshold",
"<inputs.missing_hla_threshold>",
"--missing_non_hla_threshold",
Expand Down
43 changes: 25 additions & 18 deletions t1dgrs2_pipeline/v2.0/scripts/generate_file_for_export.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
my $t1dgrs2_results_file = '';
my $missingness_summary_file = '';
my $remove_file = '';
my $output_file = '';
my $out_prefix = '';
my $missing_hla_threshold = 1;
my $missing_non_hla_threshold = 3;

GetOptions (
't1dgrs2_results_file=s' => \$t1dgrs2_results_file,
'missingness_summary_file=s' => \$missingness_summary_file,
'remove_file=s' => \$remove_file,
'output_file=s' => \$output_file,
'out_prefix=s' => \$out_prefix,
'missing_hla_threshold:i' => \$missing_hla_threshold,
'missing_non_hla_threshold:i' => \$missing_non_hla_threshold,
) or die("Invalid options");
Expand Down Expand Up @@ -44,31 +44,38 @@
}
close REMOVE;

# Open output file for writing
open(OUTPUT_FILE, ">".$output_file);
print OUTPUT_FILE join(",", "RTI_Accession","GRS2","Missingness_Filter")."\n";
# Open sample output file for writing
open(SAMPLE_OUTPUT_FILE, ">".$out_prefix.".csv");
print SAMPLE_OUTPUT_FILE join(",", "RTI_Accession","GRS2","Missingness_Filter")."\n";

# Open control output file for writing
open(CONTROL_OUTPUT_FILE, ">".$out_prefix."_controls.csv");
print CONTROL_OUTPUT_FILE join(",", "RTI_Accession","GRS2","Missingness_Filter")."\n";

# Process t1dgrs2 results file
open(T1DGRS2_RESULTS, $t1dgrs2_results_file);
<T1DGRS2_RESULTS>;
while(<T1DGRS2_RESULTS>) {
chomp;
@F = split("\t");
if (!exists($remove{$F[0]})) {
my $missingness = "?";
if (exists($missing_hla_counts{$F[0]})) {
if (
$missing_hla_counts{$F[0]} < $missing_hla_threshold
&& $missing_non_hla_counts{$F[0]} < $missing_non_hla_threshold
) {
$missingness = "PASS";
} else {
$missingness = "FAIL";
}
my $missingness = "?";
if (exists($missing_hla_counts{$F[0]})) {
if (
$missing_hla_counts{$F[0]} < $missing_hla_threshold
&& $missing_non_hla_counts{$F[0]} < $missing_non_hla_threshold
) {
$missingness = "PASS";
} else {
$missingness = "FAIL";
}
print OUTPUT_FILE join(",", $F[0], $F[2], $missingness)."\n";
}
if (exists($remove{$F[0]})) {
print CONTROL_OUTPUT_FILE join(",", $F[0], $F[2], $missingness)."\n";
} else {
print SAMPLE_OUTPUT_FILE join(",", $F[0], $F[2], $missingness)."\n";
}
}
close T1DGRS2_RESULTS;

close OUTPUT_FILE;
close SAMPLE_OUTPUT_FILE;
close CONTROL_OUTPUT_FILE;

0 comments on commit 4ce246b

Please sign in to comment.