001package com.hfg.bio.seq.genomic.assembly; 002 003import java.io.BufferedReader; 004import java.io.File; 005import java.io.FileReader; 006import java.io.IOException; 007import java.text.ParseException; 008import java.text.SimpleDateFormat; 009import java.util.ArrayList; 010import java.util.Date; 011import java.util.HashMap; 012import java.util.List; 013import java.util.Map; 014 015import com.hfg.bio.taxonomy.ncbi.NCBITaxon; 016import com.hfg.util.BooleanUtil; 017import com.hfg.util.CompareUtil; 018import com.hfg.util.StringBuilderPlus; 019import com.hfg.util.io.TSV; 020import com.hfg.xml.HfgXML; 021import com.hfg.xml.XMLName; 022import com.hfg.xml.XMLTag; 023 024//------------------------------------------------------------------------------ 025/** 026 * Information about an NCBI genomic assembly. 027 * See ftp://ftp.ncbi.nlm.nih.gov/genomes/README_assembly_summary.txt for a description of the fields. 028 * <div> 029 * @author J. Alex Taylor, hairyfatguy.com 030 * </div> 031 */ 032//------------------------------------------------------------------------------ 033// com.hfg XML/HTML Coding Library 034// 035// This library is free software; you can redistribute it and/or 036// modify it under the terms of the GNU Lesser General Public 037// License as published by the Free Software Foundation; either 038// version 2.1 of the License, or (at your option) any later version. 039// 040// This library is distributed in the hope that it will be useful, 041// but WITHOUT ANY WARRANTY; without even the implied warranty of 042// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 043// Lesser General Public License for more details. 044// 045// You should have received a copy of the GNU Lesser General Public 046// License along with this library; if not, write to the Free Software 047// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 048// 049// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 050// jataylor@hairyfatguy.com 051//------------------------------------------------------------------------------ 052 053public class NCBIGenomicAssemblyInfo implements Comparable<NCBIGenomicAssemblyInfo> 054{ 055 // Tag names 056 private static final XMLName NCBI_GENOMIC_ASSEMBLY_INFO = new XMLName("NCBIGenomicAssemblyInfo", HfgXML.HFG_NAMESPACE); 057 private static final XMLName ASSEMBLY_ACCESSION = new XMLName("AssemblyAccession", HfgXML.HFG_NAMESPACE); 058 private static final XMLName BIOPROJECT_ACCESSION = new XMLName("BioprojectAccession", HfgXML.HFG_NAMESPACE); 059 private static final XMLName BIOSAMPLE_ACCESSION = new XMLName("BiosampleAccession", HfgXML.HFG_NAMESPACE); 060 private static final XMLName WGS_ACCESSION = new XMLName("WGS_Accession", HfgXML.HFG_NAMESPACE); 061 private static final XMLName REFSEQ_CATEGORY = new XMLName("RefseqCategory", HfgXML.HFG_NAMESPACE); 062 private static final XMLName ORGANISM_TAXON = new XMLName("OrganismTaxon", HfgXML.HFG_NAMESPACE); 063 private static final XMLName SPECIES_TAXON = new XMLName("SpeciesTaxon", HfgXML.HFG_NAMESPACE); 064 private static final XMLName INFRASPECIFIC_NAME = new XMLName("InfraspecificName", HfgXML.HFG_NAMESPACE); 065 private static final XMLName ISOLATE = new XMLName("Isolate", HfgXML.HFG_NAMESPACE); 066 private static final XMLName ASSEMBLY_VERSION_STATUS = new XMLName("AssemblyVersionStatus", HfgXML.HFG_NAMESPACE); 067 private static final XMLName ASSEMBLY_LEVEL = new XMLName("AssemblyLevel", HfgXML.HFG_NAMESPACE); 068 private static final XMLName ASSEMBLY_RELEASE_TYPE = new XMLName("AssemblyReleaseType", HfgXML.HFG_NAMESPACE); 069 private static final XMLName GENOMIC_REPRESENTATION = new XMLName("GenomicRepresentation", HfgXML.HFG_NAMESPACE); 070 private static final XMLName RELEASE_DATE = new XMLName("ReleaseDate", HfgXML.HFG_NAMESPACE); 071 private static final XMLName ASSEMBLY_NAME = new XMLName("AssemblyName", HfgXML.HFG_NAMESPACE); 072 private static final XMLName SUBMITTER = new XMLName("Submitter", HfgXML.HFG_NAMESPACE); 073 private static final XMLName GENBANK_REFSEQ_PAIRED_ASSEMBLY = new XMLName("GenBankRefseqPairedAssembly", HfgXML.HFG_NAMESPACE); 074 private static final XMLName GENOMIC_PAIRED_ASSEMBLY_COMPARISON = new XMLName("GenomicPairedAssemblyComparison", HfgXML.HFG_NAMESPACE); 075 private static final XMLName FTP_PATH = new XMLName("FTP_Path", HfgXML.HFG_NAMESPACE); 076 private static final XMLName EXCLUDED_FROM_REFSEQ = new XMLName("ExcludedFromRefseq", HfgXML.HFG_NAMESPACE); 077 private static final XMLName GENOMIC_RELATION_TO_TYPE_MATERIAL = new XMLName("GenomicRelationToTypeMaterial", HfgXML.HFG_NAMESPACE); 078 079 private String mAssemblyAccession; 080 private String mBioprojectAccession; 081 private String mBiosampleAccession; 082 private String mWGSAccession; 083 private GenomicRefSeqCategory mRefseqCategory; 084 private NCBITaxon mOrganismNCBITaxon; 085 private NCBITaxon mSpeciesNCBITaxon; // The species taxid will differ from the 086 // organism taxid (column 6) only when the 087 // organism was reported at a sub-species or strain level. 088 private String mInfraspecificName; 089 private String mIsolate; 090 private GenomicAssemblyVersionStatus mAssemblyVersionStatus; 091 private GenomicAssemblyLevel mAssemblyLevel; 092 private GenomicAssemblyReleaseType mAssemblyReleaseType; 093 private GenomicRepresentation mGenomicRepresentation; 094 private Date mReleaseDate; 095 private String mAssemblyName; 096 private String mSubmitter; 097 private String mGenBankRefSeqPairedAssembly; 098 private GenomicPairedAssemblyComparison mGenomicPairedAssemblyComparison; 099 private String mFTP_Path; 100 private Boolean mExcludedFromRefSeq; 101 private GenomicRelationToTypeMaterial mGenomicRelationToTypeMaterial; 102 103 104 private SimpleDateFormat mDateFormat = new SimpleDateFormat("YYYY-MM-dd"); 105 106 //########################################################################## 107 // CONSTRUCTORS 108 //########################################################################## 109 110 //--------------------------------------------------------------------------- 111 public NCBIGenomicAssemblyInfo() 112 { 113 114 } 115 116 //--------------------------------------------------------------------------- 117 public NCBIGenomicAssemblyInfo(XMLTag inXMLTag) 118 { 119 inXMLTag.verifyTagName(NCBI_GENOMIC_ASSEMBLY_INFO); 120 121 XMLTag assemblyAccessionTag = inXMLTag.getRequiredSubtagByName(ASSEMBLY_ACCESSION); 122 setAssemblyAccession(assemblyAccessionTag.getContent().trim()); 123 124 XMLTag bioprojectAccessionTag = inXMLTag.getRequiredSubtagByName(BIOPROJECT_ACCESSION); 125 setBioprojectAccession(bioprojectAccessionTag.getContent().trim()); 126 127 XMLTag biosampleAccessionTag = inXMLTag.getRequiredSubtagByName(BIOSAMPLE_ACCESSION); 128 setBioprojectAccession(biosampleAccessionTag.getContent().trim()); 129 130 XMLTag wgsAccessionTag = inXMLTag.getRequiredSubtagByName(WGS_ACCESSION); 131 setWGSAccession(wgsAccessionTag.getContent().trim()); 132 133 XMLTag refseqCategoryTag = inXMLTag.getRequiredSubtagByName(REFSEQ_CATEGORY); 134 setRefSeqCategory(GenomicRefSeqCategory.valueOf(refseqCategoryTag.getContent().trim())); 135 136 XMLTag organismTaxonTag = inXMLTag.getRequiredSubtagByName(ORGANISM_TAXON); 137 setOrganismTaxon(NCBITaxon.getByTaxonId(Integer.parseInt(organismTaxonTag.getContent().trim()))); 138 139 XMLTag speciesTaxonTag = inXMLTag.getRequiredSubtagByName(SPECIES_TAXON); 140 setSpeciesTaxon(NCBITaxon.getByTaxonId(Integer.parseInt(speciesTaxonTag.getContent().trim()))); 141 142 XMLTag infraspecificNameTag = inXMLTag.getOptionalSubtagByName(INFRASPECIFIC_NAME); 143 if (infraspecificNameTag != null) 144 { 145 setInfraspecificName(infraspecificNameTag.getContent().trim()); 146 } 147 148 XMLTag isolateTag = inXMLTag.getOptionalSubtagByName(ISOLATE); 149 if (isolateTag != null) 150 { 151 setIsolate(isolateTag.getContent().trim()); 152 } 153 154 XMLTag assemblyVersionStatusTag = inXMLTag.getRequiredSubtagByName(ASSEMBLY_VERSION_STATUS); 155 setAssemblyVersionStatus(GenomicAssemblyVersionStatus.valueOf(assemblyVersionStatusTag.getContent().trim())); 156 157 XMLTag assemblyLevelTag = inXMLTag.getRequiredSubtagByName(ASSEMBLY_LEVEL); 158 setAssemblyLevel(GenomicAssemblyLevel.valueOf(assemblyLevelTag.getContent().trim())); 159 160 XMLTag assemblyReleaseTypeTag = inXMLTag.getRequiredSubtagByName(ASSEMBLY_RELEASE_TYPE); 161 setAssemblyReleaseType(GenomicAssemblyReleaseType.valueOf(assemblyReleaseTypeTag.getContent().trim())); 162 163 XMLTag genomicRepresentationTag = inXMLTag.getRequiredSubtagByName(GENOMIC_REPRESENTATION); 164 setGenomicRepresentation(GenomicRepresentation.valueOf(genomicRepresentationTag.getContent().trim())); 165 166 XMLTag releaseDateTag = inXMLTag.getRequiredSubtagByName(RELEASE_DATE); 167 try 168 { 169 setReleaseDate(mDateFormat.parse(releaseDateTag.getContent().trim())); 170 } 171 catch (ParseException e) 172 { 173 throw new RuntimeException(e); 174 } 175 176 XMLTag assemblyNameTag = inXMLTag.getRequiredSubtagByName(ASSEMBLY_NAME); 177 setAssemblyName(assemblyNameTag.getContent().trim()); 178 179 XMLTag submitterTag = inXMLTag.getRequiredSubtagByName(SUBMITTER); 180 setSubmitter(submitterTag.getContent().trim()); 181 182 XMLTag genbankRefseqPairedAssemblyTag = inXMLTag.getOptionalSubtagByName(GENBANK_REFSEQ_PAIRED_ASSEMBLY); 183 if (genbankRefseqPairedAssemblyTag != null) 184 { 185 setGenBankRefSeqPairedAssembly(genbankRefseqPairedAssemblyTag.getContent().trim()); 186 } 187 188 XMLTag genomicPairedAssemblyComparisonTag = inXMLTag.getOptionalSubtagByName(GENOMIC_PAIRED_ASSEMBLY_COMPARISON); 189 if (genomicPairedAssemblyComparisonTag != null) 190 { 191 setPairedAssemblyComparison(GenomicPairedAssemblyComparison.valueOf(genomicPairedAssemblyComparisonTag.getContent().trim())); 192 } 193 194 XMLTag ftpPathTag = inXMLTag.getRequiredSubtagByName(FTP_PATH); 195 setFTP_Path(ftpPathTag.getContent().trim()); 196 197 XMLTag excludedFromRefseqTag = inXMLTag.getRequiredSubtagByName(EXCLUDED_FROM_REFSEQ); 198 setExcludedFromRefSeq(BooleanUtil.valueOf(excludedFromRefseqTag.getContent().trim())); 199 200 XMLTag genomicRelationToTypeMaterialTag = inXMLTag.getOptionalSubtagByName(GENOMIC_RELATION_TO_TYPE_MATERIAL); 201 if (genomicRelationToTypeMaterialTag != null) 202 { 203 setRelationToTypeMaterial(GenomicRelationToTypeMaterial.valueOf(genomicRelationToTypeMaterialTag.getContent().trim())); 204 } 205 } 206 207 //########################################################################## 208 // PUBLIC METHODS 209 //########################################################################## 210 211 //--------------------------------------------------------------------------- 212 /** 213 * Use for processing an assembly_summary.txt file from the NCBI ftp site. 214 * @param inFile the assembly_summary.txt file 215 * @return a Map with species taxons as the keys 216 * @throws IOException 217 * @throws ParseException 218 */ 219 public static Map<NCBITaxon, List<NCBIGenomicAssemblyInfo>> extractInfoFromAssemblySummaryFile(File inFile) 220 throws IOException, ParseException 221 { 222 List<String[]> tsvData = TSV.parse(new BufferedReader(new FileReader(inFile))); 223 224 Map<NCBITaxon, List<NCBIGenomicAssemblyInfo>> assemblyMap = new HashMap<>(tsvData.size()); 225 226 String[] headerCols = tsvData.get(1); 227 if (headerCols.length != 22) 228 { 229 throw new IOException("The assembly_summary.txt file does not have the expected number of columns!"); 230 } 231 232 SimpleDateFormat YYYYMMDD_format = new SimpleDateFormat("yyyy/MM/dd"); 233 234 // Build the map of assembly data 235 for (int i = 2; i < tsvData.size(); i++) 236 { 237 String[] fields = tsvData.get(i); 238 239 NCBIGenomicAssemblyInfo assemblyInfo = new NCBIGenomicAssemblyInfo() 240 .setAssemblyAccession(fields[0]) 241 .setBioprojectAccession(fields[1]) 242 .setBiosampleAccession(fields[2]) 243 .setWGSAccession(fields[3]) 244 .setRefSeqCategory(GenomicRefSeqCategory.valueOf(fields[4])) 245 .setOrganismTaxon(NCBITaxon.getByTaxonId(Integer.parseInt(fields[5]))) 246 .setSpeciesTaxon(NCBITaxon.getByTaxonId(Integer.parseInt(fields[6]))) 247 // Skipping field 7 (the species name) since is part of the taxon info 248 .setInfraspecificName(fields[8]) 249 .setIsolate(fields[9]) 250 .setAssemblyVersionStatus(GenomicAssemblyVersionStatus.valueOf(fields[10])) 251 .setAssemblyLevel(GenomicAssemblyLevel.valueOf(fields[11])) 252 .setAssemblyReleaseType(GenomicAssemblyReleaseType.valueOf(fields[12])) 253 .setGenomicRepresentation(GenomicRepresentation.valueOf(fields[13])) 254 .setReleaseDate(YYYYMMDD_format.parse(fields[14])) // Ex: 2019/07/30 255 .setAssemblyName(fields[15]) 256 .setSubmitter(fields[16]) 257 .setGenBankRefSeqPairedAssembly(fields[17]) 258 .setPairedAssemblyComparison(GenomicPairedAssemblyComparison.valueOf(fields[18])) 259 .setFTP_Path(fields[19]) 260 .setExcludedFromRefSeq(BooleanUtil.valueOf(fields[20])) 261 .setRelationToTypeMaterial(GenomicRelationToTypeMaterial.valueOf(fields[21])); 262 263 List<NCBIGenomicAssemblyInfo> infoList = assemblyMap.get(assemblyInfo.getSpeciesTaxon()); 264 if (null == infoList) 265 { 266 infoList = new ArrayList<>(2); 267 assemblyMap.put(assemblyInfo.getSpeciesTaxon(), infoList); 268 } 269 270 infoList.add(assemblyInfo); 271 } 272 273 return assemblyMap; 274 } 275 276 277 //--------------------------------------------------------------------------- 278 @Override 279 public String toString() 280 { 281 StringBuilderPlus buffer = new StringBuilderPlus().setDelimiter("\n") 282 .delimitedAppend("assembly_accession: " + getAssemblyAccession()) 283 .delimitedAppend("bioproject: " + getBioprojectAccession()) 284 .delimitedAppend("biosample: " + getBiosampleAccession()) 285 .delimitedAppend("wgs_master: " + getWGSAccession()) 286 .delimitedAppend("refseq_category: " + getRefSeqCategory()) 287 .delimitedAppend("taxid: " + getOrganismTaxon().getTaxonId()) 288 .delimitedAppend("species_taxid: " + getSpeciesTaxon().getTaxonId()) 289 .delimitedAppend("organism_name: " + getSpeciesTaxon().getScientificName()) 290 .delimitedAppend("infraspecific_name: " + getInfraspecificName()) 291 .delimitedAppend("isolate: " + getIsolate()) 292 .delimitedAppend("version_status: " + getAssemblyVersionStatus()) 293 .delimitedAppend("assembly_level: " + getAssemblyLevel()) 294 .delimitedAppend("release_type: " + getAssemblyReleaseType()) 295 .delimitedAppend("genome_rep: " + getGenomicRepresentation()) 296 .delimitedAppend("seq_rel_date: " + getReleaseDate()) 297 .delimitedAppend("asm_name: " + getAssemblyName()) 298 .delimitedAppend("submitter: " + getSubmitter()) 299 .delimitedAppend("gbrs_paired_asm: " + getGenBankRefSeqPairedAssembly()) 300 .delimitedAppend("paired_asm_comp: " + getPairedAssemblyComparison()) 301 .delimitedAppend("ftp_path: " + getFTP_Path()) 302 .delimitedAppend("excluded_from_refseq: " + getExcludedFromRefSeq()) 303 .delimitedAppend("relation_to_type_material: " + (getRelationToTypeMaterial() != null ? getRelationToTypeMaterial() : "")); 304 305 return buffer.toString(); 306 } 307 308 //--------------------------------------------------------------------------- 309 public XMLTag toXMLTag() 310 { 311 XMLTag rootTag = new XMLTag(NCBI_GENOMIC_ASSEMBLY_INFO); 312 313 rootTag.addSubtag(ASSEMBLY_ACCESSION).setContent(getAssemblyAccession()); 314 rootTag.addSubtag(BIOPROJECT_ACCESSION).setContent(getBioprojectAccession()); 315 rootTag.addSubtag(BIOSAMPLE_ACCESSION).setContent(getBiosampleAccession()); 316 rootTag.addSubtag(WGS_ACCESSION).setContent(getWGSAccession()); 317 rootTag.addSubtag(REFSEQ_CATEGORY).setContent(getRefSeqCategory().name()); 318 rootTag.addSubtag(ORGANISM_TAXON).setContent(getOrganismTaxon().getTaxonId()); 319 rootTag.addSubtag(SPECIES_TAXON).setContent(getSpeciesTaxon().getTaxonId()); 320 321 if (getInfraspecificName() != null) 322 { 323 rootTag.addSubtag(INFRASPECIFIC_NAME).setContent(getInfraspecificName()); 324 } 325 326 if (getIsolate() != null) 327 { 328 rootTag.addSubtag(ISOLATE).setContent(getIsolate()); 329 } 330 331 rootTag.addSubtag(ASSEMBLY_VERSION_STATUS).setContent(getAssemblyVersionStatus().name()); 332 rootTag.addSubtag(ASSEMBLY_LEVEL).setContent(getAssemblyLevel().name()); 333 rootTag.addSubtag(ASSEMBLY_RELEASE_TYPE).setContent(getAssemblyReleaseType().name()); 334 rootTag.addSubtag(GENOMIC_REPRESENTATION).setContent(getGenomicRepresentation().name()); 335 rootTag.addSubtag(RELEASE_DATE).setContent(mDateFormat.format(getReleaseDate())); 336 rootTag.addSubtag(ASSEMBLY_NAME).setContent(getAssemblyName()); 337 rootTag.addSubtag(SUBMITTER).setContent(getSubmitter()); 338 339 340 if (getGenBankRefSeqPairedAssembly() != null) 341 { 342 rootTag.addSubtag(GENBANK_REFSEQ_PAIRED_ASSEMBLY).setContent(getGenBankRefSeqPairedAssembly()); 343 } 344 345 if (getPairedAssemblyComparison() != null) 346 { 347 rootTag.addSubtag(GENOMIC_PAIRED_ASSEMBLY_COMPARISON).setContent(getPairedAssemblyComparison().name()); 348 } 349 350 rootTag.addSubtag(FTP_PATH).setContent(getFTP_Path()); 351 rootTag.addSubtag(EXCLUDED_FROM_REFSEQ).setContent(getExcludedFromRefSeq() ? "true" : "false"); 352 353 if (getRelationToTypeMaterial() != null) 354 { 355 rootTag.addSubtag(GENOMIC_RELATION_TO_TYPE_MATERIAL).setContent(getRelationToTypeMaterial().name()); 356 } 357 358 return rootTag; 359 } 360 361 //--------------------------------------------------------------------------- 362 public NCBIGenomicAssemblyInfo setAssemblyAccession(String inValue) 363 { 364 mAssemblyAccession = inValue; 365 return this; 366 } 367 368 //--------------------------------------------------------------------------- 369 public String getAssemblyAccession() 370 { 371 return mAssemblyAccession; 372 } 373 374 375 //--------------------------------------------------------------------------- 376 public NCBIGenomicAssemblyInfo setBioprojectAccession(String inValue) 377 { 378 mBioprojectAccession = inValue; 379 return this; 380 } 381 382 //--------------------------------------------------------------------------- 383 public String getBioprojectAccession() 384 { 385 return mBioprojectAccession; 386 } 387 388 389 //--------------------------------------------------------------------------- 390 public NCBIGenomicAssemblyInfo setBiosampleAccession(String inValue) 391 { 392 mBiosampleAccession = inValue; 393 return this; 394 } 395 396 //--------------------------------------------------------------------------- 397 public String getBiosampleAccession() 398 { 399 return mBiosampleAccession; 400 } 401 402 403 //--------------------------------------------------------------------------- 404 public NCBIGenomicAssemblyInfo setWGSAccession(String inValue) 405 { 406 mWGSAccession = inValue; 407 return this; 408 } 409 410 //--------------------------------------------------------------------------- 411 public String getWGSAccession() 412 { 413 return mWGSAccession; 414 } 415 416 417 //--------------------------------------------------------------------------- 418 public NCBIGenomicAssemblyInfo setRefSeqCategory(GenomicRefSeqCategory inValue) 419 { 420 mRefseqCategory = inValue; 421 return this; 422 } 423 424 //--------------------------------------------------------------------------- 425 public GenomicRefSeqCategory getRefSeqCategory() 426 { 427 return mRefseqCategory; 428 } 429 430 431 //--------------------------------------------------------------------------- 432 public NCBIGenomicAssemblyInfo setOrganismTaxon(NCBITaxon inValue) 433 { 434 mOrganismNCBITaxon = inValue; 435 return this; 436 } 437 438 //--------------------------------------------------------------------------- 439 public NCBITaxon getOrganismTaxon() 440 { 441 return mOrganismNCBITaxon; 442 } 443 444 445 //--------------------------------------------------------------------------- 446 public NCBIGenomicAssemblyInfo setSpeciesTaxon(NCBITaxon inValue) 447 { 448 mSpeciesNCBITaxon = inValue; 449 return this; 450 } 451 452 //--------------------------------------------------------------------------- 453 public NCBITaxon getSpeciesTaxon() 454 { 455 return mSpeciesNCBITaxon; 456 } 457 458 459 //--------------------------------------------------------------------------- 460 public NCBIGenomicAssemblyInfo setInfraspecificName(String inValue) 461 { 462 mInfraspecificName = inValue; 463 return this; 464 } 465 466 //--------------------------------------------------------------------------- 467 public String getInfraspecificName() 468 { 469 return mInfraspecificName; 470 } 471 472 473 //--------------------------------------------------------------------------- 474 public NCBIGenomicAssemblyInfo setIsolate(String inValue) 475 { 476 mIsolate = inValue; 477 return this; 478 } 479 480 //--------------------------------------------------------------------------- 481 public String getIsolate() 482 { 483 return mIsolate; 484 } 485 486 487 //--------------------------------------------------------------------------- 488 public NCBIGenomicAssemblyInfo setAssemblyVersionStatus(GenomicAssemblyVersionStatus inValue) 489 { 490 mAssemblyVersionStatus = inValue; 491 return this; 492 } 493 494 //--------------------------------------------------------------------------- 495 public GenomicAssemblyVersionStatus getAssemblyVersionStatus() 496 { 497 return mAssemblyVersionStatus; 498 } 499 500 501 //--------------------------------------------------------------------------- 502 public NCBIGenomicAssemblyInfo setAssemblyLevel(GenomicAssemblyLevel inValue) 503 { 504 mAssemblyLevel = inValue; 505 return this; 506 } 507 508 //--------------------------------------------------------------------------- 509 public GenomicAssemblyLevel getAssemblyLevel() 510 { 511 return mAssemblyLevel; 512 } 513 514 515 //--------------------------------------------------------------------------- 516 public NCBIGenomicAssemblyInfo setAssemblyReleaseType(GenomicAssemblyReleaseType inValue) 517 { 518 mAssemblyReleaseType = inValue; 519 return this; 520 } 521 522 //--------------------------------------------------------------------------- 523 public GenomicAssemblyReleaseType getAssemblyReleaseType() 524 { 525 return mAssemblyReleaseType; 526 } 527 528 529 //--------------------------------------------------------------------------- 530 public NCBIGenomicAssemblyInfo setGenomicRepresentation(GenomicRepresentation inValue) 531 { 532 mGenomicRepresentation = inValue; 533 return this; 534 } 535 536 //--------------------------------------------------------------------------- 537 public GenomicRepresentation getGenomicRepresentation() 538 { 539 return mGenomicRepresentation; 540 } 541 542 543 //--------------------------------------------------------------------------- 544 public NCBIGenomicAssemblyInfo setReleaseDate(Date inValue) 545 { 546 mReleaseDate = inValue; 547 return this; 548 } 549 550 //--------------------------------------------------------------------------- 551 public Date getReleaseDate() 552 { 553 return mReleaseDate; 554 } 555 556 557 //--------------------------------------------------------------------------- 558 public NCBIGenomicAssemblyInfo setAssemblyName(String inValue) 559 { 560 mAssemblyName = inValue; 561 return this; 562 } 563 564 //--------------------------------------------------------------------------- 565 public String getAssemblyName() 566 { 567 return mAssemblyName; 568 } 569 570 571 //--------------------------------------------------------------------------- 572 public NCBIGenomicAssemblyInfo setSubmitter(String inValue) 573 { 574 mSubmitter = inValue; 575 return this; 576 } 577 578 //--------------------------------------------------------------------------- 579 public String getSubmitter() 580 { 581 return mSubmitter; 582 } 583 584 585 //--------------------------------------------------------------------------- 586 public NCBIGenomicAssemblyInfo setGenBankRefSeqPairedAssembly(String inValue) 587 { 588 mGenBankRefSeqPairedAssembly = inValue; 589 return this; 590 } 591 592 //--------------------------------------------------------------------------- 593 public String getGenBankRefSeqPairedAssembly() 594 { 595 return mGenBankRefSeqPairedAssembly; 596 } 597 598 599 //--------------------------------------------------------------------------- 600 public NCBIGenomicAssemblyInfo setPairedAssemblyComparison(GenomicPairedAssemblyComparison inValue) 601 { 602 mGenomicPairedAssemblyComparison = inValue; 603 return this; 604 } 605 606 //--------------------------------------------------------------------------- 607 public GenomicPairedAssemblyComparison getPairedAssemblyComparison() 608 { 609 return mGenomicPairedAssemblyComparison; 610 } 611 612 613 //--------------------------------------------------------------------------- 614 public NCBIGenomicAssemblyInfo setFTP_Path(String inValue) 615 { 616 mFTP_Path = inValue; 617 return this; 618 } 619 620 //--------------------------------------------------------------------------- 621 public String getFTP_Path() 622 { 623 return mFTP_Path; 624 } 625 626 627 //--------------------------------------------------------------------------- 628 public NCBIGenomicAssemblyInfo setExcludedFromRefSeq(boolean inValue) 629 { 630 mExcludedFromRefSeq = inValue; 631 return this; 632 } 633 634 //--------------------------------------------------------------------------- 635 public boolean getExcludedFromRefSeq() 636 { 637 return mExcludedFromRefSeq; 638 } 639 640 641 //--------------------------------------------------------------------------- 642 public NCBIGenomicAssemblyInfo setRelationToTypeMaterial(GenomicRelationToTypeMaterial inValue) 643 { 644 mGenomicRelationToTypeMaterial = inValue; 645 return this; 646 } 647 648 //--------------------------------------------------------------------------- 649 public GenomicRelationToTypeMaterial getRelationToTypeMaterial() 650 { 651 return mGenomicRelationToTypeMaterial; 652 } 653 654 655 //--------------------------------------------------------------------------- 656 /** 657 * Compares this object with the specified object for order. Returns a 658 * negative integer, zero, or a positive integer as this object is less 659 * than, equal to, or greater than the specified object. 660 * 661 * <p>The implementor must ensure 662 * {@code sgn(x.compareTo(y)) == -sgn(y.compareTo(x))} 663 * for all {@code x} and {@code y}. (This 664 * implies that {@code x.compareTo(y)} must throw an exception iff 665 * {@code y.compareTo(x)} throws an exception.) 666 * 667 * <p>The implementor must also ensure that the relation is transitive: 668 * {@code (x.compareTo(y) > 0 && y.compareTo(z) > 0)} implies 669 * {@code x.compareTo(z) > 0}. 670 * 671 * <p>Finally, the implementor must ensure that {@code x.compareTo(y)==0} 672 * implies that {@code sgn(x.compareTo(z)) == sgn(y.compareTo(z))}, for 673 * all {@code z}. 674 * 675 * <p>It is strongly recommended, but <i>not</i> strictly required that 676 * {@code (x.compareTo(y)==0) == (x.equals(y))}. Generally speaking, any 677 * class that implements the {@code Comparable} interface and violates 678 * this condition should clearly indicate this fact. The recommended 679 * language is "Note: this class has a natural ordering that is 680 * inconsistent with equals." 681 * 682 * <p>In the foregoing description, the notation 683 * {@code sgn(}<i>expression</i>{@code )} designates the mathematical 684 * <i>signum</i> function, which is defined to return one of {@code -1}, 685 * {@code 0}, or {@code 1} according to whether the value of 686 * <i>expression</i> is negative, zero, or positive, respectively. 687 * 688 * @param inObj2 the object to be compared. 689 * @return a negative integer, zero, or a positive integer as this object 690 * is less than, equal to, or greater than the specified object. 691 * @throws ClassCastException if the specified object's type prevents it 692 * from being compared to this object. 693 */ 694 @Override 695 public int compareTo(NCBIGenomicAssemblyInfo inObj2) 696 { 697 int result = -1; 698 if (inObj2 != null) 699 { 700 result = CompareUtil.compare(getSpeciesTaxon(), inObj2.getSpeciesTaxon()); 701 702 if (0 == result) 703 { 704 result = CompareUtil.compare(getOrganismTaxon(), inObj2.getOrganismTaxon()); 705 706 if (0 == result) 707 { 708 result = CompareUtil.compare(getRefSeqCategory(), inObj2.getRefSeqCategory()); 709 710 if (0 == result) 711 { 712 result = CompareUtil.compare(getGenomicRepresentation(), inObj2.getGenomicRepresentation()); 713 714 if (0 == result) 715 { 716 result = CompareUtil.compare(getAssemblyReleaseType(), inObj2.getAssemblyReleaseType()); 717 718 if (0 == result) 719 { 720 result = CompareUtil.compare(getAssemblyVersionStatus(), inObj2.getAssemblyVersionStatus()); 721 } 722 } 723 } 724 } 725 } 726 } 727 728 return result; 729 } 730}