File: run-unit-test

package info (click to toggle)
alter-sequence-alignment 1.3.4-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,160 kB
  • sloc: java: 20,039; xml: 506; javascript: 173; sh: 70; makefile: 9
file content (88 lines) | stat: -rw-r--r-- 2,832 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
set -e

pkg="alter-sequence-alignment"
CUR_DIR=`pwd`

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
  AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
  trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi

cp -a ${CUR_DIR}/alter-lib/src/main/java/* $AUTOPKGTEST_TMP
cp -a ${CUR_DIR}/alter-web/src/main/resources/* $AUTOPKGTEST_TMP

cd $AUTOPKGTEST_TMP
gunzip -r *

echo "Test 1"
alter-sequence-alignment -i muscle.aln -ia -of FASTA -oo Linux -op MUSCLE -o test1
[ -s test1 ] || exit 1
rm -f ./test1
echo "PASS"

echo "Test 2"
alter-sequence-alignment -i tcoffee.aln -ia -of MSF -oo Linux -op TCoffee -o test2
[ -s test2 ] || exit 1
rm -f ./test2
echo "PASS"

echo "Test converter"
cat >TestAlter.java <<HERE
import es.uvigo.ei.sing.alter.converter.Converter;
import es.uvigo.ei.sing.alter.converter.DefaultFactory;
import es.uvigo.ei.sing.alter.parser.ParseException;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

public class TestAlter {

	public static void main(String[] args) throws IOException {
		Converter converter = new DefaultFactory().getConverter(
            "Linux", 	// Input operating system (Linux, MacOS or Windows)
			"clustal", 	// Input program (Clustal, MAFFT, MUSCLE, PROBCONS or TCoffee)
			"NEXUS",	// Input format (ALN, FASTA, GDE, MEGA, MSF, NEXUS, PHYLIP or PIR)
			false,		// Autodetect format (other input options are omitted)
			false,		// Collapse sequences to haplotypes
			true,		// Treat gaps as missing data when collapsing
			false,		// Count missing data as differences when collapsing
			0,			// Connection limit (sequences differing at <= l sites will be collapsed) (default is l=0)
			"windows",	// Output operating system (Linux, MacOS or Windows)
			"general",	// Output program (jModelTest, MrBayes, PAML, PAUP, PhyML,
						// ProtTest, RAxML, TCS, CodABC,
						// BioEdit, MEGA, dnaSP, Se-Al, Mesquite, SplitsTree, Clustal, MAFFT,
						// MUSCLE, PROBCONS, TCoffee, Gblocks, SeaView, trimAl or GENERAL)
			"aln",  	// Output format (ALN, FASTA, GDE, MEGA, MSF, NEXUS, PHYLIP or PIR)
			false,		// Low case output
			false,		// Output residue numbers (only ALN format)
			false,		// Sequential output (only NEXUS and PHYLIP formats)
			false,		// Output match characters
			"MyConverterApp" // identifier for log messages
		);


		try {
			String inputSequence = new String(Files.readAllBytes(Paths.get("clustal.nex")));

			String converted = converter.convert(inputSequence);

			System.out.println("converted file:");
			System.out.println(converted);

		} catch (ParseException e) {
			System.err.println("the input file seems to contain errors");
			e.printStackTrace();
		}

	}
}

HERE

CLASSPATH=".:/usr/share/java/alter-lib.jar:/usr/share/java/alter.jar"
javac TestAlter.java
java TestAlter
rm -f ./TestAlter*
echo "PASS"