In: Computer Science
In java please complete the following:
A DNA sequence in FASTA format consists of a header line
starting with a “>” sign, followed by a sequence identifier
(GenBank Accession number, or clone name), and one or more lines of
the sequence itself. Write a Java program to first prompt the user
for a sequence identifier, such as “Enter a clone name: “, and then
prompt for the DNA sequence. The program should print out a FASTA
format sequence to the screen. An example output is listed
below:
>bi617a01
GCATGGCGTAAATTGCCCGTACGCTTAA
public static void main(String[] args) {
boolean first = true;
Scanner sc = new Scanner(System.in);
System.out.println("Enter The clone
name:");
String ss=null;
while (sc.hasNextLine()) {
String token = sc.nextLine();
String token1 = sc.next();
ss=token+""+token1;
break;
}
Scanner lineScanner = new
Scanner(ss);
while (lineScanner.hasNext())
{
String line =
lineScanner.next();
if (line.charAt(0) == '>') {
if (first)
first = false;
else
System.out.println();
System.out.printf("%s ", line.substring(1));
} else {
System.out.print(line);
}
}
System.out.println();
}