Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass at SpecimenProcessing class #12

Merged
merged 22 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,455 changes: 1,455 additions & 0 deletions examples/adc/ipa1.ireceptor.org-PRJNA248411-AKC.json

Large diffs are not rendered by default.

2,185 changes: 2,185 additions & 0 deletions examples/adc/ipa1.ireceptor.org-PRJNA280743-AKC.json

Large diffs are not rendered by default.

2,830 changes: 2,830 additions & 0 deletions examples/adc/ipa5.ireceptor.org-PRJNA381394-AKC.json

Large diffs are not rendered by default.

9,177 changes: 9,177 additions & 0 deletions examples/adc/ipa6.ireceptor.org-PRJNA509910-AKC.json

Large diffs are not rendered by default.

2,739 changes: 2,739 additions & 0 deletions examples/adc/t1d-2.ireceptor.org-IR-T1D-000003-AKC.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion examples/adc/vdjserver-PRJNA300878-ADC.json

This file was deleted.

925 changes: 0 additions & 925 deletions examples/adc/vdjserver-PRJNA300878-AKC.json

This file was deleted.

2,543 changes: 2,543 additions & 0 deletions examples/adc/vdjserver.org-PRJNA248475-AKC.json

Large diffs are not rendered by default.

4,525 changes: 4,525 additions & 0 deletions examples/adc/vdjserver.org-PRJNA300878-AKC.json

Large diffs are not rendered by default.

987 changes: 987 additions & 0 deletions examples/adc/vdjserver.org-PRJNA472381-AKC.json

Large diffs are not rendered by default.

1,154 changes: 1,154 additions & 0 deletions examples/adc/vdjserver.org-PRJNA608742-AKC.json

Large diffs are not rendered by default.

2,434 changes: 2,434 additions & 0 deletions examples/adc/vdjserver.org-PRJNA680539-AKC.json

Large diffs are not rendered by default.

1,922 changes: 1,922 additions & 0 deletions examples/adc/vdjserver.org-PRJNA724733-AKC.json

Large diffs are not rendered by default.

22,854 changes: 22,854 additions & 0 deletions examples/combined/ADC-combined.json

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions examples/combined/akc_cat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# Check if the correct number of arguments is provided
# This processes all of the JSON file in input_directory
# and generates a single combined file. Lists at the top
# level of the objects are merged across the files to
# create a single long list. There is an expected top level
# object called AIRRKnowledgeCommons that contains the lists.
# E.g. All AKC "investigations" across all of the AKC files
# will be merged into a single "investigations" list.
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <input_directory> <output_file>"
exit 1
fi

# Read arguments
JSON_DIR="$1"
OUTPUT_FILE="$2"

# Check if the input directory exists
if [ ! -d "$JSON_DIR" ]; then
echo "Error: Directory $JSON_DIR does not exist."
exit 1
fi

# Check if the directory exists
if [ ! -d "$JSON_DIR" ]; then
echo "Directory $JSON_DIR does not exist."
exit 1
fi

# Use jq to dynamically merge all top-level lists from AIRRKnowledgeCommons
# Thanks to ChatGPT for the jq magic...
jq -s '
reduce .[] as $item ({};
if $item.AIRRKnowledgeCommons then
reduce ($item.AIRRKnowledgeCommons | keys_unsorted)[] as $key (.;
if $item.AIRRKnowledgeCommons[$key] | type == "object" then
.[$key] += $item.AIRRKnowledgeCommons[$key]
elif $item.AIRRKnowledgeCommons[$key] | type == "array" then
.[$key] += ($item.AIRRKnowledgeCommons[$key] | map(.))
else
.
end
)
else
.
end
)' "$JSON_DIR"/*.json > "$OUTPUT_FILE"

# Check if the operation succeeded
if [ $? -eq 0 ]; then
echo "Combined lists written to $OUTPUT_FILE"
else
echo "An error occurred while combining the files."
fi

Loading