git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
in progress..
[jalview.git]
/
forester
/
java
/
src
/
org
/
forester
/
io
/
parsers
/
FastaParser.java
diff --git
a/forester/java/src/org/forester/io/parsers/FastaParser.java
b/forester/java/src/org/forester/io/parsers/FastaParser.java
index
5f42df8
..
dc4fc46
100644
(file)
--- a/
forester/java/src/org/forester/io/parsers/FastaParser.java
+++ b/
forester/java/src/org/forester/io/parsers/FastaParser.java
@@
-22,7
+22,7
@@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
package org.forester.io.parsers;
package org.forester.io.parsers;
@@
-42,7
+42,7
@@
import org.forester.msa.BasicMsa;
import org.forester.msa.Msa;
import org.forester.msa.MsaFormatException;
import org.forester.sequence.BasicSequence;
import org.forester.msa.Msa;
import org.forester.msa.MsaFormatException;
import org.forester.sequence.BasicSequence;
-import org.forester.sequence.Sequence;
+import org.forester.sequence.MolecularSequence;
public class FastaParser {
public class FastaParser {
@@
-51,7
+51,7
@@
public class FastaParser {
private static final Pattern ANYTHING_REGEX = Pattern.compile( "[\\d\\s]+" );
//>gi|71834668|ref|NP_001025424.1| Bcl2 [Danio rerio]
public static final Pattern FASTA_DESC_LINE = Pattern
private static final Pattern ANYTHING_REGEX = Pattern.compile( "[\\d\\s]+" );
//>gi|71834668|ref|NP_001025424.1| Bcl2 [Danio rerio]
public static final Pattern FASTA_DESC_LINE = Pattern
- .compile( ">?\\s*([^|]+)\\|([^|]+)\\S*\\s+(.+)\\s+\\[(.+)\\]" );
+ .compile( ">?\\s*([^|]+)\\|([^|]+)\\S*\\s+(.+)\\s+\\[(.+)\\]" );
public static void main( final String[] args ) {
final String a = ">gi|71834668|ref|NP_001025424.1| Bcl2 [Danio rerio]";
public static void main( final String[] args ) {
final String a = ">gi|71834668|ref|NP_001025424.1| Bcl2 [Danio rerio]";
@@
-68,6
+68,10
@@
public class FastaParser {
}
}
}
}
+ static public boolean isLikelyFasta( final File f ) throws IOException {
+ return isLikelyFasta( new FileInputStream( f ) );
+ }
+
static public boolean isLikelyFasta( final InputStream is ) throws IOException {
final BufferedReader reader = new BufferedReader( new InputStreamReader( is, "UTF-8" ) );
String line = null;
static public boolean isLikelyFasta( final InputStream is ) throws IOException {
final BufferedReader reader = new BufferedReader( new InputStreamReader( is, "UTF-8" ) );
String line = null;
@@
-105,11
+109,11
@@
public class FastaParser {
return parseMsa( new ByteArrayInputStream( bytes ) );
}
return parseMsa( new ByteArrayInputStream( bytes ) );
}
- static public List<Sequence> parse( final File f ) throws IOException {
+ static public List<MolecularSequence> parse( final File f ) throws IOException {
return parse( new FileInputStream( f ) );
}
return parse( new FileInputStream( f ) );
}
- static public List<Sequence> parse( final InputStream is ) throws IOException {
+ static public List<MolecularSequence> parse( final InputStream is ) throws IOException {
final BufferedReader reader = new BufferedReader( new InputStreamReader( is, "UTF-8" ) );
String line = null;
int line_counter = 0;
final BufferedReader reader = new BufferedReader( new InputStreamReader( is, "UTF-8" ) );
String line = null;
int line_counter = 0;
@@
-147,7
+151,7
@@
public class FastaParser {
}
addSeq( name, current_seq, temp_msa );
reader.close();
}
addSeq( name, current_seq, temp_msa );
reader.close();
- final List<Sequence> seqs = new ArrayList<Sequence>();
+ final List<MolecularSequence> seqs = new ArrayList<MolecularSequence>();
for( int i = 0; i < temp_msa.size(); ++i ) {
seqs.add( BasicSequence.createAaSequence( temp_msa.get( i )[ 0 ].toString(),
temp_msa.get( i )[ 1 ].toString() ) );
for( int i = 0; i < temp_msa.size(); ++i ) {
seqs.add( BasicSequence.createAaSequence( temp_msa.get( i )[ 0 ].toString(),
temp_msa.get( i )[ 1 ].toString() ) );