# HG changeset patch # User peterjc # Date 1550848669 18000 # Node ID 077ab49169fd6a90b0e574b0ef99e2c9d385e6eb # Parent 8912199785fa44188da18342f3340d6879a88ded planemo upload for repository https://github.com/peterjc/pico_galaxy/tree/master/tools/predictnls commit d67596914a7bbe183851437eaafe8c7305877e5a-dirty diff -r 8912199785fa -r 077ab49169fd tools/predictnls/predictnls.py --- a/tools/predictnls/predictnls.py Fri Nov 09 10:58:26 2018 -0500 +++ b/tools/predictnls/predictnls.py Fri Feb 22 10:17:49 2019 -0500 @@ -65,14 +65,19 @@ fasta_filename, tabular_filename = sys.argv[1:] # Use os.path.realpath(...) to handle being called via a symlink # Try under subdirectory data: - re_filename = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), - "data", "My_NLS_list") + re_filename = os.path.join( + os.path.dirname(os.path.realpath(sys.argv[0])), "data", "My_NLS_list" + ) if not os.path.isfile(re_filename): # Try in same directory as this script: - re_filename = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), - "My_NLS_list") + re_filename = os.path.join( + os.path.dirname(os.path.realpath(sys.argv[0])), "My_NLS_list" + ) else: - sys.exit("Expect 2 or 3 arguments: input FASTA file, output tabular file, and NLS motif file") + sys.exit( + "Expect 2 or 3 arguments: input FASTA file, output tabular file, " + "and optionally NLS motif file." + ) if not os.path.isfile(fasta_filename): sys.exit("Could not find FASTA input file: %s" % fasta_filename) @@ -150,7 +155,10 @@ out_handle = sys.stdout else: out_handle = open(tabular_filename, "w") -out_handle.write("#ID\tNLS start\tNLS seq\tNLS pattern\tType\tProtCount\t%NucProt\tProtList\tProtLoci\n") +out_handle.write( + "#ID\tNLS start\tNLS seq\tNLS pattern\tType\t" + "ProtCount\t%NucProt\tProtList\tProtLoci\n" +) count = 0 nls = 0 for idn, seq in fasta_iterator(fasta_filename): @@ -161,10 +169,20 @@ # Perl predictnls v1.0.17 (and older) return NLS start position with zero # but changed to one based counting in v1.0.18 (June 2011) onwards, Bug #38 # We therefore also use one based couting, hence the start+1 here: - out_handle.write("%s\t%i\t%s\t%s\t%s\t%i\t%s\t%s\t%s\n" - % (idn, match.start() + 1, match.group(), - regex.pattern, evidence, p_count, - percent_nuc_prot, proteins, domains)) + out_handle.write( + "%s\t%i\t%s\t%s\t%s\t%i\t%s\t%s\t%s\n" + % ( + idn, + match.start() + 1, + match.group(), + regex.pattern, + evidence, + p_count, + percent_nuc_prot, + proteins, + domains, + ) + ) nls += 1 count += 1 if tabular_filename != "-":