Community
    • Login

    I need to cut a text in a certain position which is always different

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 731 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Veronica BalanV
      Veronica Balan
      last edited by Veronica Balan

      I have a file with 1000+lines, without a space between characters so that means it is a string text
      I need to cut that text in a certain position, which is always different
      Example file:
      actaggataagatatagatagatgatagatacccatacacatgctacgacatcagcactacgacatcgacatcactatctatctactagctacatctagcta
      My wish:
      gene_1 is located from 1 to 4 (nucleotides - each of these letters - a, c, g, t)
      so I need to store or just show it:
      gene_1 = acta
      I have a lot of such genes, is there any expression which would help me to make a working program in notepad++?

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        @Veronica-Balan: welcome to the Notepad++ Community Forums

        You said:

        I need to cut that text in a certain position, which is always different
        …
        I have a lot of such genes, is there any expression which would help me to make a working program in notepad++?

        Since it’s always different, and you gave us no criteria, it would be hard to offer a solution.

        I mean, if you wanted the first four characters of a given line, and wanted to throw away everything else, you could do a regular expression search/replace: search = ^(....).*, replace gene_1 = $1. But since it’s “always different”, that would have to be customized every time

        Note: this task smells of something that will be modified slightly very many times. You probably want to automate it in a full-fledged programming language. Some would recommend Python (especially since you could use the PythonScript plugin, to have the python work directly on whatever file you have opened in Notepad++).

        But I know that among genetics manipulations, there’s still a strong Perl community, using the BioPerl tool (https://bioperl.org/). If you’re going to be doing much genetic text manipulation, I would highly recommend going that route. BioPerl has a mailing list for help; and if you need help with the Perl, the Perl Monks site is a good place to go (as long as you shown an effort, rather than asking the Monks to do your homework for you).

        Veronica BalanV 1 Reply Last reply Reply Quote 4
        • Veronica BalanV
          Veronica Balan @PeterJones
          last edited by

          @PeterJones thank you, I will check it too, and yes, I use perl for that manipulation
          I have some ideas about how to solve the problem, just wanted to find out if there is something easier than I think

          1 Reply Last reply Reply Quote 2
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors