Map<String, Double> binned = new HashMap<>();
// location of the family file
- String families = "H:/Desktop//PFAM/Family/SeedFamilies.seed";
+ String families = "/media/sf_Shared_Folder/PFAM/Family/SeedFamilies.seed";
// location of the file containing the family-clan links
- final static String FAMILIESTOCLAN = "H:/Desktop//PFAM/Family/Clanlinks.dat";
+ final static String FAMILIESTOCLAN = "/media/sf_Shared_Folder/PFAM/Family/Clanlinks.dat";
// location of the HMM file
- String hmms = "H:/Desktop//PFAM/HMMs/Pfam-A.hmm";
+ String hmms = "/media/sf_Shared_Folder/PFAM/HMMs/Pfam-A.hmm";
// suffix for raw file
final static String RAW = "/Raw.csv";
BufferedReader inputHMM = null;
int size = 0;
int files = 1;
+ try
+ {
if (forClans)
{
- files = 604;
+ files = 603;
}
int filesRead = 0;
for (int clan = 0; clan < files; clan++)
{
+ System.out.println(clan);
String clanPath = "";
int numberOfFamilies = 0;
if (forClans)
{
clanPath = currentFolder + "/Clan" + clan;
+ if (!new File(clanPath).exists())
+ {
+ continue;
+ }
BufferedReader famCountReader = new BufferedReader(
new FileReader(clanPath + "/NumberOfFamilies.txt"));
numberOfFamilies = Integer.parseInt(famCountReader.readLine());
}
}
}
- exportData(currentFolder);
- raw.clear();
- binned.clear();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ } finally
+ {
+ exportData(currentFolder);
+ raw.clear();
+ binned.clear();
+ }
}
/**
raw.add(new ArrayList<Double>());
rawPos = raw.size() - 1;
}
-
+ Double total = 0d;
for (int width = 0; width < sequences.size(); width++)
{
for (int length = 1; length < hmm.getLength() + 1; length++)
Double llr;
prob = hmm.getMatchEmissionProbability(alignPos, symbol);
bfreq = ResidueProperties.aminoBackgroundFrequencies.get(symbol);
+ if (prob == 0 || bfreq == 0)
+ {
+ System.out.println("error");
+ }
llr = Math.log(prob / bfreq);
if (keepRaw)
{
String output;
output = String.format("%.1f", llr);
+ total += Double.parseDouble(output);
if ("-0.0".equals(output))
{
output = "0.0";
}
}
}
+ System.out.println(total / count);
}
{
FileParse parserHMM = new FileParse(inputHMM, "", DataSourceType.FILE);
HMMFile file = new HMMFile(parserHMM);
- file.parse();
hmm = file.getHMM();
- if (reference != null)
- {
- hmm.mapToReferenceAnnotation(reference);
- }
}
BufferedReader familyReader = new BufferedReader(
new FileReader(families));
BufferedReader hmmReader = new BufferedReader(new FileReader(hmms));
+ int families = 0;
// moveLocationBy(7000, familyReader);
// moveLocationBy(7000, clanFinder);
// moveLocationBy(7000, hmmReader);
while (!"".equals(line) && !" ".equals(line) && line != null)
{
- if (line.contains("HATP") || line.contains("CL0025"))
- {
- System.out.println(filePos);
- }
String clanName;
boolean inClan = false;
while (!(line.indexOf("//") > -1))
if (line.indexOf("#=GF CL") > -1)
{
+ families++;
+ System.out.println(families);
inClan = true;
Scanner scanner = new Scanner(line);
scanner.next();
int alignmentsExported = 0;
for (int clan = 0; clan < 604; clan++)
{
-
+ System.out.println(clan);
int famCount = 0;
String clanPath = clansLocation + "/Clan" + clan;
int numberOfFamilies;
int hmmIndex = getRandom(indexes);
String famPath = clanPath + "/Families/Fam" + family + ".sto";
String hmmPath = clanPath + "/HMMs/HMM" + hmmIndex + ".hmm";
- String command = "H:/Desktop//hmmer/binaries/hmmalign --mapali "
+ String command = "/media/sf_Shared_Folder/hmmer/binaries/hmmalign --mapali "
+ clanPath + "/Families/Fam" + hmmIndex + ".sto"
+ " --trim ";
command += hmmPath + " ";
alignmentsExported++;
- System.out.println(alignmentsExported + " alignments exported");
- System.out.println("At clan " + clan);
}
PrintWriter writer = new PrintWriter(