Commit f2fcbdde authored by Alexis  CRISCUOLO's avatar Alexis CRISCUOLO
Browse files

1.4

parent 11b81e74
......@@ -40,7 +40,7 @@ public class A2C {
public static void main(String[] args) throws IOException {
if ( args.length < 2 ) {
System.out.println("");
System.out.println(" A2C v." + VERSION + " Copyright (C) 2015-2020 Institut Pasteur");
System.out.println(" A2C v." + VERSION + " Copyright (C) 2015-2021 Institut Pasteur");
System.out.println("");
System.out.println(" USAGE: A2C <ali.faa> <seq.fna>");
System.out.println("");
......
......@@ -3,7 +3,7 @@
C2A: translating a FASTA-formatted codon sequence file into an amino-acid one
Copyright (C) 2015-2020 Institut Pasteur
Copyright (C) 2015-2021 Institut Pasteur
This program is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the License, or
......@@ -28,7 +28,7 @@
*/
import java.io.*;
public class C2A {
final static String VERSION = "1.3b.201024ac";
final static String VERSION = "1.4.210207ac";
static BufferedReader in;
static String line, fh;
static int lgt;
......@@ -36,7 +36,7 @@ public class C2A {
public static void main(String[] args) throws IOException {
if ( args.length < 1 ) {
System.out.println("");
System.out.println(" C2A v." + VERSION + " Copyright (C) 2015-2020 Institut Pasteur");
System.out.println(" C2A v." + VERSION + " Copyright (C) 2015-2021 Institut Pasteur");
System.out.println("");
System.out.println(" USAGE: C2A <seq.fna>");
System.out.println("");
......@@ -50,13 +50,17 @@ public class C2A {
catch ( FileNotFoundException e ) { System.out.println("file " + args[0] + " does not exist"); System.exit(1); }
while ( true ) {
try { line = in.readLine().trim(); } catch ( NullPointerException e ) { in.close(); break; }
if ( line.startsWith(">") ) {
if ( ((lgt=sb.length()) > 0) && (lgt % 3 == 0) ) { System.out.println(fh); System.out.println(toaa(sb)); }
if ( line.startsWith(">") ) {
if ( (lgt=sb.length()) != 0 ) {
if ( lgt % 3 != 0 ) System.err.println("[skipped] incorrect sequence length (3*" + (lgt/3) + "+" + (lgt%3) + "): " + fh);
else { System.out.println(fh); System.out.println(toaa(sb)); }
}
fh = line; sb = new StringBuilder(""); continue;
}
sb = sb.append(line.toUpperCase());
}
if ( ((lgt=sb.length()) > 0) && (lgt % 3 == 0) ) { System.out.println(fh); System.out.println(toaa(sb)); }
if ( (lgt=sb.length()) % 3 != 0 ) System.err.println("[skipped] incorrect sequence length (3*" + (lgt/3) + "+" + (lgt%3) + "): " + fh);
else { System.out.println(fh); System.out.println(toaa(sb)); }
}
static String toaa(StringBuilder cod) {
int c = -1, l = cod.length(); StringBuilder aa = new StringBuilder("");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment