Code Duplication    Length = 24-31 lines in 6 locations

mandos/entries/entries.py 6 locations

@@ 854-884 (lines=31) @@
851
852
853
class EntryG2pInteractions(Entry[G2pInteractionSearch]):
854
    @classmethod
855
    def run(
856
        cls,
857
        path: Path = CommonArgs.compounds,
858
        key: str = EntryArgs.key("g2p:interactions"),
859
        to: Optional[Path] = CommonArgs.to_single,
860
        as_of: Optional[str] = CommonArgs.as_of,
861
        check: bool = EntryArgs.check,
862
        log: Optional[Path] = CommonArgs.log_path,
863
        quiet: bool = CommonArgs.quiet,
864
        verbose: bool = CommonArgs.verbose,
865
        no_setup: bool = CommonArgs.no_setup,
866
    ) -> Searcher:
867
        """
868
        Target interactions with affinities from Guide to Pharmacology.
869
870
        OBJECT: A molecular target
871
872
        PREDICATE: "agonism at", etc.
873
874
        OTHER COLUMNS:
875
876
            - affinity: log affinity value
877
            - measurement: e.g. pIC50
878
            - primary: whether it is the primary target of the drug
879
            - selective: whether it is selective for that target
880
            - endogenous: whether the interaction is endogenous
881
            - organism: e.g. 'human', 'pig'
882
        """
883
        built = G2pInteractionSearch(key, Apis.G2p)
884
        return cls._run(built, path, to, check, log, quiet, verbose, no_setup)
885
886
887
class EntryHmdbTissue(Entry[BioactivitySearch]):
@@ 824-850 (lines=27) @@
821
822
823
class EntryChemidPlusLd50(Entry[Ld50Search]):
824
    @classmethod
825
    def run(
826
        cls,
827
        path: Path = CommonArgs.compounds,
828
        key: str = EntryArgs.key("tox.chemidplus:ld50"),
829
        to: Optional[Path] = CommonArgs.to_single,
830
        as_of: Optional[str] = CommonArgs.as_of,
831
        check: bool = EntryArgs.check,
832
        log: Optional[Path] = CommonArgs.log_path,
833
        quiet: bool = CommonArgs.quiet,
834
        verbose: bool = CommonArgs.verbose,
835
        no_setup: bool = CommonArgs.no_setup,
836
    ) -> Searcher:
837
        """
838
        LD50 acute effects from ChemIDPlus.
839
840
        OBJECT: A dose in mg/kg (e.g. 3100)
841
842
        PREDICATE: "LD50 :: <route>" (e.g. "LD50 :: intravenous)
843
844
        OTHER COLUMNS:
845
846
            - organism: e.g. 'women', 'infant', 'men', 'human', 'dog', 'domestic animals - sheep and goats'
847
            - human: true or false
848
        """
849
        built = Ld50Search(key, Apis.Pubchem)
850
        return cls._run(built, path, to, check, log, quiet, verbose, no_setup)
851
852
853
class EntryG2pInteractions(Entry[G2pInteractionSearch]):
@@ 539-564 (lines=26) @@
536
537
538
class EntryPubchemCgi(Entry[CtdGeneSearch]):
539
    @classmethod
540
    def run(
541
        cls,
542
        path: Path = CommonArgs.compounds,
543
        key: str = EntryArgs.key("inter.ctd:gene"),
544
        as_of: Optional[str] = CommonArgs.as_of,
545
        to: Optional[Path] = CommonArgs.to_single,
546
        log: Optional[Path] = CommonArgs.log_path,
547
        check: bool = EntryArgs.check,
548
        quiet: bool = CommonArgs.quiet,
549
        verbose: bool = CommonArgs.verbose,
550
        no_setup: bool = CommonArgs.no_setup,
551
    ) -> Searcher:
552
        """
553
        Compound/gene interactions in the DGIDB.
554
555
        Drug Gene Interaction Database.
556
        Also see ``interact.dgidb:int``.
557
558
        OBJECT: Name of the gene
559
560
        PREDICATE: "compound/gene interaction"
561
562
        """
563
        built = CtdGeneSearch(key, Apis.Pubchem)
564
        return cls._run(built, path, to, check, log, quiet, verbose, no_setup)
565
566
567
class EntryDrugbankTarget(Entry[DrugbankTargetSearch]):
@@ 678-702 (lines=25) @@
675
676
677
class EntryDrugbankDdi(Entry[DrugbankDdiSearch]):
678
    @classmethod
679
    def run(
680
        cls,
681
        path: Path = CommonArgs.compounds,
682
        key: str = EntryArgs.key("inter.drugbank:ddi"),
683
        to: Optional[Path] = CommonArgs.to_single,
684
        as_of: Optional[str] = CommonArgs.as_of,
685
        check: bool = EntryArgs.check,
686
        log: Optional[Path] = CommonArgs.log_path,
687
        quiet: bool = CommonArgs.quiet,
688
        verbose: bool = CommonArgs.verbose,
689
        no_setup: bool = CommonArgs.no_setup,
690
    ) -> Searcher:
691
        """
692
        Drug/drug interactions listed by DrugBank.
693
694
        The 'description' column includes useful information about the interaction,
695
        such as diseases and whether a risk is increased or decreased.
696
697
        OBJECT: name of the drug (e.g. "ibuprofen")
698
699
        PREDICATE: "ddi"
700
        """
701
        built = DrugbankDdiSearch(key, Apis.Pubchem)
702
        return cls._run(built, path, to, check, log, quiet, verbose, no_setup)
703
704
705
class EntryPubchemAssay(Entry[BioactivitySearch]):
@@ 511-535 (lines=25) @@
508
509
510
class EntryPubchemDgi(Entry[DgiSearch]):
511
    @classmethod
512
    def run(
513
        cls,
514
        path: Path = CommonArgs.compounds,
515
        key: str = EntryArgs.key("inter.dgidb:gene"),
516
        to: Optional[Path] = CommonArgs.to_single,
517
        as_of: Optional[str] = CommonArgs.as_of,
518
        log: Optional[Path] = CommonArgs.log_path,
519
        check: bool = EntryArgs.check,
520
        quiet: bool = CommonArgs.quiet,
521
        verbose: bool = CommonArgs.verbose,
522
        no_setup: bool = CommonArgs.no_setup,
523
    ) -> Searcher:
524
        """
525
        Drug/gene interactions in the DGIDB.
526
527
        Drug Gene Interaction Database.
528
        Also see ``disease.dgidb:int``.
529
530
        OBJECT: Name of the gene
531
532
        PREDICATE: "interacts with gene"
533
        """
534
        built = DgiSearch(key, Apis.Pubchem)
535
        return cls._run(built, path, to, check, log, quiet, verbose, no_setup)
536
537
538
class EntryPubchemCgi(Entry[CtdGeneSearch]):
@@ 420-443 (lines=24) @@
417
418
419
class EntryPubchemDisease(Entry[DiseaseSearch]):
420
    @classmethod
421
    def run(
422
        cls,
423
        path: Path = CommonArgs.compounds,
424
        key: str = EntryArgs.key("disease.ctd:mesh"),
425
        to: Optional[Path] = CommonArgs.to_single,
426
        as_of: Optional[str] = CommonArgs.as_of,
427
        check: bool = EntryArgs.check,
428
        log: Optional[Path] = CommonArgs.log_path,
429
        quiet: bool = CommonArgs.quiet,
430
        verbose: bool = CommonArgs.verbose,
431
        no_setup: bool = CommonArgs.no_setup,
432
    ) -> Searcher:
433
        """
434
        Diseases in the CTD.
435
436
        Comparative Toxicogenomics Database.
437
438
        OBJECT: MeSH code of disease
439
440
        PREDICATE: "marker/mechanism evidence for" or "disease evidence for"
441
        """
442
        built = DiseaseSearch(key, Apis.Pubchem)
443
        return cls._run(built, path, to, check, log, quiet, verbose, no_setup)
444
445
446
class _EntryPubchemCoOccurrence(Entry[U], metaclass=abc.ABCMeta):