-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial release for Pip and BioConda
- Loading branch information
Showing
13 changed files
with
91 additions
and
81 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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
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
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
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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
See README.md @ https://github.com/clinte14/correlogy | ||
See README.md @ https://github.com/clinte14/GeneCoOccurrence | ||
Contact: [email protected] or [email protected] | ||
""" | ||
# Fixing text so it's not cutoff on the heatmap is on my to do list as well | ||
# Fix log to show actual command line entry, not a list | ||
import sys | ||
import os | ||
import shutil | ||
import pandas as pd | ||
from housekeeping import create_folders, parse_flags, save_flags, convert_protID_to_common_names | ||
from blast_parse import parse_merge_BLAST, create_pa, clean_BLAST_xml | ||
|
@@ -17,49 +22,37 @@ def main(): | |
|
||
# Create folders for project in path defined by -o flag. Default is current directory. | ||
create_folders(flag_values['output']) | ||
|
||
# Save/record flags options and paramaters to "command.txt" file in 00_settings folder | ||
# Save/record flags options and parameters to "command.txt" file in 00_settings folder | ||
save_flags(flag_values) | ||
|
||
''' | ||
Bug workaround for NCBIWWW. Occasionally NCBI BLAST online writes 'CREATE_VIEW' into | ||
the BLAST .xml output with no associated '<>' tags, and this causes xml parsing in | ||
Biopython to fail. See: https://github.com/biopython/biopython/issues/3342 | ||
''' | ||
clean_BLAST_xml(flag_values) | ||
|
||
# Parse XML files located in 01_BLAST_results folder. | ||
hits = parse_merge_BLAST(flag_values) | ||
if flag_values['input'].split('.')[-1]=='xml': | ||
# Parse XML files located in 01_BLAST_results folder. | ||
hits = parse_merge_BLAST(flag_values) | ||
|
||
|
||
# Converts BLAST query protein ID's to common gene names using .csv if -c flag was invoked. | ||
convert_protID_to_common_names(flag_values, hits) | ||
# Converts BLAST query protein ID's to common gene names using .csv if -c flag was invoked. | ||
convert_protID_to_common_names(flag_values, hits) | ||
|
||
#write hits dictionary to Pandas DF, query gene is column and hits are rows. Write dataframe to 02_PA_matrix | ||
#folder as PA_matrix.csv. | ||
create_pa(hits, flag_values) | ||
#write hits dictionary to Pandas DF, query gene is column and hits are rows. Write dataframe to 02_PA_matrix | ||
#folder as PA_matrix.csv. | ||
create_pa(hits, flag_values) | ||
|
||
elif flag_values['input'].split('.')[-1]=='csv': | ||
|
||
pa_dir = os.path.join(flag_values['output'] ,'01_PA_matrix','pa_matrix.csv') | ||
shutil.copyfile(flag_values['input'],pa_dir) | ||
print(" --->Copied custom matrix '{}' to '{}'".format(flag_values['input'],pa_dir + '\n')) | ||
|
||
else: | ||
print("FATAL ERROR. Input must be either BLAST formatted '.xml' file or comma-seperated presence/absence '.csv' file") | ||
sys.exit(0) | ||
|
||
#calculate Cij (# species common to gene i & j), Rij (Pearson Correlation) | ||
#and Wij (Partial Correlation) | ||
Wij_df= correlation_calcs(flag_values) | ||
Wij_df = correlation_calcs(flag_values) | ||
network_list = calc_mrs(Wij_df, flag_values) | ||
|
||
create_network_map(flag_values, network_list) | ||
create_heatmap(Wij_df, flag_values) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
|
||
''' | ||
To do: | ||
In command.txt add full keyboard input command | ||
In command.txt clean up writing of input, output, -c file | ||
Copy .xml input file to 01 folder | ||
For two nodes that point to each other, only show one correlog score | ||
In MRS visuals: Add color that corresponds with heatmap colors/ improve edge thickness | ||
Clean up notes to PEP-8 standard | ||
Add help info for each function | ||
Standardize output text | ||
Print statements relating to graphical MRS creation/generation | ||
''' | ||
main() |