Skip to content

Add Source-Target Gene Analysis Web Interface #201

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

Merged
merged 37 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d11adf4
Refactor code to make it web-service usable
Feb 10, 2025
a51bd6d
Register the new blueprint file
Feb 10, 2025
fb27f01
Registered the blueprint for the homepage
Feb 10, 2025
f45c7d5
Create a routing function for source_target_analysis
Feb 10, 2025
8a39f50
Create a browsing card for source-target gene analysis
Feb 10, 2025
af88618
Create a template to display all the results on form submission
Feb 10, 2025
7ceabf1
Create the template to fill up the form with input source and target …
Feb 10, 2025
cb5fbfe
Create a conversion function to convert base64 string to boxplots
Feb 12, 2025
30ffef4
Remove logging and unnecessary error handling
Feb 12, 2025
66347ea
Add image for homepage card
Feb 12, 2025
4346cd9
Update the web UI for better user interactivity and experience
Feb 12, 2025
b002900
Improve error handling of invalid input entries
Feb 14, 2025
2baf4f0
Update get shared pathwats between gene sets function
Feb 18, 2025
15674f9
Update results template for better viewer readability
Feb 18, 2025
e8f4903
Fix spell errors
Feb 20, 2025
d42dc3b
Add CLI interface for source-target protein analysis
Feb 20, 2025
e58b713
Improve doctrings
Feb 20, 2025
063a8fe
Change view
Feb 20, 2025
b59f310
Improve plot conversion to use in-memory buffer instead of temporary …
Feb 25, 2025
4e0d510
Add example link and support comma-separated input for target genes
Feb 25, 2025
04a852c
Updated Javascript to handle example target genes
Feb 25, 2025
71f2d1c
Imporve dosctrings
Feb 26, 2025
fdcf449
Remove unused imports
Feb 26, 2025
dcb613d
Fixed these: consider condensing statement view to remove redundant p…
Feb 26, 2025
f2e73f3
Fix Naming
Feb 26, 2025
f5af85e
Improve description
Feb 27, 2025
d62c416
Remove redundancy
Feb 27, 2025
b0fa687
Remove Redundancy
Feb 28, 2025
0d7626d
Update the upstream analysis section in the web interface
Mar 6, 2025
5cbb8be
Update the upstream analysis function to return a tuple in the dataframe
Mar 7, 2025
d9b294c
Update the template for more precise results in upstream analysis
Mar 7, 2025
a199bd7
Simplify the sorting of q values
Mar 12, 2025
3ed039a
Update JavaScript to prevent re-initialization of Datatables
Mar 12, 2025
c9a2b10
Modify content from html to improve spacing
Mar 19, 2025
4109d1f
Clean improts
Mar 19, 2025
dcffd52
Remove extra tag
Mar 20, 2025
2a34f97
Organize the home page after rebase
Mar 20, 2025
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
68 changes: 68 additions & 0 deletions src/indra_cogex/analysis/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/env python3
import argparse
import logging
from datetime import datetime

from indra_cogex.analysis.source_targets_explanation import explain_downstream

logger = logging.getLogger(__name__)


def main():
"""Command line interface for running source-target analysis."""
parser = argparse.ArgumentParser(
description='Analyze mechanisms connecting source and target proteins using INDRA CoGEx.'
)
parser.add_argument('source',
help='Source gene symbol or HGNC ID')
parser.add_argument('targets',
nargs='+',
help='Target gene symbols or HGNC IDs')
parser.add_argument(
'--id-type',
choices=['hgnc.symbol', 'hgnc'],
default='hgnc.symbol',
help='Type of identifiers provided (default: hgnc.symbol)'
)
parser.add_argument(
'--output-dir',
default=None,
help='Directory to save results (default: creates timestamped directory)'
)
parser.add_argument(
'--log-level',
default='INFO',
choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
help='Set the logging level (default: INFO)'
)

args = parser.parse_args()

# Configure logging
logging.basicConfig(
level=getattr(logging, args.log_level),
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)

# Create output directory if not specified
if args.output_dir is None:
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
args.output_dir = f'analysis_results_{timestamp}'

try:
# Run the analysis using the existing explain_downstream function
explain_downstream(
args.source,
args.targets,
args.output_dir,
id_type=args.id_type
)
logger.info(f'Analysis results saved to {args.output_dir}')

except Exception as e:
logger.error(f'Analysis failed: {str(e)}')
raise


if __name__ == '__main__':
main()
Loading