Module: Bio::NCBI::REST::EFetch::Methods

Included in:
Bio::NCBI::REST::EFetch, Bio::NCBI::REST::EFetch
Defined in:
lib/bio/io/ncbirest.rb

Instance Method Summary collapse

Instance Method Details

#journal(ids, format = "full", hash = {}) ⇒ Object

Retrieve journal entries by given IDs using E-Utils (efetch).

Usage

Bio::NCBI::REST::EFetch.journal(21854)

list = [21854, 21855]
Bio::NCBI::REST::EFetch.journal(list)
Bio::NCBI::REST::EFetch.journal(list, "xml")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.journal(list)
ncbi.journal(list, "xml")

Arguments:

  • ids: list of journal entry IDs (required)

  • format: “full”, “xml”

Returns

String



761
762
763
764
765
766
767
768
769
770
771
772
# File 'lib/bio/io/ncbirest.rb', line 761

def journal(ids, format = "full", hash = {})
  case format
  when "xml"
    format = "full"
    mode = "xml"
  else
    mode = "text"
  end
  opts = { "db" => "journals", "rettype" => format, "retmode" => mode }
  opts.update(hash)
  Bio::NCBI::REST.efetch(ids, opts)
end

#nucleotide(ids, format = "gb", hash = {}) ⇒ Object

Retrieve nucleotide sequence entries by given IDs using E-Utils (efetch).

nucleotide = nuccore + nucest + nucgss

format (rettype):

  • native all but Gene ASN Default format for viewing sequences

  • fasta all sequence FASTA view of a sequence

  • gb NA sequence GenBank view for sequences

  • gbc NA sequence INSDSeq structured flat file

  • gbwithparts NA sequence GenBank CON division with sequences

  • est dbEST sequence EST Report

  • gss dbGSS sequence GSS Report

  • gp AA sequence GenPept view

  • gpc AA sequence INSDSeq structured flat file

  • seqid all sequence Convert GIs into seqids

  • acc all sequence Convert GIs into accessions

  • chr dbSNP only SNP Chromosome Report

  • flt dbSNP only SNP Flat File report

  • rsr dbSNP only SNP RS Cluster report

  • brief dbSNP only SNP ID list

  • docset dbSNP only SNP RS summary

Usage

Bio::NCBI::REST::EFetch.nucleotide("123,U12345,U12345.1,gb|U12345|")

list = [123, "U12345.1", "gb|U12345|"]
Bio::NCBI::REST::EFetch.nucleotide(list)
Bio::NCBI::REST::EFetch.nucleotide(list, "fasta")
Bio::NCBI::REST::EFetch.nucleotide(list, "acc")
Bio::NCBI::REST::EFetch.nucleotide(list, "xml")

Bio::NCBI::REST::EFetch.nucleotide("AE009950")
Bio::NCBI::REST::EFetch.nucleotide("AE009950", "gbwithparts")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.nucleotide("123,U12345,U12345.1,gb|U12345|")
ncbi.nucleotide(list)
ncbi.nucleotide(list, "fasta")
ncbi.nucleotide(list, "acc")
ncbi.nucleotide(list, "xml")
ncbi.nucleotide("AE009950")
ncbi.nucleotide("AE009950", "gbwithparts")

Arguments:

  • ids: list of NCBI entry IDs (required)

  • format: “gb”, “gbc”, “fasta”, “acc”, “xml” etc.

Returns

String



595
596
597
598
599
600
601
602
603
# File 'lib/bio/io/ncbirest.rb', line 595

def nucleotide(ids, format = "gb", hash = {})
  case format
  when "xml"
    format = "gbc"
  end
  opts = { "db" => "nucleotide", "rettype" => format }
  opts.update(hash)
  Bio::NCBI::REST.efetch(ids, opts)
end

#omim(ids, format = "detailed", hash = {}) ⇒ Object

Retrieve OMIM entries by given IDs using E-Utils (efetch).

Usage

Bio::NCBI::REST::EFetch.omim(143100)

list = [143100, 602260]
Bio::NCBI::REST::EFetch.omim(list)
Bio::NCBI::REST::EFetch.omim(list, "xml")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.omim(list)
ncbi.omim(list, "xml")

Arguments:

  • ids: list of OMIM entry IDs (required)

  • format: “docsum”, “synopsis”, “variants”, “detailed”, “linkout”, “xml”

Returns

String



796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
# File 'lib/bio/io/ncbirest.rb', line 796

def omim(ids, format = "detailed", hash = {})
  case format
  when "xml"
    format = "full"
    mode = "xml"
  when "linkout"
    format = "ExternalLink"
    mode = "text"
  else
    mode = "text"
  end
  opts = { "db" => "omim", "rettype" => format, "retmode" => mode }
  opts.update(hash)
  Bio::NCBI::REST.efetch(ids, opts)
end

#pmc(ids, format = "docsum", hash = {}) ⇒ Object

Retrieve PubMed Central entries by given IDs using E-Utils (efetch).

Usage

Bio::NCBI::REST::EFetch.pmc(1360101)
Bio::NCBI::REST::EFetch.pmc("1360101,534663")

list = [1360101, 534663]
Bio::NCBI::REST::EFetch.pmc(list)
Bio::NCBI::REST::EFetch.pmc(list, "xml")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.pmc(list)
ncbi.pmc(list, "xml")

Arguments:

  • ids: list of PubMed Central entry IDs (required)

  • format: “docsum”, “xml”

Returns

String



727
728
729
730
731
732
733
734
735
736
737
# File 'lib/bio/io/ncbirest.rb', line 727

def pmc(ids, format = "docsum", hash = {})
  case format
  when "xml"
    format = "medline"
    mode = "xml"
  else
    mode = "text"
  end
  opts = { "db" => "pmc", "rettype" => format, "retmode" => mode }
  Bio::NCBI::REST.efetch(ids, opts)
end

#protein(ids, format = "gp", hash = {}) ⇒ Object

Retrieve protein sequence entries by given IDs using E-Utils (efetch).

protein

format (rettype):

  • native all but Gene ASN Default format for viewing sequences

  • fasta all sequence FASTA view of a sequence

  • gb NA sequence GenBank view for sequences

  • gbc NA sequence INSDSeq structured flat file

  • gbwithparts NA sequence GenBank CON division with sequences

  • est dbEST sequence EST Report

  • gss dbGSS sequence GSS Report

  • gp AA sequence GenPept view

  • gpc AA sequence INSDSeq structured flat file

  • seqid all sequence Convert GIs into seqids

  • acc all sequence Convert GIs into accessions

  • chr dbSNP only SNP Chromosome Report

  • flt dbSNP only SNP Flat File report

  • rsr dbSNP only SNP RS Cluster report

  • brief dbSNP only SNP ID list

  • docset dbSNP only SNP RS summary

Usage

Bio::NCBI::REST::EFetch.protein("7527480,AAF63163.1,AAF63163")

list = [ 7527480, "AAF63163.1", "AAF63163"]
Bio::NCBI::REST::EFetch.protein(list)
Bio::NCBI::REST::EFetch.protein(list, "fasta")
Bio::NCBI::REST::EFetch.protein(list, "acc")
Bio::NCBI::REST::EFetch.protein(list, "xml")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.protein("7527480,AAF63163.1,AAF63163")
ncbi.protein(list)
ncbi.protein(list, "fasta")
ncbi.protein(list, "acc")
ncbi.protein(list, "xml")

Arguments:

  • ids: list of NCBI entry IDs (required)

  • format: “gp”, “gpc”, “fasta”, “acc”, “xml” etc.

Returns

String



652
653
654
655
656
657
658
659
660
# File 'lib/bio/io/ncbirest.rb', line 652

def protein(ids, format = "gp", hash = {})
  case format
  when "xml"
    format = "gpc"
  end
  opts = { "db" => "protein", "rettype" => format }
  opts.update(hash)
  Bio::NCBI::REST.efetch(ids, opts)
end

#pubmed(ids, format = "medline", hash = {}) ⇒ Object

Retrieve PubMed entries by given IDs using E-Utils (efetch).

Usage

Bio::NCBI::REST::EFetch.pubmed(15496913)
Bio::NCBI::REST::EFetch.pubmed("15496913,11181995")

list = [15496913, 11181995]
Bio::NCBI::REST::EFetch.pubmed(list)
Bio::NCBI::REST::EFetch.pubmed(list, "abstract")
Bio::NCBI::REST::EFetch.pubmed(list, "citation")
Bio::NCBI::REST::EFetch.pubmed(list, "medline")
Bio::NCBI::REST::EFetch.pubmed(list, "xml")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.pubmed(list)
ncbi.pubmed(list, "abstract")
ncbi.pubmed(list, "citation")
ncbi.pubmed(list, "medline")
ncbi.pubmed(list, "xml")

Arguments:

  • ids: list of PubMed entry IDs (required)

  • format: “abstract”, “citation”, “medline”, “xml”

Returns

String



691
692
693
694
695
696
697
698
699
700
701
702
# File 'lib/bio/io/ncbirest.rb', line 691

def pubmed(ids, format = "medline", hash = {})
  case format
  when "xml"
    format = "medline"
    mode = "xml"
  else
    mode = "text"
  end
  opts = { "db" => "pubmed", "rettype" => format, "retmode" => mode }
  opts.update(hash)
  Bio::NCBI::REST.efetch(ids, opts)
end

#sequence(ids, format = "gb", hash = {}) ⇒ Object

Retrieve sequence entries by given IDs using E-Utils (efetch).

sequences = gene + genome + nucleotide + protein + popset + snp
nucleotide = nuccore + nucest + nucgss

format (rettype):

  • native all but Gene ASN Default format for viewing sequences

  • fasta all sequence FASTA view of a sequence

  • gb NA sequence GenBank view for sequences

  • gbc NA sequence INSDSeq structured flat file

  • gbwithparts NA sequence GenBank CON division with sequences

  • est dbEST sequence EST Report

  • gss dbGSS sequence GSS Report

  • gp AA sequence GenPept view

  • gpc AA sequence INSDSeq structured flat file

  • seqid all sequence Convert GIs into seqids

  • acc all sequence Convert GIs into accessions

  • chr dbSNP only SNP Chromosome Report

  • flt dbSNP only SNP Flat File report

  • rsr dbSNP only SNP RS Cluster report

  • brief dbSNP only SNP ID list

  • docset dbSNP only SNP RS summary

Usage

Bio::NCBI::REST::EFetch.sequence("123,U12345,U12345.1,gb|U12345|")

list = [123, "U12345.1", "gb|U12345|"]
Bio::NCBI::REST::EFetch.sequence(list)
Bio::NCBI::REST::EFetch.sequence(list, "fasta")
Bio::NCBI::REST::EFetch.sequence(list, "acc")
Bio::NCBI::REST::EFetch.sequence(list, "xml")

Bio::NCBI::REST::EFetch.sequence("AE009950")
Bio::NCBI::REST::EFetch.sequence("AE009950", "gbwithparts")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.sequence("123,U12345,U12345.1,gb|U12345|")
ncbi.sequence(list)
ncbi.sequence(list, "fasta")
ncbi.sequence(list, "acc")
ncbi.sequence(list, "xml")
ncbi.sequence("AE009950")
ncbi.sequence("AE009950", "gbwithparts")

Arguments:

  • ids: list of NCBI entry IDs (required)

  • format: “gb”, “gbc”, “fasta”, “acc”, “xml” etc.

Returns

String



533
534
535
536
537
538
539
540
541
# File 'lib/bio/io/ncbirest.rb', line 533

def sequence(ids, format = "gb", hash = {})
  case format
  when "xml"
    format = "gbc"
  end
  opts = { "db" => "sequences", "rettype" => format }
  opts.update(hash)
  Bio::NCBI::REST.efetch(ids, opts)
end

#taxonomy(ids, format = "docsum", hash = {}) ⇒ Object

Retrieve taxonomy entries by given IDs using E-Utils (efetch).

Usage

Bio::NCBI::REST::EFetch.taxonomy(42241)

list = [232323, 290179, 286681]
Bio::NCBI::REST::EFetch.taxonomy(list)
Bio::NCBI::REST::EFetch.taxonomy(list, "xml")

ncbi = Bio::NCBI::REST::EFetch.new
ncbi.taxonomy(list)
ncbi.taxonomy(list, "xml")

Arguments:

  • ids: list of Taxonomy entry IDs (required)

  • format: “brief”, “docsum”, “xml”

Returns

String



834
835
836
837
838
839
840
841
842
843
844
# File 'lib/bio/io/ncbirest.rb', line 834

def taxonomy(ids, format = "docsum", hash = {})
  case format
  when "xml"
    format = "full"
    mode = "xml"
  else
    mode = "text"
  end
  opts = { "db" => "taxonomy", "rettype" => format, "retmode" => mode }
  Bio::NCBI::REST.efetch(ids, opts)
end