Changeset 5729
- Timestamp:
- Nov 18, 2019, 1:43:09 PM (3 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/vcf
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/vcf/SnpData.java
r5320 r5729 23 23 private String alt; 24 24 25 25 private InfoData info; 26 26 27 /** 27 28 Creates a new instance. … … 107 108 } 108 109 110 public void setInfo(InfoData info) 111 { 112 this.info = info; 113 } 114 115 public InfoData getInfo() 116 { 117 return info; 118 } 119 109 120 /** 110 121 Get all information as a JSON object. A new JSON object … … 119 130 json.put("ref", getRef()); 120 131 json.put("alt", getAlt()); 132 if (info != null) 133 { 134 json.put("info", info.asJSONObject()); 135 } 121 136 return json; 122 137 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/vcf/VcfParser.java
r5692 r5729 30 30 private final Map<String, SnpData> snpDef; 31 31 private boolean useLineNoAsId; 32 private InfoFactory infoFactory; 32 33 33 34 /** … … 40 41 41 42 /** 42 Set this to TRUE to use line number as the id. Useful eif there43 Set this to TRUE to use line number as the id. Useful if there 43 44 are no ID values in the file, but note that this means that 44 45 different VCF files can't be compared. 46 @since 4.24 45 47 */ 46 48 public void setUseLineNoAsId(boolean useLineNoAsId) 47 49 { 48 50 this.useLineNoAsId = useLineNoAsId; 51 } 52 53 /** 54 Set the factory to use for extracting information from 55 the INFO column. If not set, the INFO column is not parsed. 56 @since 4.24 57 */ 58 public void setInfoFactory(InfoFactory infoFactory) 59 { 60 this.infoFactory = infoFactory; 49 61 } 50 62 … … 76 88 throw new IOException("File '" + fileName + "' line " + lineNo + ": Could not find header line starting with '#CHROM{tab}POS...'"); 77 89 } 90 91 if (infoFactory != null) 92 { 93 for (String name : ffp.getHeaderNames()) 94 { 95 infoFactory.addInfoHeader(name, ffp.getHeader(name)); 96 } 97 } 98 78 99 List<String> headers = ffp.getColumnHeaders(); 79 100 … … 110 131 snp.setAlt(altMapper.getString(line)); 111 132 snpDef.put(id, snp); 133 if (infoFactory != null) 134 { 135 snp.setInfo(infoFactory.getInfo(infoMapper.getString(line), snp)); 136 } 112 137 } 113 138 … … 146 171 ffp.setDataHeaderRegexp(Pattern.compile("#CHROM\\tPOS.*")); 147 172 ffp.setDataSplitterRegexp(Pattern.compile("\\t")); 173 ffp.setHeaderRegexp(Pattern.compile("##INFO\\=\\<ID\\=(\\w+),(.*)\\>")); 148 174 ffp.setIgnoreRegexp(Pattern.compile("##.*")); 149 175 return ffp;
Note: See TracChangeset
for help on using the changeset viewer.