Skip to content

Commit

Permalink
-s parameter added to cli
Browse files Browse the repository at this point in the history
The -s parameter allows to filter for a set of identifiers.

Docu updated
  • Loading branch information
steuernb committed Jun 18, 2018
1 parent ba34f75 commit f3582a4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ parameter | argument | description

This will provide the candidate contigs. You will have to allocate a bit of memory to the java vm. To add e.g. 16 Gb or RAM you would write `java -Xmx16000M -jar ...`

The `-s` parameter allows to load a list of identifiers that refer to sequences in the reference assembly. Further processing is only done for those sequences. If `-s` is ommitted, the entire set of sequences is used. The argument to `-s` is a either text file containing one identifier per line or a TSV file where the first column contains identifiers.

```
java -jar MutChromSeq.jar -w wildtype.pileup.xml -m mutant1.pileup.xml mutant2.plieup.xml [...] -o output.txt -n 6 -c 10 -a 0.01 -z 2
```
Expand All @@ -108,6 +110,7 @@ parameter | argument | description
**-c** | *int* | Minimum coverage for position to be regarded. Default is 10
**-n** | *int* | Minimum number of mutants to report a contig. Default is 2
**-z** | *int* | Number mutant lines that are allowed to have SNV in same position. Default is 2
**-s** | *Str* | A file with a list of sequence identifiers



Expand Down
41 changes: 38 additions & 3 deletions src/mutantHunter/MutChromSeq.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@

/**
*
* @version 3.0
* @version 3.1
* @author steuernb
*
*/
public class MutChromSeq {

public static final double version = 3.0;
public static final double version = 4;
public static final String wildtype = "wildtype";

Hashtable<String, TargetContig> targetContigs;
Expand Down Expand Up @@ -145,6 +145,27 @@ public void filterContigList(HashSet<String> contigs){



public void filterContigList(File contigList)throws IOException{
HashSet<String> contigs = new HashSet<String>();
BufferedReader in = new BufferedReader(new FileReader(contigList));

for (String inputline = in.readLine(); inputline != null; inputline = in.readLine()) {
String[] split = inputline.split("\t");
contigs.add(split[0].trim());
}

in.close();


Hashtable<String,TargetContig> h = new Hashtable<String,TargetContig>();
for(Enumeration<String> myenum = targetContigs.keys(); myenum.hasMoreElements();){
String key = myenum.nextElement();
if(contigs.contains(key)){
h.put(key, targetContigs.get(key));
}
}
this.targetContigs = h;
}



Expand Down Expand Up @@ -787,6 +808,16 @@ public static void main(String[] args){
mutChromSeq.addXMLQuick(new File(mutant),false);
}

if(cli.hasOption("s")){
File contigList = new File(cli.getArg("s"));
if(!contigList.exists()){
throw new CLIParseException("File " + contigList.getName() + " does not exist. Aborting.");
}

mutChromSeq.filterContigList(contigList);
}


Vector<String> v = new Vector<String>();
for(Iterator<String> iterator = mutChromSeq.mutantLines.iterator(); iterator.hasNext();){
String s = iterator.next();
Expand All @@ -797,6 +828,9 @@ public static void main(String[] args){
}





int minCoverageToConsiderSNP = 15;
double maxReferenceAlleleFrequency = 0.01;
int minNumberOfTotalMutants = 5;
Expand Down Expand Up @@ -867,7 +901,8 @@ public static void main(String[] args){
"-n <int>\t\t\tMinimum number of mutants to report a contig. Default is 2\n"+
"-c <int>\t\t\tMininum coverage for mappings to be regarded. Default is 10\n"+
"-a <float>\t\t\tMaximum reference allele frequency to consider a SNP. Default is 0.01\n"+
"-z <int>\t\t\tNumber mutant lines that are allowed to have SNV in same position. Default is 2\n";
"-z <int>\t\t\tNumber mutant lines that are allowed to have SNV in same position. Default is 2\n"+
"-s <contiglist.txt>\t\tRestrict analysis to subset of contigs listed in file contiglist.txt";

System.err.println(s);

Expand Down

0 comments on commit f3582a4

Please sign in to comment.