Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
26
Task/FASTA-format/Java/fasta-format-3.java
Normal file
26
Task/FASTA-format/Java/fasta-format-3.java
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import java.io.*;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ReadFastaFile {
|
||||
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
|
||||
boolean first = true;
|
||||
|
||||
try (Scanner sc = new Scanner(new File("test.fasta"))) {
|
||||
while (sc.hasNextLine()) {
|
||||
String line = sc.nextLine().trim();
|
||||
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();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue