# swap loc for uniprot, if specified
if dict_uniprot_map :
os_locus = dict_uniprot_map[os_locus]
- prj_locus = cols[1].rsplit("_",1)[0].rsplit(".",1)[0] # remove any isoform suffixes (i.e. '.#', '_T0#')
+ prj_locus = cols[1].rsplit("_",1)[0].rsplit(".",1)[0] # remove any isoform suffixes (i.e. '.#', '_T0#')
if os_locus in dict_inp_map :
dict_inp_map[os_locus].add(prj_locus)
else :
#----------------------------------------------------------------------------------------------------------------------
-def create_ens_map(filtering_loci_path, ensembl_input_path, rap_map_path, recip_id, dict_uniprot_map) :
+def create_ens_map(filtering_loci_path, ensembl_input_path, rap_map_path, recip_id, dict_uniprot_map, is_confident) :
#----------------------------------------------------------------------------------------------------------------------
"""
open the ensemble plants and rap::irgsp mapping files and generate a hash mapping of reference to projected loci where
# swap loc for uniprot, if specified
if dict_uniprot_map :
os_locus = dict_uniprot_map[os_locus]
- # reciprocal identity is >= recip_id%, high confidence
- if int(cols[2]) >= recip_id and int(cols[3]) >= recip_id and int(cols[4]) == 1 :
+ # reciprocal identity is >= recip_id%, optional high confidence
+ if int(cols[2]) >= recip_id and int(cols[3]) >= recip_id and int(cols[4]) >= is_confident :
if os_locus in dict_ens_map :
dict_ens_map[os_locus].add(cols[1])
else :
parser.add_argument('-i', '--inparanoid_input_path', help='inparanoid supercluster input file')
parser.add_argument('-m', '--rap_map_path', help='MSU-RAP mapping file')
parser.add_argument('-r', '--reciprocal_id', type=int, help='reciprocal identity percentage')
+parser.add_argument('-C', '--confidence_high', help='only use ensembl projections marked as high-confidence', action='store_true')
parser.add_argument('-u', '--uniprot_substitution', help='file path to UniProt substitution data for reference loci')
# TODO: add an "inparanoid super-cluster vs. conventional input" flag
# create projection maps
dict_inp_map = create_inp_map(args.inparanoid_input_path, dict_uniprot_map)
-dict_ens_map = create_ens_map(args.filtering_loci_path, args.ensembl_input_path, args.rap_map_path, args.reciprocal_id, dict_uniprot_map)
+dict_ens_map = create_ens_map(args.filtering_loci_path, args.ensembl_input_path, args.rap_map_path, args.reciprocal_id, dict_uniprot_map, 1 if args.confidence_high else 0)
# generate stats and output them
compare_maps(dict_ens_map, dict_inp_map, args.comparison_file_path, args.ensembl_output_path, args.inparanoid_output_path)