Java Terminal Color Output colorizeSequence(String cigar, String seq)

Here you can find the source of colorizeSequence(String cigar, String seq)

Description

colorize Sequence

License

Apache License

Declaration

public static String colorizeSequence(String cigar, String seq) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String colorizeSequence(String cigar, String seq) {
        String[] letter = cigar.replaceAll("[0-9]", "").split("");
        String[] nums = cigar.split("[MIDNSHPX]");
        int index = 0;
        String htmlEmbedded = "";
        for (int i = 0; i < nums.length; i++) {
            int tail = Integer.parseInt(nums[i]) + index;
            if (letter[i + 1].equals("M")) {
                htmlEmbedded += seq.substring(index, tail);
            } else {
                htmlEmbedded += "<span style=\"color:red;\">" + seq.substring(index, tail) + "</span>";
            }/*  ww w  .j av  a  2 s . co m*/
            index += Integer.parseInt(nums[i]);
        }
        return htmlEmbedded;
    }
}

Related

  1. colorize(String original)
  2. colorize(String string)
  3. colorizeBackground(String str, String color)
  4. colorizeBackground(String str, String color)
  5. colorizeBackground(String str, String color, boolean autoff)
  6. colorizeText(String str, String color)
  7. colorizeText(String str, String color)
  8. colorizeText(String str, String fgc, String bgc)
  9. colors(String string)