X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src2%2Ffr%2Forsay%2Flri%2Fvarna%2Futils%2FTranslateFormatRNaseP.java;fp=src2%2Ffr%2Forsay%2Flri%2Fvarna%2Futils%2FTranslateFormatRNaseP.java;h=7c999e5b6d5de4d2fccf836b8504cd80ed2f8f5d;hb=9f55415c9f8005e9dcd8243453883ff853fd5b76;hp=0000000000000000000000000000000000000000;hpb=d8e8c742b864e58406d13e21d124699a26b6492f;p=jalview.git diff --git a/src2/fr/orsay/lri/varna/utils/TranslateFormatRNaseP.java b/src2/fr/orsay/lri/varna/utils/TranslateFormatRNaseP.java new file mode 100644 index 0000000..7c999e5 --- /dev/null +++ b/src2/fr/orsay/lri/varna/utils/TranslateFormatRNaseP.java @@ -0,0 +1,53 @@ +/** + * File written by Raphael Champeimont + * UMR 7238 Genomique des Microorganismes + */ +package fr.orsay.lri.varna.utils; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class TranslateFormatRNaseP { + public static void main(String[] args) throws Exception { + File templatesDir = new File(new File(System.getProperty("user.dir")), "templates"); + File infile = new File(new File(templatesDir, "RNaseP_bact_a"), "a_bacterial_rnas.gb"); + File outfile = new File(new File(templatesDir, "RNaseP_bact_a"), "alignment.fasta"); + + BufferedReader inbuf = new BufferedReader(new FileReader(infile)); + String line = inbuf.readLine(); + String seqname; + List seqnames = new ArrayList(); + List sequences = new ArrayList(); + while (line != null) { + if (line.length() != 0) { + if (line.startsWith("LOCUS")) { + String parts[] = line.split("\\s+"); + seqname = parts[1]; + seqnames.add(seqname); + sequences.add(""); + } + if (line.startsWith(" ")) { + String parts[] = line.split("\\s+"); + for (int i=2; i" + seqnames.get(i) + "\n"); + outbuf.write(sequences.get(i) + "\n"); + } + outbuf.close(); + } +}