Mercurial > repos > drosofff > blast_to_scaffold
comparison blast_to_scaffold.py @ 2:61731b911f4e draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/blast_to_scaffold commit e67f150062f2076d0879bcdd3376ef53ba639d91
author | drosofff |
---|---|
date | Fri, 25 Mar 2016 17:01:52 -0400 |
parents | 7fb07a6ab968 |
children | e279e53a3fde |
comparison
equal
deleted
inserted
replaced
1:35e2e6452cf7 | 2:61731b911f4e |
---|---|
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") | |
33 args = the_parser.parse_args() | 37 args = the_parser.parse_args() |
34 return args | 38 return args |
35 | 39 |
36 def blatnInfo (file): | 40 def blatnInfo (file): |
37 blastlist = [] | 41 blastlist = [] |
96 except KeyError: | 100 except KeyError: |
97 continue | 101 continue |
98 for i, nucleotide in enumerate(sequence): | 102 for i, nucleotide in enumerate(sequence): |
99 GuideDict[i+subjectStart] = nucleotide | 103 GuideDict[i+subjectStart] = nucleotide |
100 | 104 |
101 def finalAssembly (GuideDict, outputfile): | 105 def finalAssembly (GuideDict, outputfile, prefix, suffix): |
102 finalSeqList = [] | 106 finalSeqList = [] |
103 for keys in sorted(GuideDict): | 107 for keys in sorted(GuideDict): |
104 finalSeqList.append(GuideDict[keys]) | 108 finalSeqList.append(GuideDict[keys]) |
105 finalSequence = insert_newlines("".join(finalSeqList) ) | 109 finalSequence = insert_newlines("".join(finalSeqList) ) |
106 Out = open (outputfile, "w") | 110 Out = open (outputfile, "w") |
107 print >> Out, ">Scaffold" | 111 print >> Out, ">Scaffold_from_%s_guided_by_%s" % (prefix, suffix) |
108 print >> Out, finalSequence | 112 print >> Out, finalSequence |
109 Out.close() | 113 Out.close() |
110 | 114 |
111 def __main__(): | 115 def __main__(): |
112 args = Parser() | 116 args = Parser() |
113 ContigsDict = myContigs (args.sequences) | 117 ContigsDict = myContigs (args.sequences) |
114 GuideDict = myGuide (args.guideSequence) | 118 GuideDict = myGuide (args.guideSequence) |
115 blastlist = blatnInfo(args.blast_tab) | 119 blastlist = blatnInfo(args.blast_tab) |
116 updateGuide(blastlist, GuideDict, ContigsDict) | 120 updateGuide(blastlist, GuideDict, ContigsDict) |
117 finalAssembly(GuideDict, args.output) | 121 finalAssembly(GuideDict, args.output, args.scaffold_prefix, args.scaffold_suffix) |
118 | 122 |
119 if __name__ == "__main__": | 123 if __name__ == "__main__": |
120 __main__() | 124 __main__() |