I need to cut a text in a certain position which is always different
-
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++? -
@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 =
^(....).*
, replacegene_1 = $1
. But since it’s “always different”, that would have to be customized every timeNote: 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).
-
@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