X BOL wishing you a very and Happy New year

Alternative content

Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Perl script to delete the adjacent repeats !

  • Public
By Rahul Nayak 1782 days ago
/usr/bin/perl #Mostly the interview question for bioinfomatician ! #Write a code to delete the adjacent repeated character .... $string='ATTTTTTGGC'; # This should be converted to ATGC $string =~ s/(\w)\1/$1/g; print $string; #For more helps ... check out this #This bit of code will do the job: $string =~ s/(.)\1/$1/g #Alternatively, if you want to ignore case when comparing, you could use: $string =~ s/(.)\1/$1/gi #And finally, if you wanted to trim any number of duplicates down to a single letter, this would work: $string =~ s/(.)\1+/$1/gi