Python Forum
Python: Returning the most frequently occurring substring in a larger string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python: Returning the most frequently occurring substring in a larger string
#1
How can I find the most frequently occurring sub-string in a larger string?

For example if the string 'gactctcagc' is provided, the program will return 'ctc' as it occurs twice in the string (including overlap). 'ct' and 'tc' also occur twice, but the longest string gets priority. I want to be able to account for substrings from 2-6 characters.
Reply


Messages In This Thread
Python: Returning the most frequently occurring substring in a larger string - by sskkddrit - Feb-09-2018, 06:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Finding how many times substring is in a string using re module ranbarr 4 2,969 May-21-2021, 06:14 PM
Last Post: nilamo
  Returning data from a pyobjc object to python environment newpythonuser100 3 2,420 Jul-28-2020, 12:08 PM
Last Post: newpythonuser100
  Substring in a string Propoganda 1 2,231 Dec-01-2019, 08:45 AM
Last Post: perfringo
  Find a substring in a dictonary; value substring of key aapurdel 2 7,073 May-31-2019, 06:14 PM
Last Post: ichabod801
  [Discussion] Re. Substring counting Mekire 9 5,303 Jan-22-2018, 01:56 PM
Last Post: wavic
  array replace with 1 when larger than 1 metalray 1 2,606 Nov-01-2017, 07:25 PM
Last Post: Mekire

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020