helix ends

41 views
Skip to first unread message

Juha Huiskonen

unread,
Apr 22, 2016, 10:46:50 AM4/22/16
to emspring
Hi Carsten,

I didn't remove helix ends when I extracted the segments initially. Is there a way to remove them during refinement (e.g. by giving a list of segments to be used) or do I have to extract everything again and start refinement from beginning?

Best wishes,
Juha

Carsten Sachse

unread,
Apr 22, 2016, 10:57:05 AM4/22/16
to emspring
Dear Juha,

Unfortunately, there is no simple option to remove it at a later stage during refinement. However, you could of course exclude class averages that you may have calculated that present helix ends. You could also generate a segment list of the ends for exclusion. If none of this is applicable to your case, I would suggest to re-extract the segments.

Best wishes,


Carsten

Juha Huiskonen

unread,
Apr 22, 2016, 11:38:34 AM4/22/16
to emspring
Hi Carsten,

Thank you for your reply. I would like to generate a segment list. How can I do this? What is the format of the list if I have to create it myself?

Best wishes,
Juha

Carsten Sachse

unread,
Apr 25, 2016, 5:43:50 AM4/25/16
to emsp...@googlegroups.com
Dear Juha,

For a small data set you could do this manually by using the visualization tool SEGMENTPLOT. You could plot all your helices and generate a list of segments to be excluded. For large data sets, this is unpractical, and therefore I attach a small python script that pulls out the stack_ids of the starting and ending segments of a helix.

Usage: springenv python remove_helix_ends_list.py
Have a look at the header to update essential parameters.

Best wishes,


Carsten
-----------

# Author: Carsten Sachse 24-Apr-2016

"""

This python script creates a list of stack_ids based on removing the ends of each helical particle.

"""

#=======================================================================================================================

# input parameters to be edited:

#=======================================================================================================================

stepsize_in_A = 70

segment_size_A = 700

spring_db = 'spring.db'

segment_outfile = 'excluded_ends_stack_ids.dat'


#=======================================================================================================================

# actual script; no editing needed beyond this point

#=======================================================================================================================


from spring.csinfrastr.csdatabase import SpringDataBase, base, HelixTable, SegmentTable


class SpringHelixEnds(object):

    def remove_helix_ends(self, spring_db):

        session = SpringDataBase().setup_sqlite_db(base, spring_db)

        helices = session.query(HelixTable).order_by(HelixTable.id).all()

        helix_ids = [each_helix.id for each_helix in helices]

        

        f = open(segment_outfile, 'w')

        remove_end_count = int(round(0.5 * segment_size_A / stepsize_in_A))

        for each_helix_id in helix_ids:

            segments = session.query(SegmentTable).filter(SegmentTable.helix_id == each_helix_id).all()

            hel_stack_ids = [each_segment.stack_id for each_segment in segments]

                

            hel_stack_ids_included = hel_stack_ids[remove_end_count:-remove_end_count]

            hel_stack_ids_excluded = list(set(hel_stack_ids) - set(hel_stack_ids_included))


            f.write('{0}\n'.format('\n'.join([str(each_helix_id) for each_helix_id in hel_stack_ids_excluded])))

        

        f.close()



def main():

    

    se = SpringHelixEnds()

    se.remove_helix_ends(spring_db)



if __name__ == '__main__':

    main()

Reply all
Reply to author
Forward
0 new messages