public class JackHMMER extends Search
{
+ SequenceI seq = null;
+
/**
* Constructor for the JackhmmerThread
*
@Override
public void run()
{
- SequenceI seq = getSequence();
+ seq = getSequence();
if (seq == null)
{
// shouldn't happen if we got this far
inputAlignmentTemp.getAbsolutePath(), DataSourceType.FILE));
seqs = file.getSeqsAsArray();
+ readDomainTable(searchOutputFile, true);
+
if (searchAlignment)
{
recoverSequences(sequencesHash, seqs);
}
- readTable(searchOutputFile);
+
int seqCount = seqs.length;
+
AlignmentI al = new Alignment(seqs);
AlignFrame alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH,
{
}
+ /*
+ void readOutputFile(File inputTableTemp) throws IOException
+ {
+ BufferedReader br = new BufferedReader(new FileReader(inputTableTemp));
+
+
+ String line = "";
+ while (!line.startsWith("//"))
+ {
+
+ while (!line.startsWith(">> ") && !line.startsWith("//"))
+ {
+ line = br.readLine();
+ }
+
+ if (line.startsWith("//"))
+ {
+ break;
+ }
+
+ Scanner scanner = new Scanner(line);
+ String name = scanner.next();
+ name = scanner.next();
+
+ br.readLine();
+ br.readLine();
+
+ List<SequenceI> domains = new ArrayList<>();
+
+ for (SequenceI seq : seqs)
+ {
+ if (seq.getName().contains(name))
+ {
+ domains.add(seq);
+ }
+ }
+
+ if (domains.contains(getSequence()))
+ {
+ domains.remove(getSequence());
+ }
+
+ if (domains.size() > 0)
+ {
+ readOutputTable(br, domains);
+ }
+
+ line = br.readLine();
+ }
+
+ }
+
+
/**
* Reads in the scores table output by jackhmmer and adds annotation to
* sequences for E-value and bit score
* @param inputTableTemp
* @throws IOException
*/
- void readTable(File inputTableTemp) throws IOException
+ /*
+ void readOutputTable(BufferedReader br, List<SequenceI> seqs) throws IOException
{
- BufferedReader br = new BufferedReader(new FileReader(inputTableTemp));
- String line = "";
- while (!line.startsWith("Query:"))
- {
- line = br.readLine();
- }
- while (!line.contains("-------"))
- {
- line = br.readLine();
- }
- line = br.readLine();
-
- int index = 0;
-
+ String line = br.readLine();
+
while (!"".equals(line) && line != null)
{
if (" ------ inclusion threshold ------".equals(line))
line = br.readLine();
continue;
}
-
+
Scanner scanner = new Scanner(line);
+ scanner.next();
+ scanner.next();
+ String score = scanner.next();
+
+ scanner.next();
+
String evalue = scanner.next();
-
- if (evalue.equals("+") || evalue.equals("-"))
+
+ scanner.next();
+ scanner.next();
+ scanner.next();
+ scanner.next();
+
+ int start = scanner.nextInt();
+ int end = scanner.nextInt();
+
+ SequenceI seq = null;
+ for (SequenceI sequence : seqs)
+ {
+ if (sequence.getStart() >= start && sequence.getEnd() <= end)
+ {
+ seq = sequence;
+ break;
+ }
+ }
+
+ if (seq != null)
{
- evalue = scanner.next();
+ addScoreAnnotations(evalue, score, seq);
}
-
-
- String score = scanner.next();
- checkSequenceOrder(index, scanner);
- SequenceI seq = seqs[index];
- addScoreAnnotations(evalue, score, seq);
+
scanner.close();
line = br.readLine();
- index++;
}
-
- br.close();
}
+ */
- void checkSequenceOrder(int index, Scanner scanner)
+ void readDomainTable(File inputTableTemp, boolean includesQuery)
+ throws IOException
{
- String seqName = null;
+ BufferedReader br = new BufferedReader(new FileReader(inputTableTemp));
- for (int i = 0; i < 7; i++)
+ String line = br.readLine();
+ br.readLine();
+ br.readLine();
+ line = br.readLine();
+
+ int index;
+
+ if (includesQuery)
{
- seqName = scanner.next();
+ index = 1;
}
-
- if (!seqs[index].getName().equals(seqName))
+ else
{
- SequenceI temp = seqs[index];
+ index = 0;
+ }
+ while (!line.startsWith("#"))
+ {
+ if (line.contains("inclusion threshold"))
+ {
+ line = br.readLine();
+ continue;
+ }
+
+ Scanner scanner = new Scanner(line);
+ String name = scanner.next();
- for (int j = 0; j < seqs.length; j++)
+ for (int i = 0; i < 10; i++)
{
- if (seqs[j].getName().equals(seqName))
- {
- seqs[index] = seqs[j];
- seqs[j] = temp;
- break;
- }
+ scanner.next();
}
+
+ String evalue = scanner.next();
+ scanner.next();
+ String score = scanner.next();
+
+ addScoreAnnotations(evalue, score, seqs[index]);
+ index++;
+
+ scanner.close();
+ line = br.readLine();
}
+ br.close();
}
+
+
+
void addScoreAnnotations(String eValue, String bitScore, SequenceI seq)
{
String label = "Search Scores";
void buildArguments(List<String> args, File searchOutputFile,
File hitsAlignmentFile, File queryFile) throws IOException
{
- args.add("-o");
+ args.add("--domtblout");
args.add(getFilePath(searchOutputFile, true));
args.add("-A");
args.add(getFilePath(hitsAlignmentFile, true));