1818from .tRNAmap import mainAlign
1919from .getCoverage import getCoverage , plotCoverage
2020from .mmQuant import generateModsTable , plotCCA
21+ from .crosstalks import crosstalks_wrapper
2122from .ssAlign import structureParser , modContext
2223from .splitClusters import splitIsodecoder , unsplitClustersCov , getIsodecoderSizes , getDeconvSizes , writeDeconvTranscripts , writeIsodecoderTranscripts , writeSplitInfo , writeIsodecoderInfo
2324import sys , os , subprocess , logging , datetime , copy
@@ -49,7 +50,7 @@ def restrictedFloat2(x):
4950 raise argparse .ArgumentTypeError ('{} not a real number' .format (x ))
5051
5152def mimseq (trnas , trnaout , name , species , out , cluster , cluster_id , cov_diff , posttrans , control_cond , threads , max_multi , snp_tolerance , \
52- keep_temp , cca , double_cca , min_cov , mismatches , remap , remap_mismatches , misinc_thresh , mito_trnas , plastid_trnas , pretrnas , local_mod , p_adj , sample_data ):
53+ keep_temp , cca , double_cca , min_cov , mismatches , remap , remap_mismatches , misinc_thresh , mito_trnas , plastid_trnas , pretrnas , local_mod , p_adj , crosstalks , sample_data ):
5354
5455# Main wrapper
5556 # Integrity check for output folder argument...
@@ -129,7 +130,7 @@ def mimseq(trnas, trnaout, name, species, out, cluster, cluster_id, cov_diff, po
129130
130131 # if remap and snp_tolerance are enabled, skip further analyses, find new mods, and redo alignment and coverage
131132 if remap and (snp_tolerance or not mismatches == 0.0 ):
132- new_mods , new_Inosines , filtered_cov , filter_warning , unsplitCluster_lookup ,readRef_unsplit_newNames = generateModsTable (coverageData , out , name , threads , min_cov , mismatch_dict , insert_dict , del_dict , cluster_dict , cca , remap , misinc_thresh , mod_lists , Inosine_lists , tRNA_dict , Inosine_clusters , unique_isodecoderMMs_new , splitBool_new , isodecoder_sizes , unsplitCluster_lookup , cluster )
133+ new_mods , new_Inosines , filtered_cov , filter_warning , unsplitCluster_lookup ,readRef_unsplit_newNames = generateModsTable (coverageData , out , name , threads , min_cov , mismatch_dict , insert_dict , del_dict , cluster_dict , cca , remap , misinc_thresh , mod_lists , Inosine_lists , tRNA_dict , Inosine_clusters , unique_isodecoderMMs_new , splitBool_new , isodecoder_sizes , unsplitCluster_lookup , cluster , crosstalks )
133134 Inosine_clusters , snp_tolerance , newtRNA_dict , new_mod_lists , new_inosine_lists = newModsParser (out , name , new_mods , new_Inosines , mod_lists , Inosine_lists , tRNA_dict , cluster , remap , snp_tolerance )
134135 map_round = 2
135136 genome_index_path , genome_index_name , snp_index_path , snp_index_name = generateGSNAPIndices (species , name , out , map_round , snp_tolerance , cluster )
@@ -152,9 +153,15 @@ def mimseq(trnas, trnaout, name, species, out, cluster, cluster_id, cov_diff, po
152153 filtered_cov = list ()
153154 if snp_tolerance or not mismatches == 0.0 :
154155 if 'newtRNA_dict' in locals ():
155- new_mods , new_Inosines , filtered_cov , filter_warning , unsplitCluster_lookup ,readRef_unsplit_newNames = generateModsTable (coverageData , out , name , threads , min_cov , mismatch_dict , insert_dict , del_dict , cluster_dict , cca , remap , misinc_thresh , new_mod_lists , Inosine_lists , newtRNA_dict , Inosine_clusters , unique_isodecoderMMs_new , splitBool_new , isodecoder_sizes , unsplitCluster_lookup , cluster )
156+ new_mods , new_Inosines , filtered_cov , filter_warning , unsplitCluster_lookup ,readRef_unsplit_newNames = generateModsTable (coverageData , out , name , threads , min_cov , mismatch_dict , insert_dict , del_dict , cluster_dict , cca , remap , misinc_thresh , new_mod_lists , Inosine_lists , newtRNA_dict , Inosine_clusters , unique_isodecoderMMs_new , splitBool_new , isodecoder_sizes , unsplitCluster_lookup , cluster , crosstalks )
156157 else :
157- new_mods , new_Inosines , filtered_cov , filter_warning , unsplitCluster_lookup , readRef_unsplit_newNames = generateModsTable (coverageData , out , name , threads , min_cov , mismatch_dict , insert_dict , del_dict , cluster_dict , cca , remap , misinc_thresh , mod_lists , Inosine_lists , tRNA_dict , Inosine_clusters , unique_isodecoderMMs_new , splitBool_new , isodecoder_sizes , unsplitCluster_lookup , cluster )
158+ new_mods , new_Inosines , filtered_cov , filter_warning , unsplitCluster_lookup , readRef_unsplit_newNames = generateModsTable (coverageData , out , name , threads , min_cov , mismatch_dict , insert_dict , del_dict , cluster_dict , cca , remap , misinc_thresh , mod_lists , Inosine_lists , tRNA_dict , Inosine_clusters , unique_isodecoderMMs_new , splitBool_new , isodecoder_sizes , unsplitCluster_lookup , cluster , crosstalks )
159+
160+ if crosstalks :
161+ # Crosstalks analysis
162+ log .info ("Analyzing crosstalks between pairs of modifications and modification-charging..." )
163+ crosstalks_wrapper (out + "single_read_data" , misinc_thresh , threads )
164+
158165 else :
159166 log .info ("*** Misincorporation analysis not possible; either --snp-tolerance must be enabled, or --max-mismatches must not be 0! ***\n " )
160167
@@ -267,6 +274,8 @@ def main():
267274 help = "Adjusted p-value threshold for DESeq2 pairwise condition differential epxression dot plots. \
268275 tRNAs with DESeq2 adjusted p-values equal to or below this value will be displayed as green or orange triangles for up- or down-regulated tRNAs, respectively. \
269276 Default p-adj <= 0.05" )
277+ options .add_argument ('--crosstalks' , required = False , dest = 'crosstalks' , action = "store_true" ,\
278+ help = "Enable analysis of crosstalks between pairs of modifications and modification-charging. Full details of this method in: https://doi.org/10.1093/nar/gkac1185" )
270279
271280 align = parser .add_argument_group ("GSNAP alignment options" )
272281 align .add_argument ('--max-mismatches' , metavar = 'allowed mismatches' , required = False , dest = 'mismatches' , type = float , \
@@ -408,7 +417,7 @@ def main():
408417 mimseq (args .trnas , args .trnaout , args .name , args .species , args .out , args .cluster , args .cluster_id , args .cov_diff , \
409418 args .posttrans , args .control_cond , args .threads , args .max_multi , args .snp_tolerance , \
410419 args .keep_temp , args .cca , args .double_cca , args .min_cov , args .mismatches , args .remap , args .remap_mismatches , \
411- args .misinc_thresh , args .mito , args .plastid , args .pretrnas , args .local_mod , args .p_adj , args .sampledata )
420+ args .misinc_thresh , args .mito , args .plastid , args .pretrnas , args .local_mod , args .p_adj , args .crosstalks , args . sampledata )
412421
413422if __name__ == '__main__' :
414423 main ()
0 commit comments