GithubHelp home page GithubHelp logo

gf712 / abpytools Goto Github PK

View Code? Open in Web Editor NEW
23.0 2.0 3.0 915 KB

Python package for analysis of antibody heavy and light chains

Home Page: https://gf712.github.io/AbPyTools/

License: MIT License

Python 93.89% HTML 1.33% C++ 4.29% C 0.19% Shell 0.30%
antibody python antibody-sequences bioinformatics antibody-numbering

abpytools's People

Contributors

gf712 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

abpytools's Issues

No module named 'abpytools.core.formats.chain_pb2'

getting this error during install via pip or source:

======================================================================
ERROR: features_tests_composition (unittest.loader._FailedTest)

ImportError: Failed to import test module: features_tests_composition
Traceback (most recent call last):
File "/home/misha/anaconda3/lib/python3.7/unittest/loader.py", line 154, in loadTestsFromName
module = import(module_name)
File "/home/misha/internship_code/AbPyTools/tests/features_tests_composition.py", line 2, in
from abpytools import ChainCollection
File "/home/misha/internship_code/AbPyTools/abpytools/init.py", line 1, in
from .core import *
File "/home/misha/internship_code/AbPyTools/abpytools/core/init.py", line 4, in
from .chain_collection import ChainCollection
File "/home/misha/internship_code/AbPyTools/abpytools/core/chain_collection.py", line 18, in
from .utils import (json_ChainCollection_formatter, pb2_ChainCollection_formatter, pb2_ChainCollection_parser,
File "/home/misha/internship_code/AbPyTools/abpytools/core/utils.py", line 1, in
from abpytools.core.formats.utils import get_protobuf_numbering_scheme, get_numbering_scheme_from_protobuf
File "/home/misha/internship_code/AbPyTools/abpytools/core/formats/init.py", line 1, in
from .chain_pb2 import Chain as ChainProto
ModuleNotFoundError: No module named 'abpytools.core.formats.chain_pb2'

KeyError: 'X'

File "/home/misha/anaconda3/lib/python3.6/site-packages/abpytools/core/chain.py", line 71, in load_from_string
    new_chain.load()
  File "/home/misha/anaconda3/lib/python3.6/site-packages/abpytools/core/chain.py", line 92, in load
    self.load()
  File "/home/misha/anaconda3/lib/python3.6/site-packages/abpytools/core/chain.py", line 101, in load
    self.hydrophobicity_matrix = self.ab_hydrophobicity_matrix()
  File "/home/misha/anaconda3/lib/python3.6/site-packages/abpytools/core/chain.py", line 217, in ab_hydrophobicity_matrix
    sequence=self._sequence)
  File "/home/misha/anaconda3/lib/python3.6/site-packages/abpytools/core/chain.py", line 434, in calculate_hydrophobicity_matrix
    else 0 for x in whole_sequence])
  File "/home/misha/anaconda3/lib/python3.6/site-packages/abpytools/core/chain.py", line 434, in <listcomp>
    else 0 for x in whole_sequence])
KeyError: 'X'
We've got an error while stopping in post-mortem: <class 'KeyboardInterrupt'>

Error is thrown in code below:

def calculate_hydrophobicity_matrix(whole_sequence, numbering, aa_hydrophobicity_scores, sequence):
    # instantiate numpy array (whole sequence includes all the amino acid positions of the VH/VL, 
    # even the ones
    # that aren't occupied -> these will be filled with zeros
    # hydrophobicity_matrix = np.zeros(len(whole_sequence))
    # #
    # # # iterate through each position
    # for i, position in enumerate(whole_sequence):
    # 
    #     if position in numbering:
    #         position_in_data = numbering.index(position)
    #         hydrophobicity_matrix[i] = aa_hydrophobicity_scores[sequence[position_in_data]]

    #  return hydrophobicity_matrix
    # same thing as above but in a comprehension list
    return np.array([aa_hydrophobicity_scores[sequence[numbering.index(x)]] if x in numbering
                     else 0 for x in whole_sequence])

seems that your "comprehension list" approach contains a bug

Chain.load_from_string() sometimes doesn't load in the for loop

I have next code:

 for sequence_alignment in sequences:
    chain = Chain.load_from_string(sequence=sequence_alignment)
    cdrs = dict()
    try:
      for cdr_name, cdr_indexes in chain.cdr[0].items():
        cdrs[cdr_name] = sequence_alignment[cdr_indexes[0]:(cdr_indexes[-1] + 1)]
    except Exception as error:
         time.sleep(0.1)
         if chain.cdr == None:
            print("ERROR::", error)

And sometimes it prints error, which indicates that cdrs not loaded, But I called the load function! Seems some concurrency issues in your lib.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.