Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmarkarl committed Feb 23, 2017
1 parent 3ff685b commit ae0c508
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
45 changes: 31 additions & 14 deletions distann/src/main/java/org/simmi/GeneSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ private void loci2aaseq( List<Set<String>> lclust, Map<String,Gene> refmap, Map<
u = Sequence.specCheck( contigstr );

if( u == -1 ) {
u = Serifier.contigIndex( contigstr );
u = Sequence.parseSpec( contigstr );
if( u > 0 ) {
origin = contigstr.substring(0, u - 1);
contloc = contigstr.substring(u, contigstr.length());
Expand Down Expand Up @@ -707,10 +707,6 @@ private void loci2aaseq( List<Set<String>> lclust, Map<String,Gene> refmap, Map<

Set<String> mu = new HashSet<>();
private void loci2aasequence(BufferedReader br, Map<String,Gene> refmap, Map<String,String> designations, String filename) throws IOException {
/*if( filename.contains("timi") ) {
System.err.println();
}*/

String line = br.readLine();
String lname = null;
String prevline = null;
Expand Down Expand Up @@ -742,6 +738,7 @@ private void loci2aasequence(BufferedReader br, Map<String,Gene> refmap, Map<Str

if( i == 0 ) {
int k = filename.indexOf('_');
if( k == -1 ) k = filename.indexOf('.');
if( k == -1 ) k = filename.length();
origin = filename.substring(0, k);
contloc = lname;
Expand Down Expand Up @@ -777,7 +774,7 @@ private void loci2aasequence(BufferedReader br, Map<String,Gene> refmap, Map<Str
/*u = contigstr.indexOf("contig");
if( u == -1 ) u = contigstr.indexOf("scaffold");
if( u == -1 ) u = contigstr.lastIndexOf('_')+1;*/
u = Serifier.contigIndex( contigstr );
u = Sequence.parseSpec( contigstr );
if( u == 0 ) {
System.err.println();
}
Expand Down Expand Up @@ -1062,7 +1059,7 @@ private void loci2aasequence(BufferedReader br, Map<String,Gene> refmap, Map<Str
u = Sequence.specCheck( contigstr );

if( u == -1 ) {
u = Serifier.contigIndex( contigstr );
u = Sequence.parseSpec( contigstr );
/*u = contigstr.indexOf("contig");
if( u == -1 ) u = contigstr.indexOf("scaffold");
if( u == -1 ) u = contigstr.lastIndexOf('_')+1;*/
Expand Down Expand Up @@ -1178,8 +1175,18 @@ private List<String> loadcontigs(BufferedReader br, String filename) throws IOEx
if (line.startsWith(">")) {
if( size > 0 ) {
Sequence contig = new Contig( name, ac );

String spec = contig.getSpec();
if( spec == null ) {
spec = Contig.getSpec( name );
if( spec == null ) {
int di = filename.indexOf('_');
if (di == -1) di = filename.indexOf('.');
if (di == -1) di = filename.length();
spec = filename.substring(0, di);
}
contig.setGroup(spec);
}
List<Sequence> ctlist;
if( speccontigMap.containsKey( spec ) ) {
ctlist = speccontigMap.get( spec );
Expand Down Expand Up @@ -1231,6 +1238,16 @@ private List<String> loadcontigs(BufferedReader br, String filename) throws IOEx

List<Sequence> ctlist;
String spec = contig.getSpec();
if( spec == null ) {
spec = Contig.getSpec( name );
if( spec == null ) {
int di = filename.indexOf('_');
if (di == -1) di = filename.indexOf('.');
if (di == -1) di = filename.length();
spec = filename.substring(0, di);
}
contig.setGroup(spec);
}

if( speccontigMap.containsKey( spec ) ) {
ctlist = speccontigMap.get( spec );
Expand Down Expand Up @@ -6790,7 +6807,7 @@ public Serifier getConcatenatedSequences( boolean proximityJoin, Map<GeneGroup,I
}
seqs.putAll( addseqs );
} else {
seqs = new HashMap<Sequence,String>();
seqs = new HashMap<>();

if( ltv != null && ltv.size() > 0 ) {
for( Tegeval tv : ltv ) {
Expand Down Expand Up @@ -6830,14 +6847,14 @@ public Serifier getConcatenatedSequences( boolean proximityJoin, Map<GeneGroup,I
if( donetvs.containsKey(spec) ) {
tvals = donetvs.get( spec );
} else {
tvals = new HashSet<Tegeval>();
tvals = new HashSet<>();
donetvs.put( spec, tvals );
}

if( smap.containsKey( spec ) ) {
seqs = smap.get( spec );
Map<Sequence,String> addseqs = new HashMap<Sequence,String>();
Set<Tegeval> accountedfor = new HashSet<Tegeval>();
Map<Sequence,String> addseqs = new HashMap<>();
Set<Tegeval> accountedfor = new HashSet<>();

for( Sequence seq : seqs.keySet() ) {
String loc = seqs.get( seq );
Expand Down Expand Up @@ -7052,7 +7069,7 @@ public void cogCalc( String filename, BufferedReader br, Map<String,Map<Characte
else name = "Thermus_" + nspec.substring(0,firstDigitLocation) + "_" + nspec.substring(firstDigitLocation);
}*/

int k = Serifier.contigIndex(name);
int k = Sequence.parseSpec(name);
if( k == -1 ) {
name = spec;
} else {
Expand Down Expand Up @@ -7563,7 +7580,7 @@ public int loadrnas( Map<String,GeneGroup> ggmap, Reader reader, int groupIndex,
int u = Sequence.specCheck( cont );

if( u == -1 ) {
u = Serifier.contigIndex(cont);
u = Sequence.parseSpec(cont);
spec = cont.substring( 0, u-1 );
contshort = cont.substring( u, cont.length() );
} else {
Expand Down
2 changes: 1 addition & 1 deletion serifier/src/main/java/org/simmi/SerifyApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -5045,7 +5045,7 @@ public void addSequences( String name, Map<String,Reader> rds, Path path, String
nseq++;

if( nseq % 1000 == 0 ) System.err.println( "seq counting: "+nseq );
} else if( type.equals("nucl") && !line.matches("^[acgtykvrswmunxACGTDYKVRSWMUNX]+$") ) {
} else if( type.equals("nucl") && line.length() > 0 && !line.matches("^[acgtbdykhvrswmunxACGTBDYKHVRSWMUNX]+$") ) {
type = "prot";
}
line = br.readLine();
Expand Down

0 comments on commit ae0c508

Please sign in to comment.