Skip to content

Commit

Permalink
another hotfix for a rare aligned insertions bug
Browse files Browse the repository at this point in the history
  • Loading branch information
felbecker committed Jun 14, 2023
1 parent a72c6b9 commit 39c5c1d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion learnMSA/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.3"
__version__ = "1.2.4"
9 changes: 5 additions & 4 deletions learnMSA/msa_hmm/AlignInsertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ def find_long_insertions_and_write_slice(fasta_file, lens, starts, name, directo
"""
at_least_t = lens >= t
lengths = lens[at_least_t]
if lengths.size > k:
if verbose:
print(f"Long insertions found at {name}: {lengths.size}.")
if lengths.size > 1:
which = np.squeeze(np.argwhere(at_least_t))
start = starts[at_least_t]
filename = f"{directory}/slice_{name}"
Expand All @@ -38,7 +36,10 @@ def find_long_insertions_and_write_slice(fasta_file, lens, starts, name, directo
slice_file.write(">"+fasta_file.seq_ids[which[j]]+"\n")
slice_file.write(segment+"\n")
which = np.delete(which, to_delete)
return (which, filename)
if which.size > k:
if verbose:
print(f"Long insertions found at {name}: {which.size}.")
return (which, filename)


def make_aligned_insertions(am, directory, method="famsa", threads=0, verbose=True):
Expand Down
24 changes: 12 additions & 12 deletions test/data/egf.out.fasta
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
>1ixa
..vdgdqCESN...PCLNGGSC..-..KD...DIN..S.YECWCPFGFEGKNcel....................
..vdgdqCESN...PCLNGGSCK.--.DDIN..S.YECWCPFGFEGKNcel....................
>1apo
..kdgdqCEGH...PCLNQGHC..-..KD...GIG..D.YTCTCAEGFEGKNcefstr.................
..kdgdqCEGH...PCLNQGHCK.--.DGIG..D.YTCTCAEGFEGKNcefstr.................
>1urk
......qVPSNc..DCLNGGTC..-..VSnkyFSN..I.HWCNCPKKFGGQHceidk..................
.......QVPSnc.DCLNGGTCVsNK.-YFS..NiHWCNCPKKFGGQHceidk..................
>1fsb
....tasCQDM...SCSKQGEC..-..LE...TIG..N.YTCSCYPGFYGPEceyvre.................
....tasCQDM...SCSKQGECL.--.ETIG..N.YTCSCYPGFYGPEceyvre.................
>1esl
......aCTNT...SCSGHGEC..-..VE...TIN..N.YTCKCDPGFSGLKceqiv..................
......aCTNT...SCSGHGECV.--.ETIN..N.YTCKCDPGFSGLKceqiv..................
>1hre
gtshlvkCAEKektFCVNGGEC..FmvKD...LSNpsR.YLCKCQPGFTGARctenvpmkvqnqekaeelyqk..
gtshlvkCAEKektFCVNGGECF.MVkDLSNpsR.YLCKCQPGFTGARctenvpmkvqnqekaeelyqk..
>1epi
..nsypgCPSSydgYCLNGGVC..Mh.IE...SLD..S.YTCNCVIGYSGDRcqtrdlrwwelr...........
..nsypgCPSSydgYCLNGGVCM.HI.ESLD..S.YTCNCVIGYSGDRcqtrdlrwwelr...........
>4tgf
vvshfndCPDShtqFCFH-GTCrfL..-V...QED..K.PACVCHSGYVGARcehadlla...............
vvshfndCPDShtqFCFH-GTCRfLV.-QED..K.PACVCHSGYVGARcehadlla...............
>1hcgb
.......CSLD...NGDCDQFC..-..HE...EQN..S.VVCSCARGYTLADngkaciptgpypcgkqtler...
.......CSLD...NGDCDQFCH.--.EEQN..S.VVCSCARGYTLADngkaciptgpypcgkqtler...
>1dan1
....gdqCASS...PCQNGGSC..-..KD...QLQ..S.YICFCLPAFEGRNcethkd.................
....gdqCASS...PCQNGGSCK.--.DQLQ..S.YICFCLPAFEGRNcethkd.................
>1dan2
...dqliCVNE...NGGCEQYC..-..SD...HTG..TkRSCRCHEGYSLLAdgvsctptveypcgkipile...
...dqliCVNE...NGGCEQYCS.--.DHTG..TkRSCRCHEGYSLLAdgvsctptveypcgkipile...
>1rfnb
.....mtCNIK...NGRCEQFC..-..KN...SAD..NkVVCSCTEGYRLAEnqkscepavpfpcgrvsvsqtsk
.....mtCNIK...NGRCEQFCK.NS.-ADN..K.VVCSCTEGYRLAEnqkscepavpfpcgrvsvsqtsk

0 comments on commit 39c5c1d

Please sign in to comment.