48
48
49
49
import conkit .command_line
50
50
import conkit .io
51
+ from conkit .io import DISTANCE_FILE_PARSERS
51
52
import conkit .plot
52
53
import conkit .plot .tools
53
54
@@ -325,6 +326,8 @@ def main(argv=None):
325
326
326
327
seq = conkit .io .read (args .seqfile , args .seqformat )[0 ]
327
328
con = conkit .io .read (args .confile , args .conformat )[0 ]
329
+ if args .conformat in DISTANCE_FILE_PARSERS .keys ():
330
+ con = con .as_contactmap ()
328
331
329
332
con .sequence = seq
330
333
con .set_sequence_register ()
@@ -335,6 +338,8 @@ def main(argv=None):
335
338
336
339
if args .otherfile :
337
340
other = conkit .io .read (args .otherfile , args .otherformat )[0 ]
341
+ if args .otherformat in DISTANCE_FILE_PARSERS .keys ():
342
+ other = other .as_contactmap ()
338
343
other .sequence = seq
339
344
other .set_sequence_register ()
340
345
other .remove_neighbors (min_distance = args .dtn , inplace = True )
@@ -344,15 +349,18 @@ def main(argv=None):
344
349
other_sliced = None
345
350
346
351
if args .reffile :
352
+ if args .refformat not in ["pdb" , "mmcif" ]:
353
+ msg = "The provided format {0} is not yet implemented for the reference flag" .format (args .refformat )
354
+ raise RuntimeError (msg )
355
+
347
356
if args .refid :
348
357
reference = conkit .io .read (args .reffile , args .refformat )[args .refid ]
349
358
else :
350
359
reference = conkit .io .read (args .reffile , args .refformat )[0 ]
351
360
352
- if args .refformat not in ["pdb" , "mmcif" ]:
353
- msg = "The provided format {0} is not yet implemented for the reference flag" .format (args .refformat )
354
- raise RuntimeError (msg )
355
-
361
+ reference = reference .as_contactmap ()
362
+ reference .sequence = seq
363
+ reference .set_sequence_register ()
356
364
con_matched = con_sliced .match (reference , match_other = True , renumber = True , remove_unmatched = True )
357
365
if other_sliced :
358
366
other_matched = other_sliced .match (reference , renumber = True , remove_unmatched = True )
@@ -393,6 +401,8 @@ def altloc_remove(cmap):
393
401
394
402
seq = conkit .io .read (args .seqfile , args .seqformat )[0 ]
395
403
con = conkit .io .read (args .confile , args .conformat )[0 ]
404
+ if args .conformat in DISTANCE_FILE_PARSERS :
405
+ con = con .as_contactmap ()
396
406
397
407
con .sequence = seq
398
408
con .set_sequence_register ()
@@ -407,9 +417,13 @@ def altloc_remove(cmap):
407
417
elif args .which == "covariance_validation" :
408
418
if args .pdbformat != 'pdb' :
409
419
raise ValueError ('Model file format can only be PDB' )
420
+ elif args .distformat not in DISTANCE_FILE_PARSERS .keys ():
421
+ raise ValueError ('Prediction file format can only be a distance file' )
422
+
410
423
sequence = conkit .io .read (args .seqfile , args .seqformat )[0 ]
411
424
if len (sequence ) < 5 :
412
425
raise ValueError ('Cannot validate a model with less than 5 residues' )
426
+
413
427
prediction = conkit .io .read (args .distfile , args .distformat )[0 ]
414
428
model = conkit .io .read (args .pdbfile , args .pdbformat )[0 ]
415
429
p = PDBParser ()
@@ -420,12 +434,17 @@ def altloc_remove(cmap):
420
434
figure_aspect_ratio = None
421
435
422
436
elif args .which == "distogram_heatmap" :
437
+ if args .distformat not in DISTANCE_FILE_PARSERS .keys ():
438
+ raise ValueError ('Prediction file format can only be a distance file' )
439
+
423
440
sequence = conkit .io .read (args .seqfile , args .seqformat )[0 ]
424
441
distogram = conkit .io .read (args .distfile , args .distformat )[0 ]
425
442
distogram .sequence = sequence
426
443
distogram .set_sequence_register ()
427
444
428
445
if args .otherfile :
446
+ if args .otherformat not in DISTANCE_FILE_PARSERS .keys ():
447
+ raise ValueError ('Other prediction file format can only be a distance file' )
429
448
other = conkit .io .read (args .otherfile , args .otherformat )[0 ]
430
449
other .sequence = sequence
431
450
other .set_sequence_register ()
@@ -439,12 +458,16 @@ def altloc_remove(cmap):
439
458
440
459
seq = conkit .io .read (args .seqfile , args .seqformat )[0 ]
441
460
con = conkit .io .read (args .confile , args .conformat )[0 ]
461
+ if args .conformat in DISTANCE_FILE_PARSERS :
462
+ con = con .as_contactmap ()
442
463
443
464
con .sequence = seq
444
465
con .set_sequence_register ()
445
466
446
467
if args .otherfile :
447
468
other = conkit .io .read (args .otherfile , args .otherformat )[0 ]
469
+ if args .otherformat in DISTANCE_FILE_PARSERS :
470
+ other = other .as_contactmap ()
448
471
other .sequence = seq
449
472
other .set_sequence_register ()
450
473
else :
@@ -460,6 +483,8 @@ def altloc_remove(cmap):
460
483
461
484
seq = conkit .io .read (args .seqfile , args .seqformat )[0 ]
462
485
con = conkit .io .read (args .confile , args .conformat )[0 ]
486
+ if args .conformat in DISTANCE_FILE_PARSERS :
487
+ con = con .as_contactmap ()
463
488
464
489
con .sequence = seq
465
490
con .set_sequence_register ()
@@ -482,6 +507,8 @@ def altloc_remove(cmap):
482
507
483
508
seq = conkit .io .read (args .seqfile , args .seqformat )[0 ]
484
509
con = conkit .io .read (args .confile , args .conformat )[0 ]
510
+ if args .conformat in DISTANCE_FILE_PARSERS :
511
+ con = con .as_contactmap ()
485
512
486
513
con .sequence = seq
487
514
con .set_sequence_register ()
@@ -492,6 +519,8 @@ def altloc_remove(cmap):
492
519
pdb = conkit .io .read (args .pdbfile , "pdb" )[args .pdbchain ]
493
520
else :
494
521
pdb = conkit .io .read (args .pdbfile , "pdb" )[0 ]
522
+
523
+ pdb = pdb .as_contactmap ()
495
524
con_matched = con .match (pdb , renumber = True , remove_unmatched = True )
496
525
497
526
figure = conkit .plot .PrecisionEvaluationFigure (
0 commit comments