Hi all, I have some code (attached) that is triggering a segfault in coot, and I can’t figure out why. I’m trying to first grab raw sequences from a fasta file, and assign each sequence to a dictionary - that part works fine.
Then I want to iterate through the dictionary, checking if each sequence matches a chain in the PDB file, and if so, adding it to a new dictionary using the same key as was used for the sequence dictionary (so I can then pass the appropriate bits and pieces to align_and_mutate()). That part causes coot to crash with the following error: /usr/local/bin/coot: line 10: 20005 Segmentation fault: 11 /Library/Coot/bin/coot-real "$@“ When I restart coot after this, the GUI is unresponsive and whited-out - I have to restart the terminal session before it behaves normally again. Anyone have an idea what I’m doing wrong in the script? It still fails if I omit the last two lines, so it’s not the last if statement… I’m using r4867 on Mac OS X 10.9. Oliver.
import re def get_seqs_from_fasta(fasta_file): with open(fasta_file) as fp: i=0 raw_seqs_from_file={} for result in re.findall('(>(.*?\n))(.*?)(>(.*?\n))', fp.read(), re.S): raw_seqs_from_file[i]=str(result[2]).replace("\n","").upper() i=i+1 return raw_seqs_from_file raw_seqs_from_file=get_seqs_from_fasta("protein_seqs.txt") chain_id_best={} for key in sorted(raw_seqs_from_file): seq=str(raw_seqs_from_file[key]) out=align_to_closest_chain(seq,0.95) print out if type(out) is list: #If matched, assign chain to dictionary chain_id_best[key]=str(out[1]) #chain_id_best using same key as for raw_seqs_from_file
On Dec 31, 2013, at 11:45 AM, Paul Emsley <pems...@mrc-lmb.cam.ac.uk> wrote: > On 31/12/13 16:31, Oliver Clarke wrote: > >> >> Another note - what is active_atom_spec() supposed to do? I guessed it was >> an equivalent of active_residue() but returning the specific atom rather >> than the CA, > > That's right. > >> but it returns this when called: >> >> _90ac6c78c97f0000_p_std__pairT_bool_std__pairT_int_coot__atom_spec_t_t_t >> >> While pushing the following to the console: >> BL INFO:: command input is: active_atom_spec() >> BL INFO:: result is <Swig Object of type 'std::pair< bool,std::pair< >> int,coot::atom_spec_t > > *' at 0x10c8cda50> >> swig/python detected a memory leak of type 'std::pair< bool,std::pair< >> int,coot::atom_spec_t > > *', no destructor found. >> > > You understand that Python is not my preferred language, so I don't use it > much. Now you are poking at the limits of my understanding. This does look > bad though. I'll take a look - it might be a SWIG (version) problem. > > Paul. >