Skip to content

Commit

Permalink
Merge pull request #24 from CapraLab/NeanderthalFixes
Browse files Browse the repository at this point in the history
Misc tweaks to pdbmap library
  • Loading branch information
ChrisMoth authored Jun 16, 2021
2 parents 148658e + d2f6292 commit 15cd617
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/PDBMapProtein.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def load_idmapping(cls, idmapping_fname):
hgnc = dbid # for clarity
PDBMapProtein._unp2hgnc[unp] = hgnc
PDBMapProtein._hgnc2unp[hgnc] = unp
elif db == "Gene_ID":
elif db == "GeneID":
gene_id = dbid # for clarity
PDBMapProtein._unp2gene_id[unp] = gene_id
elif db == "Ensembl_TRS":
Expand Down
14 changes: 14 additions & 0 deletions lib/PDBMapTranscriptBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ def describe_transcript_differences(t1,t2):
return differences


@staticmethod
def analyze_transcript_differences(t1,t2):
"""Return # of single point variants, and percent of mismatches, between 2 PDBMapTranscripts"""
if len(t1.aa_seq) != len(t2.aa_seq):
# If transcripts are not the same length, return the longer length, and 100% mismatch
return max(len(t1.aa_seq),len(t2.aa_seq)),1.0

differences = 0
for tpos in range(len(t1.aa_seq)):
if t1.aa_seq[tpos] != t2.aa_seq[tpos]:
differences += 1
return differences,float(differences)/float(len(t1.aa_seq))


# Main check
if __name__== "__main__":
LOGGER.critical("Class definition. Should not be called from command line.")
Expand Down

0 comments on commit 15cd617

Please sign in to comment.