Code Duplication    Length = 71-71 lines in 2 locations

rna_tools/tools/rna_calc_rmsd/rna_calc_rmsd.py 1 location

@@ 219-289 (lines=71) @@
216
217
    return round(kabsch_rmsd(P, Q),2), atomsP
218
219
def get_parser():
220
    import argparse
221
    class SmartFormatter(argparse.HelpFormatter):
222
        def _split_lines(self, text, width):
223
            if text.startswith('R|'):
224
                return text[2:].splitlines()  
225
            # this is the RawTextHelpFormatter._split_lines
226
            return argparse.HelpFormatter._split_lines(self, text, width)
227
228
    parser = argparse.ArgumentParser(description=__doc__, formatter_class=SmartFormatter)#formatter_class=argparse.RawDescriptionHelpFormatter)
229
230
    parser.add_argument('-t',"--target-fn",
231
                         default='', required = True,
232
                         help="pdb file")
233
234
    parser.add_argument('--ignore-files', help='files to be ingored, .e.g, \'solution\'', default='')
235
236
    parser.add_argument("--target-selection",
237
                            default='',
238
                         help="selection, e.g. A:10-16+20, where #16 residue is included")
239
240
    parser.add_argument("--target-ignore-selection",
241
                            default='',
242
                         help="A/10/O2\'")
243
244
    parser.add_argument("--model-selection",
245
                            default='',
246
                         help="selection, e.g. A:10-16+20, where #16 residue is included")
247
248
    parser.add_argument("--model-ignore-selection",
249
                            default='',
250
                         help="A/10/O2\'")
251
252
    parser.add_argument('-m', "--method",
253
                         default='all-atom-built-in',
254
                         help="align, fit")
255
256
    parser.add_argument('-o', "--rmsds-fn",
257
                         default='rmsds.csv',
258
                         help="ouput, matrix")
259
260
    parser.add_argument("-v", "--verbose", action="store_true",
261
                        help="verbose")
262
263
    parser.add_argument('-pr', '--print-results',
264
                         action="store_true")
265
266
    parser.add_argument('-sr', '--sort-results',
267
                         action="store_true")
268
269
    parser.add_argument('-pp', '--print-progress',
270
                         default=False,
271
                         action="store_true")
272
273
    parser.add_argument('--way', help="""R|c1p = C1'
274
backbone = P OP1 OP2 O5' C5' C4' C3' O3'
275
po = P OP1 OP2
276
no-backbone = all - po
277
bases, backbone+sugar, sugar
278
pooo = P OP1 OP2 O5'
279
alpha = P OP1 OP2 O5' C5'
280
""", default='all')
281
282
    parser.add_argument("--name-rmsd-column", help="default: fn,rmsd, with this cols will be fn,<name-rmsd-column>")
283
284
    parser.add_argument("--target-column-name", action="store_true",
285
                        help="")
286
287
    parser.add_argument('files', help='files', nargs='+')
288
289
    return parser
290
# main
291
if __name__ == '__main__':
292
    parser = get_parser()

rna_tools/tools/rna_calc_rmsd/rna_calc_rmsd_pymol.py 1 location

@@ 196-266 (lines=71) @@
193
194
    return round(kabsch_rmsd(P, Q, atoms),2), atomsP
195
196
def get_parser():
197
    import argparse
198
    class SmartFormatter(argparse.HelpFormatter):
199
        def _split_lines(self, text, width):
200
            if text.startswith('R|'):
201
                return text[2:].splitlines()  
202
            # this is the RawTextHelpFormatter._split_lines
203
            return argparse.HelpFormatter._split_lines(self, text, width)
204
205
    parser = argparse.ArgumentParser(description=__doc__, formatter_class=SmartFormatter)#formatter_class=argparse.RawDescriptionHelpFormatter)
206
207
    parser.add_argument('-t',"--target-fn",
208
                         default='', required = True,
209
                         help="pdb file")
210
211
    parser.add_argument('--ignore-files', help='files to be ingored, .e.g, \'solution\'', default='')
212
213
    parser.add_argument("--target-selection",
214
                            default='',
215
                         help="selection, e.g. A:10-16+20, where #16 residue is included")
216
217
    parser.add_argument("--target-ignore-selection",
218
                            default='',
219
                         help="A/10/O2\'")
220
221
    parser.add_argument("--model-selection",
222
                            default='',
223
                         help="selection, e.g. A:10-16+20, where #16 residue is included")
224
225
    parser.add_argument("--model-ignore-selection",
226
                            default='',
227
                         help="A/10/O2\'")
228
229
    parser.add_argument('-m', "--method",
230
                         default='all-atom-built-in',
231
                         help="align, fit")
232
233
    parser.add_argument('-o', "--rmsds-fn",
234
                         default='rmsds.csv',
235
                         help="ouput, matrix")
236
237
    parser.add_argument("-v", "--verbose", action="store_true",
238
                        help="verbose")
239
240
    parser.add_argument('-pr', '--print-results',
241
                         action="store_true")
242
243
    parser.add_argument('-sr', '--sort-results',
244
                         action="store_true")
245
246
    parser.add_argument('-pp', '--print-progress',
247
                         default=False,
248
                         action="store_true")
249
250
    parser.add_argument('--way', help="""R|c1p = C1'
251
backbone = P OP1 OP2 O5' C5' C4' C3' O3'
252
po = P OP1 OP2
253
no-backbone = all - po
254
bases, backbone+sugar, sugar
255
pooo = P OP1 OP2 O5'
256
alpha = P OP1 OP2 O5' C5'
257
""", default='all')
258
259
    parser.add_argument("--name-rmsd-column", help="default: fn,rmsd, with this cols will be fn,<name-rmsd-column>")
260
261
    parser.add_argument("--target-column-name", action="store_true",
262
                        help="")
263
264
    parser.add_argument('files', help='files', nargs='+')
265
266
    return parser
267
# main
268
if __name__ == '__main__':
269
    parser = get_parser()