Mercurial > repos > drosofff > blast_to_scaffold
comparison blast_to_scaffold.py @ 3:e279e53a3fde draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/blast_to_scaffold commit 030207144f0811822dbdda9a10e036ff8e794d7c
author | drosofff |
---|---|
date | Fri, 25 Mar 2016 19:14:20 -0400 |
parents | 61731b911f4e |
children | 3288cc5a57e5 |
comparison
equal
deleted
inserted
replaced
2:61731b911f4e | 3:e279e53a3fde |
---|---|
28 '--guideSequence', action="store", type=str, help="the reference sequence to guide the scaffold assembly in fasta format") | 28 '--guideSequence', action="store", type=str, help="the reference sequence to guide the scaffold assembly in fasta format") |
29 the_parser.add_argument( | 29 the_parser.add_argument( |
30 '--blast-tab', dest="blast_tab", action="store", type=str, help="13-columns tabular blastn or tblastx output") | 30 '--blast-tab', dest="blast_tab", action="store", type=str, help="13-columns tabular blastn or tblastx output") |
31 the_parser.add_argument( | 31 the_parser.add_argument( |
32 '--output', action="store", type=str, help="output file path, fasta format") | 32 '--output', action="store", type=str, help="output file path, fasta format") |
33 the_parser.add_argument( | |
34 '--scaffold_prefix', action="store", type=str, help="the prefix that will be used for the header of the fasta scaffold") | |
35 the_parser.add_argument( | |
36 '--scaffold_suffix', action="store", type=str, help="the sufix that will be used for the header of the fasta scaffold") | |
37 args = the_parser.parse_args() | 33 args = the_parser.parse_args() |
38 return args | 34 return args |
39 | 35 |
40 def blatnInfo (file): | 36 def blatnInfo (file): |
41 blastlist = [] | 37 blastlist = [] |
100 except KeyError: | 96 except KeyError: |
101 continue | 97 continue |
102 for i, nucleotide in enumerate(sequence): | 98 for i, nucleotide in enumerate(sequence): |
103 GuideDict[i+subjectStart] = nucleotide | 99 GuideDict[i+subjectStart] = nucleotide |
104 | 100 |
105 def finalAssembly (GuideDict, outputfile, prefix, suffix): | 101 def finalAssembly (GuideDict, outputfile): |
106 finalSeqList = [] | 102 finalSeqList = [] |
107 for keys in sorted(GuideDict): | 103 for keys in sorted(GuideDict): |
108 finalSeqList.append(GuideDict[keys]) | 104 finalSeqList.append(GuideDict[keys]) |
109 finalSequence = insert_newlines("".join(finalSeqList) ) | 105 finalSequence = insert_newlines("".join(finalSeqList) ) |
110 Out = open (outputfile, "w") | 106 Out = open (outputfile, "w") |
111 print >> Out, ">Scaffold_from_%s_guided_by_%s" % (prefix, suffix) | 107 print >> Out, ">Scaffold" |
112 print >> Out, finalSequence | 108 print >> Out, finalSequence |
113 Out.close() | 109 Out.close() |
114 | 110 |
115 def __main__(): | 111 def __main__(): |
116 args = Parser() | 112 args = Parser() |
117 ContigsDict = myContigs (args.sequences) | 113 ContigsDict = myContigs (args.sequences) |
118 GuideDict = myGuide (args.guideSequence) | 114 GuideDict = myGuide (args.guideSequence) |
119 blastlist = blatnInfo(args.blast_tab) | 115 blastlist = blatnInfo(args.blast_tab) |
120 updateGuide(blastlist, GuideDict, ContigsDict) | 116 updateGuide(blastlist, GuideDict, ContigsDict) |
121 finalAssembly(GuideDict, args.output, args.scaffold_prefix, args.scaffold_suffix) | 117 finalAssembly(GuideDict, args.output) |
122 | 118 |
123 if __name__ == "__main__": | 119 if __name__ == "__main__": |
124 __main__() | 120 __main__() |