Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New GeometricSeqPhenotype class #22

Merged
merged 65 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
9bd296f
Created a GeometricSeqPhenotype class that implements Phenotype and u…
thienktran Jun 13, 2022
e8e1972
Maintain translation from nucleotides to amino acids
thienktran Jun 14, 2022
139d01e
Precompute vectors from gamma distribution
thienktran Jun 16, 2022
a725bcd
Made sure nucleotide is being mutated to a different letter.
thienktran Jun 17, 2022
942f99a
Test matrix of vectors drawn from the gamma distribution
thienktran Jun 23, 2022
3f40eee
Remove gamma distribution csv output from repo
thienktran Jun 23, 2022
38d12b1
Keep mutating until it's not a stop codon
thienktran Jun 24, 2022
6f28dd7
if mutation creates a stop codon, switch index to mutate
thienktran Jun 24, 2022
909b6c8
represent sequence using a char[]
thienktran Jun 27, 2022
5a46d50
use inheritance instead of composition
thienktran Jun 28, 2022
59cfd80
Clean up code, add documentation
thienktran Jul 2, 2022
e4e53a7
finish unit tests for geometricseq
thienktran Jul 7, 2022
475fc44
clean up repo
thienktran Aug 14, 2022
7b9c27d
each sentence gets own line.
zorian15 Aug 21, 2022
df858e1
Address Hugh and Zorian's comments. First round.
thienktran Aug 22, 2022
be5082b
Merge branch 'main' of https://github.com/matsengrp/antigen into 17-g…
thienktran Aug 22, 2022
9808dcc
Remove SequencePhenotype.java
thienktran Aug 22, 2022
9add838
Merge remote-tracking branch 'origin/17-geometric-sequence' into 17-g…
thienktran Aug 22, 2022
3c098e9
Fix issue #23
thienktran Aug 30, 2022
3dfc3cf
Remove DMS file requirement
thienktran Aug 30, 2022
df37af1
Clean up code and refactor sanity check
thienktran Aug 30, 2022
157f73c
Created a GeometricSeqPhenotype class that implements Phenotype and u…
thienktran Jun 13, 2022
27e0dbf
Maintain translation from nucleotides to amino acids
thienktran Jun 14, 2022
023de81
Precompute vectors from gamma distribution
thienktran Jun 16, 2022
c00b8ac
Made sure nucleotide is being mutated to a different letter.
thienktran Jun 17, 2022
17d1512
Test matrix of vectors drawn from the gamma distribution
thienktran Jun 23, 2022
65e1a9a
Remove gamma distribution csv output from repo
thienktran Jun 23, 2022
87253ad
Keep mutating until it's not a stop codon
thienktran Jun 24, 2022
01b2baf
if mutation creates a stop codon, switch index to mutate
thienktran Jun 24, 2022
0f59c97
represent sequence using a char[]
thienktran Jun 27, 2022
7133f81
use inheritance instead of composition
thienktran Jun 28, 2022
7563523
Clean up code, add documentation
thienktran Jul 2, 2022
8bc8381
finish unit tests for geometricseq
thienktran Jul 7, 2022
7373b88
clean up repo
thienktran Aug 14, 2022
3c02bf0
Address Hugh and Zorian's comments. First round.
thienktran Aug 22, 2022
c729e52
Fix issue #23
thienktran Aug 30, 2022
aa63a7d
Remove DMS file requirement
thienktran Aug 30, 2022
f3fc0f3
Clean up code and refactor sanity check
thienktran Aug 30, 2022
ec69825
Merge branch '17-geometric-sequence' of https://github.com/matsengrp/…
zorian15 Jan 10, 2023
ca1fdb1
format updates.
zorian15 Jan 10, 2023
91ef2a7
remove illegal characters from filename
zorian15 Jan 10, 2023
e7b93f3
update readme
zorian15 Jan 10, 2023
167f45a
Nonfunctional changes to code from Erick's review of PR #22
thienktran Jan 10, 2023
e4c5c50
Test CodonMap values are correct
thienktran Jan 10, 2023
f97108f
Merge branch '17-geometric-sequence' of https://github.com/matsengrp/…
thienktran Jan 10, 2023
75bfc27
Update out.tips for GeometricSeq fields
thienktran Jan 14, 2023
9a551ae
change names from traitA/B to ag1/2 to consistency
thienktran Jan 15, 2023
3545f63
Clean up commented and unused code
thienktran Jan 31, 2023
11c4fa3
print fasta for branches
thienktran Feb 14, 2023
e25260b
Add startingSequence and epitopeSites files and output fasta file
thienktran Feb 21, 2023
b1d0e30
Initial commit for testing geometric seq phenotype without predefined…
thienktran Mar 7, 2023
6e2a279
Clean up and refactor things
thienktran Mar 28, 2023
bb7309e
Fix bug with reset and organize/optimize a little more in GeometricSe…
thienktran Mar 29, 2023
fe5ca12
Make sure that the nucleotide sequence is updated even for synonymous…
thienktran Mar 30, 2023
198ea35
fasta file rename for pipeline
zorian15 Apr 19, 2023
e44a14c
Update README.md
zorian15 Apr 20, 2023
748b8c9
updates to params for customization of output path
zorian15 Apr 20, 2023
e9b8edc
Merge branch 'random-epitope-mutations' of https://github.com/matseng…
zorian15 Apr 20, 2023
c1fcfb4
remove .out from outputs
zorian15 Apr 20, 2023
2bf0b15
Merge pull request #24 from matsengrp/random-epitope-mutations
thienktran Apr 20, 2023
4312ea2
Add headers to fasta file sequences
thienktran Apr 20, 2023
14f65c1
Update to deme name instead of ID
thienktran Apr 20, 2023
f45756d
allow last codon to be a stop
zorian15 May 3, 2023
1bfd70a
log file creation
zorian15 May 3, 2023
28e945e
file formatting
zorian15 May 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Antigen.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* Implements an individual-based model in which the infection's genealogical history is tracked through time */

import java.io.FileNotFoundException;

class Antigen {
public static void main(String[] args) {
public static void main(String[] args) throws FileNotFoundException {

// initialize random number generator
cern.jet.random.AbstractDistribution.makeDefaultGenerator();
Expand Down
395 changes: 395 additions & 0 deletions Biology.java

Large diffs are not rendered by default.

364 changes: 364 additions & 0 deletions GeometricSeqPhenotype.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion HostPopulation.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class HostPopulation {
private double tmrca;
private double netau;
private double serialInterval;
private double antigenicDiversity;
private double antigenicDiversity;

private int newContacts;
private int newRecoveries;
Expand Down
256 changes: 147 additions & 109 deletions Parameters.java

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions PhenotypeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class PhenotypeFactory {
public static String GEOMETRIC3D = "geometric3d";
public static String GEOMETRIC10D = "geometric10d";
public static String SEQUENCE = "sequence";
public static String GEOMETRIC_SEQ = "geometricSeq";

// returns newly instantiated Phenotype objects of type according to Parameters.phenotypeSpace
public static Phenotype makeVirusPhenotype() {
Expand All @@ -15,7 +16,7 @@ public static Phenotype makeVirusPhenotype() {
if (GEOMETRIC.equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype(); }
if (GEOMETRIC3D.equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype3D(); }
if (GEOMETRIC10D.equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype10D(); }
if (SEQUENCE.equals(Parameters.phenotypeSpace)) { p = new SequencePhenotype(); }
if (GEOMETRIC_SEQ.equals(Parameters.phenotypeSpace)) { p = new GeometricSeqPhenotype(); }
return p;

}
Expand All @@ -34,8 +35,13 @@ public static Phenotype makeHostPhenotype() {
double[] traits = {Parameters.initialTraitA, 0, 0, 0, 0, 0, 0, 0, 0, 0};
p = new GeometricPhenotype10D(traits);
}
if (SEQUENCE.equals(Parameters.phenotypeSpace)) {
p = new SequencePhenotype(Parameters.startingSequence);
if (GEOMETRIC_SEQ.equals(Parameters.phenotypeSpace)) {
String startingSequence = Parameters.startingSequence;
if (startingSequence == null) {
p = new GeometricSeqPhenotype(Parameters.initialTraitA, 0);
} else {
p = new GeometricSeqPhenotype(Parameters.initialTraitA, 0, Parameters.startingSequence.toCharArray());
}
}
return p;

Expand All @@ -46,6 +52,7 @@ public static Phenotype makeArbitaryPhenotype(double x, double y) {

Phenotype p = null;
if (GEOMETRIC.equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype(x, y); }
if (GEOMETRIC_SEQ.equals(Parameters.phenotypeSpace)) { p = new GeometricSeqPhenotype(x, y); }
return p;

}
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ The program can be compiled with:

javac *.java


I (@zorian15) have found that I sometimes need to specify all of the `.jar` files in the compilation command to get things to compile completely, this can be done with::

javac -classpath ".:lib/classmexer.jar:lib/colt-1.2.0.jar:lib/hamcrest-core-1.3.jar:lib/junit-4.13.1.jar:" *.java

Then to run:

java -XX:+UseSerialGC -Xmx1G Antigen
Expand Down
41 changes: 20 additions & 21 deletions Random.java
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
/* Holds random number genator necessities */
/* Trying to encapsulate this, so the RNG particulars can be changed if necessary */
/* Trying to encapsulate this, so the RNG particulars can be changed if necessary */
/* Completely static class, allows no instances to be instantiated */

//import cern.jet.random.*;
import cern.jet.random.*;

public class Random {

// methods

public static int nextInt(int from, int to) {
return cern.jet.random.Uniform.staticNextIntFromTo(from, to);
}
}

public static double nextDouble() {
return cern.jet.random.Uniform.staticNextDouble();
return cern.jet.random.Uniform.staticNextDouble();
}

public static double nextDouble(double from, double to) {
return cern.jet.random.Uniform.staticNextDoubleFromTo(from, to);
}
return cern.jet.random.Uniform.staticNextDoubleFromTo(from, to);
}

public static double nextNormal() {
return cern.jet.random.Normal.staticNextDouble(0.0,1.0);
return cern.jet.random.Normal.staticNextDouble(0.0, 1.0);
}

public static double nextNormal(double mean, double sd) {
return cern.jet.random.Normal.staticNextDouble(mean,sd);
}
return cern.jet.random.Normal.staticNextDouble(mean, sd);
}

// tuned with mean
public static double nextExponential(double lambda) {
return cern.jet.random.Exponential.staticNextDouble(1.0/lambda);
return cern.jet.random.Exponential.staticNextDouble(1.0 / lambda);
}

// tuned with alpha and beta, matching Mathematica's notation
public static double nextGamma(double alpha, double beta) {
return cern.jet.random.Gamma.staticNextDouble(alpha, 1/beta);
}
return cern.jet.random.Gamma.staticNextDouble(alpha, 1 / beta);
}

public static int nextPoisson(double lambda) {
return cern.jet.random.Poisson.staticNextInt(lambda);
}

public static boolean nextBoolean(double p) {
boolean x = false;
if (nextDouble() < p) {
x = true;
}
return x;
}

}

}
225 changes: 0 additions & 225 deletions SequencePhenotype.java

This file was deleted.

Loading