File: PirDnaSPWriter.java

package info (click to toggle)
alter-sequence-alignment 1.3.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,132 kB
  • sloc: java: 6,623; xml: 60; makefile: 5; sh: 2
file content (69 lines) | stat: -rw-r--r-- 2,186 bytes parent folder | download | duplicates (2)
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
/*
 *  This file is part of ALTER.
 *
 *  ALTER 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
 *  (at your option) any later version.
 *
 *  ALTER is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with ALTER.  If not, see <http://www.gnu.org/licenses/>.
 */

package writer;

import java.util.logging.Level;
import types.MSA;
import types.Protein;
import types.Type;
import types.Typeable;

/**
 * Extiende la clase PirWriter para adaptar la salida a dnaSP.
 * @author Daniel Gomez Blanco
 * @version 1.0
 */

public class PirDnaSPWriter extends PirWriter
{
    /**
     * Constructor de la clase. Llama al constructor de la superclase.
     * @param os Sistema operativo de salida.
     * @param lowerCase Salida en letras minusculas.
     * @param match Salida codificada con caracteres match.
     * @param logger Nombre del logger a instanciar.
     */
    public PirDnaSPWriter(String os, boolean lowerCase, boolean match, String logger)
    {
        super(os,lowerCase,match,logger);
    }

    /**
     * Escribe un MSA en formato PIR adaptado a dnaSP. Para ello
     * comprueba que el MSA no sea de proteinas. Luego llama al metodo de la superclase.
     * @param msa MSA de entrada.
     * @return Cadena con la el MSA en formato PIR.
     */
    @Override
    public String write(MSA msa)
    {
        Type type = null;
        if (msa instanceof Typeable)
            type = ((Typeable) msa).getType();
        if (type == null)
        {
            type = WriterUtils.inferType(msa);
        }
        if (type instanceof Protein)
        {
            logger.log(Level.WARNING,"MSA is an amino acids MSA. " +
                    "It will not be processed by dnaSP (only DNA is processed).");
        }
        return super.write(msa);
    }
}